SolaWing / xcode-build-server

a build server protocol implementation for integrate xcode with sourcekit-lsp
MIT License
283 stars 16 forks source link

Is it possible to support generated `.swiftinterface` files? #54

Open akaralar opened 1 month ago

akaralar commented 1 month ago

Would xcode-build-server be able to support browsing and navigating .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 as --generated-interfaces-path 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 see the LSP is attached and 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 that is generated in the 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 and whether this tool would be able to support this. Any thoughts?

SolaWing commented 1 month ago

I found that LSP did request flags for generated swiftinterface.. so now it became what flags the swiftinterface should use. as swiftInterface framework not belong to any target and sourcefile...

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 see the LSP is attached and it's running in "single file mode" when I'm in this .swiftinterface file.

I tested with xcode 15.3 builtin-lsp, and seems symbol jump in swiftinterface, at least is ok for stdlib symbol(except it may not jump to the accurate line when first opened)