Skip to content

Navigation in generated .swiftinterface files #1155

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

Closed
akaralar opened this issue Mar 30, 2024 · 2 comments · Fixed by #1887
Closed

Navigation in generated .swiftinterface files #1155

akaralar opened this issue Mar 30, 2024 · 2 comments · Fixed by #1887

Comments

@akaralar
Copy link

akaralar commented Mar 30, 2024

Is there a way to make the LSP work with .swiftinterface files? For instance when I go to definition of a SwiftUI symbol in my project, say Text, I am directed to a generated SwiftUI.swiftinterface file located in a predefined path which can be seen by running

xcrun --toolchain swift sourcekit-lsp --help

Later in this SwiftUI.swiftinterface file, if I try to go to definition of a symbol in another Swift module, say String, it doesn't navigate there and my editor (Neovim) falls back to finding occurrences in the current file. Also I don't see the LSP attached and LSP says it's running in "single file mode" when I'm in this .swiftinterface file.

If I go back to my project files and try to navigate to String from one of the project files, it navigates me to a Swift.String.swiftinterface file in that same folder for generated interfaces. So I'm guessing there should be a way to send an LSP request for generating an interface even when the originating file is in that generated interfaces folder but I'm not sure how or whether LSP can be configured to do so.

@ahoppen
Copy link
Member

ahoppen commented Mar 30, 2024

Tracked in Apple’s issue tracker as rdar://125663597

@akaralar
Copy link
Author

akaralar commented Apr 1, 2024

Just a small update, I managed to get LSP to attach when browsing the .swiftinterface file, but it attaches in "single file mode". Whether "single file mode" is something supported by sourcekit-lsp itself is not clear to me, it might as well be a feature of the editor. LSP does not attach when "single file mode" is disabled, my editor seems to think a .swiftinterface file is not part of a project.

Attaching LSP in single file mode does not make a difference in practice, LSP navigation still does not work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants