feat(swift): add Swift Package Manager ecosystem support#74
Merged
Conversation
Implement deps-swift crate with Package.swift parsing (regex-based, 9 .package() patterns), GitHub API registry for version resolution, Package.resolved lockfile support (v1/v2/v3), and ecosystem integration.
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive Swift Package Manager (SPM) ecosystem support to the deps-lsp project. The implementation provides LSP features for Package.swift manifest files, including dependency parsing, version resolution via GitHub API, lockfile support, and intelligent code completion.
Changes:
- Adds
deps-swiftcrate with regex-based Package.swift parser supporting all 9.package()declaration patterns (from, upToNextMajor, upToNextMinor, exact, range variants, branch, revision, path) - Implements GitHub API-based registry for version resolution and package search with owner/repo validation (SEC-002)
- Supports Package.resolved lockfile parsing for all 3 schema versions (v1/v2/v3)
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/deps-swift/src/types.rs |
Core type definitions for Swift dependencies, versions, and metadata |
crates/deps-swift/src/registry.rs |
GitHub API integration with validation and version resolution |
crates/deps-swift/src/parser.rs |
Regex-based Package.swift parser with comment stripping and position tracking |
crates/deps-swift/src/lockfile.rs |
Package.resolved parser supporting v1/v2/v3 formats |
crates/deps-swift/src/formatter.rs |
Version formatting and package URL generation utilities |
crates/deps-swift/src/error.rs |
Swift-specific error types and conversions |
crates/deps-swift/src/ecosystem.rs |
Ecosystem trait implementation integrating all components |
crates/deps-swift/src/lib.rs |
Module exports and crate documentation |
crates/deps-swift/Cargo.toml |
Dependencies and package metadata |
crates/deps-lsp/src/lib.rs |
Integration of Swift ecosystem into LSP server |
crates/deps-lsp/Cargo.toml |
Swift feature flag and dependency |
Cargo.toml |
Workspace member addition |
| Test fixtures | Example Package.swift files for testing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Parse error objects from GitHub API instead of panicking on unexpected JSON structure. Rate-limited responses now produce descriptive error messages instead of cryptic serde deserialization failures.
Add get_cached_with_headers to HttpCache for passing extra headers (Authorization) to specific registries. SwiftRegistry reads GITHUB_TOKEN from environment, increasing rate limit from 60 to 5000 requests/hour.
Filter inlay hints by the range requested by the editor to fix partial hint rendering in Zed. Show actionable GITHUB_TOKEN error when GitHub API rate limit is hit without authentication.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
deps-swiftcrate with full Swift Package Manager supportPackage.swiftparser covering all 9.package()call patterns (from, upToNextMajor, upToNextMinor, exact, range, branch, revision, path)Package.resolvedlockfile support for all 3 schema versions (v1/v2/v3)Test plan
cargo +nightly fmt --checkcleancargo clippy --workspace --all-targets --all-features -- -D warningsclean