Nvim-lspconfig: Code action doesn't work anymore JDTLS

Created on 9 Nov 2020  路  3Comments  路  Source: neovim/nvim-lspconfig

  • nvim --version: NVIM v0.5.0-812-gd17e50879
  • nvim-lsp version(commit hash): 60133c47e0fd825
  • :checkhealth result


health#nvim_lsp#check

Checking language server protocol configuration

  • INFO: jdtls: configuration checked.

health#nvim#check

Configuration

  • OK: no issues found

Performance

  • OK: Build type: RelWithDebInfo

Remote Plugins

  • OK: Up to date

terminal

  • INFO: key_backspace (kbs) terminfo entry: key_backspace=\177
  • INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  • INFO: $VTE_VERSION='5202'
  • INFO: $COLORTERM='truecolor'


  • What language server(If the problem is related to a specific language server): jdtls
  • Operating system/version: Ubuntu 18.04.5 LTS
  • Terminal name/version: gnome-terminal
  • $TERM: xterm-256color

How to reproduce the problem from neovim startup

init.vim

set runtimepath^=~/.local/share/nvim/plugged/nvim-lspconfig

lua << EOF
    local nvim_lsp = require 'nvim_lsp'
    local root_pattern = nvim_lsp.util.root_pattern

    nvim_lsp.jdtls.setup{
        root_dir = root_pattern(".git", "pom.xml"),
    }
EOF

Main.java

public class Main {

    public static void main(String[] args) {
        ArrayList list = new ArrayList<>(); // ArrayList cannot be resolved to a type
    }

}
  1. Open file with nvim -u init.vim Main.java.

  2. Place cursor on the first occurrence of ArrayList and use command :lua vim.lsp.buf.code_action().

  3. Prompt with imports appears, select entry Import 'ArrayList' (java.util).

Actual behaviour

Import is not done.

Expected behaviour

Import is added on the top of the file.

Here's the log: lsp.log

This used to work before, I believe this happened when I updated neovim nightly.

Edit : Any action doesn't work actually.

bug

Most helpful comment

I had same problem and this two lines of code change fixed my problem.
https://github.com/neovim/nvim-lspconfig/pull/429/files

All 3 comments

I had same problem and this two lines of code change fixed my problem.
https://github.com/neovim/nvim-lspconfig/pull/429/files

Holy crap I ran into this just a day after you solved it. This solves it for me too!

Now that this has been resolved in https://github.com/neovim/nvim-lspconfig/pull/429#pullrequestreview-548216548, this ticket could be closed, right? @h-michael

Was this page helpful?
0 / 5 - 0 ratings

Related issues

justinmk picture justinmk  路  7Comments

nomasprime picture nomasprime  路  5Comments

ahmedelgabri picture ahmedelgabri  路  4Comments

matklad picture matklad  路  5Comments

cideM picture cideM  路  6Comments