Skip to content
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

Edit "java_language_server" description in CONFIG.md #996

Closed
drybalka opened this issue Jun 25, 2021 · 1 comment
Closed

Edit "java_language_server" description in CONFIG.md #996

drybalka opened this issue Jun 25, 2021 · 1 comment

Comments

@drybalka
Copy link
Contributor

drybalka commented Jun 25, 2021

First of all, I am quite new to lspconfig. I was trying to start a java_language_server similarly to pyright, so I went to CONFIG.md and there it says (very similarly to pyright):
Snippet to enable the language server:

require'lspconfig'.java_language_server.setup{}

Well, when I put this string as-is into my init.lua nothing works. Moreover, this even breaks :LspInfo command with a very cryptic error message "E5108: Error executing lua Vim:E928: String required". Now of course after a bit of self-reflection I found that I have to specify cmd pointing to jls, which is apparently the missing string. I propose to implement one or more of the following 3 fixes:

  1. Change the snippet example in CONFIG.md to
require'lspconfig'.java_language_server.setup {
  cmd = { "path/to/your/lang_server_linux.sh"}
}

or to something that would work automatically with a package-installed language server:

require'lspconfig'.java_language_server.setup {
  cmd = {"java-language-server"}
}
  1. Change the error message from LspInfo (and wherever else) from the cryptic E5108 to something more concrete, like "set cmd variable in java_language_server.setup{}" or "cmd variable for java_language_server not defined".
  2. A bit more controversially one can change the default value of cmd from {} to { "path/to/your/lang_server_linux.sh"} or to {"java-language-server"}. At least this way you can get a more adequate error from :LspInfo.
@mjlbach
Copy link
Contributor

mjlbach commented Jun 29, 2021

These are all community contributed, if you'd like to change the java_language_server documentation, you can make a pull request. FWIW, the jdtls documentation makes this more clear, so you can use that as a template.

@mjlbach mjlbach closed this as completed Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants