-
Notifications
You must be signed in to change notification settings - Fork 278
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
Sourcekit-lsp go-to-def not working for modules built from diff toolchain version #1626
Comments
Synced to Apple’s issue tracker as rdar://133965202 |
Is this a SwiftPM project, a project with compile_commands.json or a build server? Did you build your project when you’re seeing this issue? SourceKit bundled with Swift 5.9 doesn’t support background indexing and we need a build to update the index.
Are they just built with different SDKs or also different toolchains / Swift compilers? |
build server
Yes, I am able to build it. What's weird is that for the module where the go-to-defs don't work, clicking on the
Different SDK Versions as far as I am aware. They all use the same build server. Thanks for looking into |
I assume that we are missing index data, which causes cross-module jump-to-definition not to work. Jumping to definition on the import itself uses a slightly different code path because we don’t need to figure out in which module a type was defined. Could you ensure that you:
|
Hey thanks for your response
I'm not sure if I understand this correctly. Should I be overriding it to my current projects path? |
It’s hard to tell without knowing what your build server does. Do you have an example of build settings that are provided by your build server? |
For the build setting, are you referring to the project, or the sourcekit-lsp? Just as a general info: We use the buck build system The It does not have an The other modules (aka the imports / project) are built using buck (which underlying I believe uses swift compiler, uses the apple_library macro) The reason why I was under the impression that the index store is included is because I have
With that being said, I examined both directories and they both had their respective
|
I am referring to your project’s build settings.
You need to pass a |
I will look into being able to do that and report back when I can. That does bring me another question however. Clicking on a symbol from Are there any guesses as to why symbols from |
I haven’t fully understood that part yet. It is a little hard to reason about without a reproducing example project. But I’m pretty sure that the lack of index data is the root cause here. |
Looks like buck model and index store is very incompatible and they are currently working on coming up with a solution for it, so I guess at the time being the cross-module jump functionality is kind of thrown out the window. I do apologize that I'm unable to just provide everything (e.g. reproducible example project) so that you can also easily see whats going on. I'd still like to discover why the go-to-def works for some symbols but not others to at least direct uesrs to |
To figure out why it works in one module but not the other, I would use SourceKit-LSP from a Swift 6.0 toolchain (because it has way more logging than 5.10), enable extended logging and check if there’s anything interesting in the log, as shown here. If that doesn’t show anything, I would try building a debug version of SourceKit-LSP and debugging it, especially the |
Swift version
swift 5
Platform
Linux 5.19
Editor
Visual studio with swift-tools-version 5.9
Does the issue reproduce with Swift 6?
I didn’t try
Description
Creating this issue as I was asked here
Hello, this is using VSCode + sourcekit-lsp
I have a swift library that is built using toolchain sdk version of 13.4.
In this code, I have import modules, import A and import B
The code builds, and I am also able to find the go-to-defs for items in A. However, I am unable to find anything for items in B when using go-to-defs. I've took a look at the LSP logging, and can verify that both output directory of the lib modules are included in the key.compilerargs with the -XCC flag
B uses sdk version of 15.2, A uses version 13.0
Is there something with the sdk versions that causes sourcekit-lsp to be able to not link the symbols correctly? Is this a known issue? Or am I totally on the wrong track here and the issue is elsewhere?
Thanks in advance.
Steps to Reproduce
Unfortunately I don't really have a simple way to reproduce this, as I can't share this project.
Logging
Unfortunately contains internal information, but if you'd like specific information I can do my best to send it
The text was updated successfully, but these errors were encountered: