java-language-server icon indicating copy to clipboard operation
java-language-server copied to clipboard

.vscode/settings.json not work with VIM8

Open vuvk opened this issue 3 years ago • 5 comments

Hello. I use Ant in my project. I put my dependencies jar-libraries to .vscode/settings.json (#54), but lsclient doesn't t see them ("error| package com.badlogic.gdx does not exist [compiler.err.doesnt.exist]" and etc)

My settings.json:

{ "java.classPath": [ "libs/gdx-1.9.14.jar", "libs/gdx-backend-lwjgl-1.9.14.jar", "libs/gdx-backend-lwjgl3-1.9.14.jar", "libs/gdx-freetype-1.9.14.jar", "libs/gdx-freetype-platform-1.9.14-natives-desktop.jar", "libs/gdx-freetype-platform-1.9.14.jar", "libs/gdx-jnigen-loader-2.0.1.jar", "libs/gdx-openal-0.9.9.jar", "libs/gdx-platform-1.9.14-natives-desktop.jar", "libs/gdx-platform-1.9.14.jar", "libs/jinput.jar", "libs/jlayer-1.0.1-gdx.jar", "libs/lib/jlayer-1.0.1.4.jar", "libs/lib/jorbis-0.0.17.4.jar", "libs/lib/mp3spi-1.9.5.4.jar", "libs/lib/tritonus-share-0.3.7-2.jar", "libs/lib/vorbisspi-1.0.3.3.jar", "libs/lwjgl-2.9.3.jar", "libs/lwjgl-natives-linux-2.9.3.jar", "libs/lwjgl-natives-macosx-2.9.3.jar", "libs/lwjgl-natives-windows-2.9.3.jar", "libs/lwjgl-util-2.9.3.jar", "libs/RetardSoundSystem-0.5.jar", "libs/json-simple-1.1.1.jar",

    "libs/gdx-1.9.14-javadoc.jar",
    "libs/gdx-backend-lwjgl-1.9.14-javadoc.jar",
    "libs/gdx-backend-lwjgl3-1.9.14-javadoc.jar",
    "libs/gdx-freetype-1.9.14-javadoc.jar",
    "libs/gdx-jnigen-loader-2.0.1-javadoc.jar",
    "libs/gdx-openal-0.9.9-javadoc.jar",
    "libs/lwjgl-2.9.3-javadoc.jar",
    "libs/json-simple-1.1.1-javadoc.jar",

    "libs/sources/gdx-1.9.13-sources.jar",
    "libs/sources/gdx-backend-lwjgl-1.9.13-sources.jar",
    "libs/sources/gdx-controllers-1.9.13-sources.jar",
    "libs/sources/gdx-controllers-desktop-1.9.13-sources.jar",
    "libs/sources/jlayer-1.0.1-gdx-sources.jar",
    "libs/json-simple-1.1.1-sources.jar",
]

}

vuvk avatar Mar 11 '21 05:03 vuvk

Are you using vscode?

georgewfraser avatar Apr 09 '21 22:04 georgewfraser

@georgewfraser no. I'm using VIM 8

vuvk avatar Apr 11 '21 12:04 vuvk

I'm having the same issue, trying to get this working with VIM. I've created a file ~/.config/Code/User/settings.json with a jar file specified in java.classPath, but it doesn't pick it up. I've also tried creating a .vscode/settings.json file in the folder with my Java source, but didn't work either. Classpath shows as empty when the server starts up.


[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: 09:22:27.641^IINFO^ILSP$1MessageReader run^IPlacing incoming messages on queue...
[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: 09:22:27.641^IINFO^ILSP connect^IReading messages from queue...
[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: 09:22:27.956^IINFO^IJavaLanguageServer lint^ILint 1 files...
[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: 09:22:27.971^IINFO^IScanClassPath jdkTopLevelClasses^ISearching for top-level classes in the JDK
[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: 09:22:28.188^IINFO^IScanClassPath jdkTopLevelClasses^IFound 5788 classes in the java platform
[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: Class path:
[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: Doc path:
[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: 09:22:28.250^IWARNING^IDocs findSrcZip^ICouldn't find src.zip in
[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: 09:22:28.251^IINFO^IScanClassPath classPathTopLevelClasses^ISearching for top-level classes in 0 classpath locations
[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: 09:22:28.258^IINFO^IScanClassPath classPathTopLevelClasses^IFound 0 classes in classpath
[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: 09:22:28.263^IWARNING^IReusableCompiler getTask^IOptions changed from [-classpath, , --add-modules, ALL-MODULE-PATH, -proc:none, -g, -Xlint:cast, -Xlint:deprecation, -Xlint:empty, -Xlint:fallthrough, -Xlint:finally, -Xlint:path, -Xlint:unchecked, -Xlint:varargs, -Xlint:static]
[lsc:Error] StdErr from /home/cladavid/java-language-server/dist/lang_server_linux.sh: 09:22:29.969^IINFO^IJavaLanguageServer lint^I...published in 2012 ms

PherricOxide avatar Jun 22 '21 09:06 PherricOxide

Same issue in Neovim using the native LSP client.

byrongibby avatar Jul 28 '21 20:07 byrongibby

.vscode/settings is a file that is read by VSCode, which it then passes to the server, the server does not read .vscode/settings directly (from my understanding). You need to configure the language server's settings from whatever client you're using, so in my case with nvim-lspconfig, I use the following configuration to add externalDependencies:

nvim_lsp.java_language_server.setup {
  cmd = { ".../lang_server_linux.sh" },
  on_attach = on_attach,
  settings = {
    java = {
      externalDependencies = { "com.sun.net.httpserver:http:20070405" }
    }
  },
  flags = {
    debounce_text_changes = 150,
  }
}

mtoohey31 avatar Oct 18 '21 18:10 mtoohey31