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
Unresolved reference for all dependencies #487
Comments
I had the same issue, and built from 3f39416, which seems to work. My guess is that there's a regression between that commit and what's on Try that if you can, and maybe that helps the maintainers with debugging :) |
No luck, but I'm not at all sure that I managed to build the right version of the language server. I am NOT used to github. I had already pulled some version of the source code from from github, so I moved to that directory and ran How do I know which version I actually built? |
Can't reproduce 🙁 There should be no breaking changes between the commits that @theothornhill mentions above. Might be something I'm overlooking. Have to take a closer look after work.
It reads the local Maven or Gradle cache, and then reads the jar files directly. Standard library has an extra mechanism that loads it from your Kotlin install if no Maven or Gradle version is found. Don't remember if there is a way to see which it has read. Probably would have to add a logging statement in one of the Classpath resolver classes. You should at least see log entries that dependencies have been fetched by Gradle (or an error message from Gradle if not). I always build my system using Maven/Gradle before starting the language server just in case. Just to make sure that all dependencies have been downloaded. As the language server reads the Maven and Gradle cache directories directly, I want to make sure that they are present. Might not be necessary, but I'm always paranoid 😛
With the infrequent releases that happens, I think commit ids are a better indicator. If you have built the specified commit it is 1.3.3 ++++. If you want to try specific versions, then checkout the tags. @MagnusMG , did using that commit solve the issue for you? Or did you get the same issue? @MagnusMG, I looked through the logs above. It doesn't seem that the language server recognises your project as a Gradle project. Is the build.grade file in your project root directory? Usually you would see a "Successfully resolved dependencies using Gradle", Gradle error messages or similar. |
Thanks for your reply, @themkat. Your observation that the language server did not recognise my project as a gradle project set me off in the right direction: I searched the output log for references to gradle and found the following error message: So JAVA_HOME was not set correctly. Silly... I fixed that and now it works. Thanks! |
That's interesting, because if I jump between the commit i mentioned and latest master I get unresolved references all over the project. I'm using a maven project, if that is interesting. |
Deleting Graddle wrapper seems to fix the issue:
I’m using Graddle provided by Nix. nix-shell configuration: { pkgs ? import (import nix/nixpkgs.github.nix) {}
}:
let
# Newer version of LSP
kotlin-language-server = pkgs.kotlin-language-server.overrideAttrs (old: rec {
version = "1.3.7"; # Latest version (default in “nixpkgs-unstable” is 1.3.5)
src = pkgs.fetchzip {
url = "https://github.com/fwcd/kotlin-language-server/releases/download/${version}/server.zip";
hash = "sha256-BEQywg3ZU4LtF9trntGbDp64SIWH4y93o/VVMSRP+cc=";
};
});
in
pkgs.mkShell {
buildInputs = [
pkgs.kotlin # Compiler/interpreter (also Java/OpenJDK as a dependency)
kotlin-language-server # LSP
pkgs.gradle
];
} And the nixpkgs pin: fetchTarball {
# # October 25, “release-23.05” branch
# url = "https://github.com/NixOS/nixpkgs/archive/883a9dfd007347f32f7f9893b709d45744435376.tar.gz";
# sha256 = "0a8qbys41q6sfjp06wh4yaikk9zxkd1z96wqw9rq8x78cy2h8lcn";
# Fresher versions from unstable
# October 25, “nixpkgs-unstable” branch
url = "https://github.com/NixOS/nixpkgs/archive/75a52265bda7fd25e06e3a67dee3f0354e73243c.tar.gz";
sha256 = "0w0dmb0jc8vz678yrh0imfngjdar3d39ab7my4hyzws2pavzdzld";
} |
I have a problem with the VSCode editor underlining all names from external dependencies in red, and not being able to give me any suggestions. My guess is that it is the language server that does not find the dependencies. (I have had problems with this before, but I have been able to resolve it.)
The output from the language server can be found here.
How do I debug this? How does the plugin/language server find dependencies? Is there a way to check which external libraries the language server has found? I'm using VSCode 1.81.1 on macos Ventura 13.5 with the Kotlin plugin (fwcd). I have kotlin 1.9.0 and JRE 20.
The text was updated successfully, but these errors were encountered: