-
Notifications
You must be signed in to change notification settings - Fork 302
SourceKitLSP: generate Swift textual interfaces for module references #668
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
Conversation
@ahoppen do you think this will work with my suggested path to displaying symbols in VSCode. swiftlang/vscode-swift#408 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for the PR. I think the idea of generating the .swiftinterfaces
into a temporary directory is a good solution for now. @adam-fowler I have a vague memory that we discussed that LSP/VSCode has/will have a notion of generated/transient/non-disk files but I can’t find it anymore. Do you remember anything about it?
The implementation looks good to me overall, I have some comments inline. Also: Could you add a test case for jump to definition to symbols in other modules and a test case for a standalone open interface request?
Sources/LanguageServerProtocol/Requests/OpenInterfaceRequest.swift
Outdated
Show resolved
Hide resolved
Sources/LanguageServerProtocol/Requests/OpenInterfaceRequest.swift
Outdated
Show resolved
Hide resolved
That'll be in the issue I linked to swiftlang/vscode-swift#408 (comment) |
Is there any precedence from language servers that use these kinds of transient documents or an LSP proposal? I think you are the best person to judge how the contents of the interface should be transferred to the editor. The nice thing about the temporary file implementation is that it will work for all editors. |
We can go with the temporary file solution. You'll need to be careful to ensure you generate separate versions of these for different swift versions. |
That’s odd that the tests are failing for you. They are passing fine for me locally. Which Xcode version are you using and are you using a Swift Open Source Toolchain? I’m using Xcode 14.0 with the default toolchain. I think you can use Tests/SourceKitLSPTests/ImplementationTests.swift as a blueprint for your tests. I don’t think you need to check that many locations but the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the test cases. I’ve added a few questions inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. This looks good to me. Let's get this merged. I've got one final comment inline. Could you also squash your commits after you've addressed the comment to create a nicer git history?
@swift-ci Please test |
6657623
to
d2f7f2f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for implementing this and addressing all my comments 🙏
This is a great features and I’m sure may people will love it ❤️
@swift-ci Please test |
Not sure how yet, but I think this is related to a failure in swift-driver Windows CI:
|
When doing a jump to definition on a Swift import statement, generate the textual interface for the module so the IDE can load the generated interface file.