-
Notifications
You must be signed in to change notification settings - Fork 232
Go-to-definition does not work after go-to-definition on an external source #470
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
Comments
Ok, I did some digging and figured out how to add support for the With the current implementation, I create the temp file in a When I navigate to a Java source and try to go-to-def on other objects there I see the following logs:
|
The same issue is happening in VS Code as well. Go-to-definition is not working for anything really, not even standard library stuff such as |
Thanks for reporting this, I've found the issue and it seems to actually be a regression introduced with the class path cache in #337. Precisely the issue is here: kotlin-language-server/shared/src/main/kotlin/org/javacs/kt/classpath/CachedClassPathResolver.kt Line 72 in 8f96c29
Notice how we call kotlin-language-server/shared/src/main/kotlin/org/javacs/kt/classpath/CachedClassPathResolver.kt Line 24 in 8f96c29
This then in turn caused Lines 6 to 11 in 8f96c29
to return bogus results (paths containing the string kotlin-language-server/server/src/main/kotlin/org/javacs/kt/externalsources/ClassContentProvider.kt Line 38 in 8f96c29
Unfortunately, the database schema has now shipped, so we'll actually have to introduce some form of versioning to make sure user databases are rebuilt after fixing this (I've opened #503 for that, PR for the actual fix is underway...). cc @daplf |
This is btw not a regression, simply something we haven't supported yet, though it's on the wishlist. See #308 too. |
Apologies for the regression :/ Opened a PR to add database versioning: #504 Once that one is merged, I can also make a PR to fix the actual issue. |
Oh, no worries, that stuff happens. Thanks for the quick response, I'll have a look at #504! We should probably add a few more tests for definition lookups on external libraries that cover all of the common cases (JDK, JAR with source, JAR without source, ...) to make sure that we don't regress on this in the future. |
I'll preface this saying I'm using Emacs and I'm not sure if this is an issue with KLS or with lsp-mode on Emacs, or some missbehavior between the two.
The Emacs lsp-mode offers a way to configure
useKlsScheme
. It defaults to true, and it says it's recommended, but this doesn't seem to work when I try to go-to-def:The following file kls:file:///Library/Java/JavaVirtualMachines/amazon-corretto-17.jdk/Contents/Home/lib/src.zip!/java.sql/javax/sql/DataSource.java?source=true is missing, ignoring from the results.
When I turn this off, go-to-def works by making some sort of temp file of the (jar extracted) decompiled class or source in
/var
. When it opens the file, it tries to load the file as a standalone script instead of knowing it was part of the project I navigated from. This means I can't go-to-def from that file since it does not have a classpath.The text was updated successfully, but these errors were encountered: