-
Notifications
You must be signed in to change notification settings - Fork 307
Symbol completion for Package.swift from SwiftPM project in a subfolder doesn't work #1210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Synced to Apple’s issue tracker as rdar://127351614 |
I'm not sure if this is related, but in one of my projects, I keep getting a "No such module" error from SourceKit in a regular file, not Package.Swift. One of the Code Helper processes also spins up to 100% CPU. This is using a 6.0 snapshot. With 5.9, everything is fine. |
Could you file a separate issue for this? It seems like a different issue to me. Some initial thoughts: Did you build your project with the Swift 6.0 snapshot as well? If you build your project using a different toolchain than the one that contains your sourcekit-lsp, SourceKit isn’t able to read your Swift modules, which might cause the issue. |
…ildSystem` has build settings for Previously, `SwiftPMBuildSystem` would report `.unhandled` as the file handling capability for `Package.swift`. In single workspace-folder setups, this was not an issue because we would always default to using the build system of the first/only workspace folder, which was the only `SwiftPMBuildSystem` and then returned compiler arguments despite saying that it couldn’t handle `Package.swift`. This, however, breaks if you have a setup with multi workspace folders, where we can’t rely on the first workspace folder being able to provide build settings for the package manifest. To fix this, report `.handled` file handling capability for all files that `SwiftPMBuildSystem` can compute build settings for. Fixes swiftlang#1210 rdar://127351614
In a project with multiple folders each containing a Package.swift, the `bestWorkspace` found in `workspaceForDocument(uri:)` was always the first one encountered. `fileHandlingCapability(for:)` checks if there are configured targets for the Package.swift and if there are, the workspace is chosen since the Package.swift is determined to be part of the workspace. However the check in `configuredTargets(for:)` always returned a target for any `Package.swift`, even if that `Package.swift` was not part of the workspace associated with the BuildSystem. Ultimately this manifested as code completion not working in all but one of the Package.swift files in a multi workspace project. Some work was done in swiftlang#1210 to address swiftlang/vscode-swift#768, which is where this issue originated from. However while verifying swiftlang/vscode-swift#768 I found that swiftlang#1210 didn't fully address code completion of `Package.swift` files in multi workspace projects.
In a project with multiple folders each containing a Package.swift, the `bestWorkspace` found in `workspaceForDocument(uri:)` was always the first one encountered. `fileHandlingCapability(for:)` checks if there are configured targets for the Package.swift and if there are, the workspace is chosen since the Package.swift is determined to be part of the workspace. However the check in `configuredTargets(for:)` always returned a target for any `Package.swift`, even if that `Package.swift` was not part of the workspace associated with the BuildSystem. Ultimately this manifested as code completion not working in all but one of the Package.swift files in a multi workspace project. Some work was done in swiftlang#1210 to address swiftlang/vscode-swift#768, which is where this issue originated from. However while verifying swiftlang/vscode-swift#768 I found that swiftlang#1210 didn't fully address code completion of `Package.swift` files in multi workspace projects.
In a project with multiple folders each containing a Package.swift, the `bestWorkspace` found in `workspaceForDocument(uri:)` was always the first one encountered. `fileHandlingCapability(for:)` checks if there are configured targets for the Package.swift and if there are, the workspace is chosen since the Package.swift is determined to be part of the workspace. However the check in `configuredTargets(for:)` always returned a target for any `Package.swift`, even if that `Package.swift` was not part of the workspace associated with the BuildSystem. Ultimately this manifested as code completion not working in all but one of the Package.swift files in a multi workspace project. Some work was done in swiftlang#1210 to address swiftlang/vscode-swift#768, which is where this issue originated from. However while verifying swiftlang/vscode-swift#768 I found that swiftlang#1210 didn't fully address code completion of `Package.swift` files in multi workspace projects.
In a project with multiple folders each containing a Package.swift, the `bestWorkspace` found in `workspaceForDocument(uri:)` was always the first one encountered. `fileHandlingCapability(for:)` checks if there are configured targets for the Package.swift and if there are, the workspace is chosen since the Package.swift is determined to be part of the workspace. However the check in `configuredTargets(for:)` always returned a target for any `Package.swift`, even if that `Package.swift` was not part of the workspace associated with the BuildSystem. Ultimately this manifested as code completion not working in all but one of the Package.swift files in a multi workspace project. Some work was done in swiftlang#1210 to address swiftlang/vscode-swift#768, which is where this issue originated from. However while verifying swiftlang/vscode-swift#768 I found that swiftlang#1210 didn't fully address code completion of `Package.swift` files in multi workspace projects.
In a project with multiple folders each containing a Package.swift, the `bestWorkspace` found in `workspaceForDocument(uri:)` was always the first one encountered. `fileHandlingCapability(for:)` checks if there are configured targets for the Package.swift and if there are, the workspace is chosen since the Package.swift is determined to be part of the workspace. However the check in `configuredTargets(for:)` always returned a target for any `Package.swift`, even if that `Package.swift` was not part of the workspace associated with the BuildSystem. Ultimately this manifested as code completion not working in all but one of the Package.swift files in a multi workspace project. Some work was done in swiftlang#1210 to address swiftlang/vscode-swift#768, which is where this issue originated from. However while verifying swiftlang/vscode-swift#768 I found that swiftlang#1210 didn't fully address code completion of `Package.swift` files in multi workspace projects.
Uh oh!
There was an error while loading. Please reload this page.
If you have a SwiftPM project in a subfolder of a VSCode workspace, SourceKit-LSP does not provide symbol completion, hover documentation for the Package.swift file even though a
workspace/didChangeWorkspaceFolders
request that adds the subfolder has been sent.See swiftlang/vscode-swift#768
The text was updated successfully, but these errors were encountered: