kattouf/package-swift-lsp
A Language Server Protocol (LSP) implementation for Swift Package Manager's Package.swift manifest files.
Overview
Language server for Package.swift files that provides:
- 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 - In .target(...) function: - name: argument with local target name suggestions from your package - In target dependencies string literals: - Product name completion that automatically expands to .product(name: "ProductName", package: "PackageName") format - Local target name completion for referencing targets within your package to .target(name: "LocalTarget") format
[!NOTE] After editing package dependencies (
.package(...)), save the file for changes to be reflected in target completions.
- Contextual hover information:
- Package details including location and state when hovering over package names - Available products in the package
Installation & Editor Integration
The easiest way to get started is through editor extensions:
- Zed: Install the Package.swift LSP extension from the Zed extension marketplace
- Visual Studio Code: Install the Package.swift LSP extension from the VSCode marketplace
- Neovim: Install the Package.swift LSP plugin using your preferred plugin manager
Support for additional editors is planned. If you'd like to see support for your preferred editor, please submit a feature request or consider contributing!
The LSP server binary can also be downloaded directly from the GitHub releases page.
Acknowledgements
Thanks to the people and projects that helped make this LSP possible:
- @mattmassicotte for ChimeHQ/LanguageServerProtocol - a solid foundation for this project
- Swift Package Index - for providing great package data for our URL completions
Contributing
- Feel free to submit feature requests if you have ideas for improving Package.swift editing experience
- For substantial contributions (beyond small fixes), please open a discussion first to align on direction and implementation approach
License
Server is available under the MIT license. See the LICENSE file for more info.
Package Metadata
Repository: kattouf/package-swift-lsp
Default branch: main
README: README.md