Closed maximstewart closed 2 weeks ago
There's a few things to address here :
java.classPath
, java.docPath
, java.silentNotification
but these aren't provided by JDT-LS at all. java.silentNofication
does exist but it's a setting meant for vscode-java-debug from what I can see, so doesn't seem like it'd to anything. Is there something in your client that knows to handle these, or some other language server that you're sending these to ? See https://github.com/eclipse-jdtls/eclipse.jdt.ls/wiki/Language-Server-Settings-&-Capabilities#settings for the set of known settings supported by the language server. The rest of your settings look fine though..classpath
at all. It's not meant to be modified. Do you have a sample of your thumbnail-api project that can be shared ? You mentioned pom files, so I'm assuming this is a Maven project. If that's the case you should not need to touch the .classpath
or attempt to set any dependencies. The language server has support for most Maven/Gradle/Eclipse projects, which means it should automatically detect dependencies and set up the classpath. The reason for java.project.referencedLibraries
, java.project.sourcePaths
, java.project.outputPath
is for when you have a project with no metadata (no pom.xml
, no build.gradle
, no Eclipse .project
/.classpath
). Just a set of folders and java source files. In that case we need users to define where the dependencies are stored (eg. default is lib/**/*.jar
).{ "extendedClientCapabilities": { "classFileContentsSupport": true } }
. See https://github.com/eclipse-jdtls/eclipse.jdt.ls/issues/3166#issuecomment-2160963153 as an example.-data
argument is not meant to point to your project, but rather just some location where some of the project metadata can be stored. For convenience, we also have a script, https://github.com/eclipse-jdtls/eclipse.jdt.ls/tree/master/org.eclipse.jdt.ls.product/scripts/jdtls which gets placed at ./org.eclipse.jdt.ls.product/target/repository/bin/jdtls
.I can confirm that this should work though. See https://rgrunber.github.io/vscode/java/lsp/language/server/2023/09/18/talk-to-language-server.html for more details on how I communicate with the language server in this very basic manner.
(formatted for legibility)
Content-Length: 244
{
"jsonrpc": "2.0",
"id": 2,
"method": "textDocument/definition",
"params": {
"textDocument": {
"uri": "file:///home/rgrunber/git/lemminx/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/XMLLanguageServer.java"
},
"position": {
"line": 177,
"character": 5
}
}
}
Content-Length: 478
{
"jsonrpc": "2.0",
"id": 2,
"result": [
{
"uri": "jdt://contents/java.base/java.lang/Object.class?=org.eclipse.lemminx/%5C/usr%5C/lib%5C/jvm%5C/java-17-openjdk-17.0.12.0.7-2.fc40.x86_64%5C/lib%5C/jrt-fs.jar%60java.base=/javadoc_location=/https:%5C/%5C/docs.oracle.com%5C/en%5C/java%5C/javase%5C/17%5C/docs%5C/api%5C/=/=/maven.pomderived=/true=/%3Cjava.lang(Object.class",
"range": {
"start": {
"line": 37,
"character": 13
},
"end": {
"line": 37,
"character": 19
}
}
}
]
}
{"extendedClientCapabilities": { "classFileContentsSupport": true } }
The above worked! My goodness I could not find the needed setting to save my life.
I am unable to get results for external libraries using textDocument/definition and textDocument/implementation but CAN for my source code itself.
To simplify the attempt I copied some of the libraries to a lib folder at my project root. i.e same level as my POM file
What I have tried:
I have added to my .classpath file
I have tried editing my init-options with various setups. For example, I add absolute paths to my m2 folders for classPath and docPath but I then see errors regarding them not being found in my project. (They absolutely do exist as paths.) Current init-options are the following:
Additional (maybe relevant) details:
JDTLS Version:
Java:
I am trying to setup integration between this and my own written editor. Completion seems to work fine and returns results for things like Spring classes plus additional edits to do imports. GoTo works but only for my project files and not external/additional sources or even just the lib path created under the project holding source JARs.
I am packaging JDTLS as part of an AppImage so JDTLS_PATH is defined when that whole process runs and is extracted. I have tried sans AppImage setup with same results.
Here is how I start JDTLS. Though, note that I have played with changing the -data path to be my project root as well but that just creates a folder jdt.ls-java-project (same level as my POM) and I then get messages about my source code not being in a source directory and thus nothing resolves. _configlinux gets copied from my AppImage to the user's .config path.
When I did do -data at project level the .metadata/.log file would show messages but I think they mostly tied to the issues I saw as mentioned above. When set to .config/jdtls/data/.metadata it has nothing meaningful there.
log.txt