Skip to content
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

[SR-15633] SourceKit-LSP: New files are not registered and changes to Package.swift are not reflected #508

Closed
adam-fowler opened this issue Dec 22, 2021 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@adam-fowler
Copy link
Contributor

Previous ID SR-15633
Radar None
Original Reporter @adam-fowler
Type Bug
Status In Progress
Resolution
Environment

VSCode 1.6.3.2

swift-driver version: 1.26.21 Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)

Target: x86_64-apple-macosx12.0

Additional Detail from JIRA
Votes 1
Component/s SourceKit-LSP
Labels Bug
Assignee @ahoppen
Priority Medium

md5: 3cdf5d87457acc541fc8aa99b1919384

is duplicated by:

  • SR-15679 SourceKit-LSP: Adding platform requirement in Package.swift is not propagated

Issue Description:

When a new file is created the SourceKit-LSP server doesn't seem to register it. You get basic function completion for standard swift objects, but none of the symbols in your project are available.

This was replicated in the new vscode plugin https://github.com/swift-server/vscode-swift but can also be replicated using the sample extension code that is part of the SourceKit-LSP project.

The current version of the vscode plugin does not send `workspace/didChangeWatchedFiles` events but I have a PR which does this swift-server/vscode-swift#98 For example new file will send

[Trace - 17:10:42] Sending notification 'workspace/didChangeWatchedFiles'.
Params: {
    "changes": [
        {
            "uri": "file:///Users/adamfowler/Developer/tools/sourcekit-lsp/Sources/SKCore/test.swift",
            "type": 1
        }
    ]
}

Even with sending these events I am not seeing this working. I can see the merged PR #376 which adds support for at least parsing these events, but from what I can see it doesn't actually process the add/remove event.

@adam-fowler
Copy link
Contributor Author

Looks like this has been resolved, just needs setup correctly in vscode

@adam-fowler
Copy link
Contributor Author

Re-opening this issue as I am sending
`workspace/didChangeWatchedFiles` events to the server and it doesn't seem to make any difference.

@fabianfett
Copy link
Member

@swift-ci

@benlangmuir
Copy link
Member

Specifically, the bug is that SourceKit-LSP does not update the compiler arguments we get from SwiftPM. Similarly, when you modify a Package.swift file those changes are not reflected. This is a long-standing known issue: https://github.com/apple/sourcekit-lsp/#caveats.

@ahoppen
Copy link
Collaborator

ahoppen commented Jan 7, 2022

I just put together a rudimentary implementation of file watching in SourceKit-LSP, which reloads the entire package when a new file gets added: [#443| #443]

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@ahoppen
Copy link
Collaborator

ahoppen commented Apr 27, 2022

Implemented file watching for Package.swift in #471.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants