2

I am having some issues getting the groovy-language-server to work correctly in neovim.

When I open a .groovy file into a new buffer, I can see a message indicating that the LSP client failed to start: Client 1 quit with exit code 1 and signal 0

Ok cool, so I go to check the logs using :LspLog and I can see this error: Error: Unable to access jarfile groovy-language-server-all.jar. (Also, if anyone has any tips on how to clear out LSP logs or only get the tail of the log file, that would be handy, my system gets very laggy opening these logs as it is at least 300,000 lines long). The error message is:

[ERROR][2024-02-23 18:24:57] .../vim/lsp/rpc.lua:734    "rpc"   "/Users/wmoorby/.sdkman/candidates/java/current/bin/java"   "stderr"    "Error: Unable to access jarfile groovy-language-server-all.jar\n"

I thought I might be getting this error because I am managing my java version with SDKMan, so I played around and installed a few different versions of java from different vendors, but always got the same result. I don't believe it's because of this.

Next I went to find where Mason stores all it's installed packages. I noticed that you can set the directory for this in the Mason configuration with install_root_dir = path.concat { vim.fn.stdpath "data", "mason" } and so to find this location, I executed :!echo $PATH inside neovim. I found the location in the PATH was /Users/wmoorby/.local/share/nvim/mason/bin. I navigated to this directory and poked around a bit to find the groovy LSP package. With the help of the README on the groovy-language-server Github page, I found that the .jar artefacts are located in groovy-language-server/build/libs and I attempted to run the artefact that is stated in the :LspLog with java -jar groovy-language-server-all.jar and I think it works? I execute the command, I don't get any errors and then, my terminal just stays put, which I think means that the server is running within this terminal process and it is waiting for a client to attach itself.

But then, I still don't know why it is unable to be executed within neovim. I checked the permissions on the file and noticed it wasn't executable, but it's java that executes, not the artefact itself. I also checked the shell script wrapper that is used to run java -jar groovy-language-server-all.jar and that works too (I think this shell script is what is run when the LSP is started inside neovim) groovy-language-server shell script wrapper

4
  • 2
    The error message shows a line-break-char at the end. Alos: Please do not upload images of code/errors when asking a question.
    – cfrick
    Commented Feb 23 at 19:46
  • Ah ok, I'll make sure to remember to post things as codeblocks in the future. Do you mean the new line character (\n)? Why would that mean anything?
    – Mo0rBy
    Commented Feb 23 at 21:25
  • Could mean nothing, but it strikes me as odd, that it's part of the error message, which could mean, that it's actually part of the call and therefor the file can not be found.
    – cfrick
    Commented Feb 24 at 9:03
  • 1
    Getting the same error as well. LspLog reports that it cannot find the jarfile. @Mo0rBy The lspconfig logs are located at ~/.local/state/nvim/lsp.log Commented Feb 24 at 18:42

1 Answer 1

0

reference to server_configurations.md

so you need to setup lspconfig like:

require'lspconfig'.groovyls.setup{
    cmd = { "groovy-language-server" },
    ...
}
New contributor
Marskey is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.