Error in java projects (jdtls.nvim)
SebasF1349 opened this issue · comments
Description
I've been using the plugin for months and it worked great for lua and js/ts, but now I have started working on Java and this error keeps poping the first time I open a Java project:
Error detected while processing LspAttach Autocommands for "*":
Error executing lua callback: vim/shared.lua:0: t: expected table, got nil
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
vim/shared.lua: in function 'tbl_contains'
...pace-diagnostics.nvim/lua/workspace-diagnostics/init.lua:113: in function 'populate_workspace_diagnostics'
/home/sebas/.config/nvim/lua/plugins/lsp-config.lua:290: in function </home/sebas/.config/nvim/lua/plugins/lsp-config.lua:251>
[C]: in function 'nvim_exec_autocmds'
/usr/share/nvim/runtime/lua/vim/lsp/client.lua:946: in function '_on_attach'
/usr/share/nvim/runtime/lua/vim/lsp/client.lua:615: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
I'm using nvim-jdtls for the lsp stuff. I can of course disable the plugin for Java, as workspace diagnostics work by default, but I guess it would be better if it wasn't needed. Or it's expected by the user to select on which lsp to load the plugin?
Steps to reproduce
- Create any Maven or Gradle project. No need to add code.
- Open a java file in the project
- Error (only the first time in the first file I open)
Expected behavior
Not having an error and just don't do anything, as it is not needed in this case.
Environment
- Neovim version: Nightly
- workspace-diagnostics version: latest
- Plugin clash: nvim-jdtls?
This code assumes that lsp client.config.filetypes
exists, but that's evidently not the case with jdtls. Could you run :lua= vim.lsp.get_active_client()
, and paste here the output that corresponds to the client named jdtls
?
You are right, it doesn't set a filetype as it's executed on filetype event so no needed (filetypes = { 'java' },
on lazy). I have to go now, but can try to post the client data later. Right now it's too large for a message and it gets cut off.