mfussenegger / nvim-jdtls

Extensions for the built-in LSP support in Neovim for eclipse.jdt.ls
GNU General Public License v3.0
1.05k stars 61 forks source link

Recent builds of eclipse.jdt.ls, code actions and server_capabilities.codeActionProvider.resolveProvider true #503

Closed lbrayner closed 1 year ago

lbrayner commented 1 year ago

Problem Statement

Most code actions won't work if using a recent build of eclipse.jdt.ls (Neovim 0.9.0+).

This is because there are no edit or command properties in the actions returned by the server. To get them, you have to call "codeAction/resolve".

Ideas or possible solutions

I think it would be useful to include in the README that one needs to set server_capabilities.codeActionProvider.resolveProvider to true if using a recent build of eclipse.jdt.ls (and Neovim 0.9.0+).

In your LspAttach callback or your configuration's on_attach callback:

client.server_capabilities.codeActionProvider = { resolveProvider = true }
mfussenegger commented 1 year ago

It's not necessary to set the codeActionProviders on the server_capabilities.

In fact you should never have to mess with the server_capabilities unless you know what you're doing and want to opt out of something.

There was a regression in regards to code-action resolving in neovim master but that was fixed a day or two later.

lbrayner commented 1 year ago

@mfussenegger got it. Yes, https://github.com/neovim/neovim/commit/dd3fa645735539c75b72dc1b0114278b5fa57f7f fixes the issue I was having, no need to mess with server_capabilities.