Closed DasOhmoff closed 2 years ago
Hello! Mason is not involved in starting servers, since you use lspconfig it's lspconfig that is responsible. I believe this is not an issue with Mason so I'll go ahead and close this. I'd recommend checking :LspLog
if you haven't already - if you find something more that indicates this is indeed something with Mason let's reopen!
It's not an issue of Mason. I think you need to configure the jdtls correctly with your lspconfig. The default configuration of jdtls in lspconfig is not suitable for us, we need to modify it.
See this for help
Mine is:
local home = vim.fn.getenv("HOME")
return {
cmd = {
"java",
"-Declipse.application=org.eclipse.jdt.ls.core.id1",
"-Dosgi.bundles.defaultStartLevel=4",
"-Declipse.product=org.eclipse.jdt.ls.core.product",
"-Dlog.protocol=true",
"-Dlog.level=ALL",
"-Xms1g",
"--add-modules=ALL-SYSTEM",
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang=ALL-UNNAMED",
"-jar",
home .. "/.local/share/nvim/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar",
"-configuration",
home .. "/.local/share/nvim/mason/packages/jdtls/config_linux",
"-data",
home .. "/.local/share/nvim/mason/packages/jdtls/workspace",
},
root_dir = function(fname)
return require("lspconfig").util.root_pattern("pom.xml", "gradle.build", ".git")(fname) or vim.fn.getcwd()
end,
}
And here is the capture:
@boningggg Thanks! That was exactly the issue.
I did not know that it needs to be configured, there was nothing in the mason doc or installation or so that told me that I need to configure something, I think it would be nice if its mentioned somewhere. Especially as someone who just started using nvims lsp, there is so much stuff that has to be read and learned and so much time that has to be invested, the learning curve is very high.
I believe this to be an issue that should be addressed by maintainers of mason.nvim.
Why do you think this is an issue with mason.nvim?
After installing the language server via Mason, I think the LSP is supposed to automatically start when entering java files, which it does not do.
Neovim version (>= 0.7)
NVIM v0.7.2 Build type: RelWithDebInfo LuaJIT 2.1.0-beta3
Operating system/version
Windows 10, 64 bit
I've manually reviewed logs to find potential errors
I've recently downloaded the latest plugin version of mason.nvim
Affected packages
jdtls
Problem description
After installing jdtls via mason, jdtls cannot find the projects root directory. Language server does not start. Here is the error:
Steps to reproduce
Plug 'williamboman/mason.nvim' Plug 'williamboman/mason-lspconfig.nvim' Plug 'neovim/nvim-lspconfig'
call plug#end()
MasonInstall jdtls
settings.gradle
or soLspInfo
command to see that the root directory of the project was not foundActual behavior
After installing jdtls via mason, jdtls cannot find the projects root directory. Language server does not start.
Expected behavior
After installing jdtls via mason, jdtls should be able to find the projects root directory. Language server should start.
Healthcheck