Smart code completion for Package.swift manifest files:
In .package(...) function:
url: argument with GitHub repository suggestions
from: and exact: arguments with version suggestions
branch: argument with available branch names
In .product(...) function:
name: argument with available product suggestions from dependencies
package: argument with package name suggestions
Note: After editing package dependencies (.package(...)), save the file for changes to be reflected in target completions.
Warning: This extension activates autocompletion inside string literals for all Swift files in the workspace, not just Package.swift files.
Contextual hover information:
Package details including location and state when hovering over package names
Available products in the package
Requirements
macOS (currently only supported on macOS platforms)
x86_64 or arm64 architecture
Installation
You can install this extension directly from the Visual Studio Code Marketplace or by building it from source.
Building from Source
Clone this repository
Run npm install to install dependencies
Run npm run compile to compile TypeScript files
Run npm run package to create the VSIX package
Install the VSIX package in VS Code using the "Install from VSIX..." command
Extension Settings
This extension contributes the following settings:
package-swift-lsp.enable: Enable/disable the Package.swift LSP extension
package-swift-lsp.path: Optional path to a custom package-swift-lsp executable
How it Works
On first activation, the extension will:
Check if a custom path to the language server is configured
If not, look for the language server in PATH
If not found, download the latest release from GitHub
Start the language server for Package.swift files and versioned manifest files (Package@swift-X.Y.Z.swift)
The extension will only activate for files that exactly match the pattern Package.swift or Package@swift-X.Y.Z.swift where X, Y, and Z are version numbers.
License
This extension is available under the MIT license.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.