Skip to content

Neovim diagnostics don't get updated sometimes #33

Open
@xiaochuanyu

Description

@xiaochuanyu

In Neovim, diagnostics are not updated after editing within a line and saving file.
Diagnostic seem to be only updated if a new line is added.
Other LSPs seem to work fine e.g. lua_ls in Neovim and VSCode also works fine.
Here is a short video showing this behavior:

outdated_diagnostic.mp4

Repro steps

  1. Setup Neovim with kotlin_lsp over TCP (see setup below)
  2. Create hello world gradle project with gradle init
  3. Open up App.kt, observe diagnostic for "Use expression body ...." at line with return "Hello World!"
  4. Delete return in that line
  5. Observe lack of diagnostics for missing return
  6. Save with :w, same result
  7. Add a new line above current
  8. Observe missing return diagnostic

No error logs printed on server side.
Debug level Logs from :LspLog in Neovim: lsp_logs_debug.log

Setup

  • I'm on Windows. I wrote a powershell version of kotlin-lsp.sh.
  • Neovim version is NVIM v0.11.1
  • nvim-lspconfig plugin is on commit b8e7957 (a recent commit)
  • Here is snippet for kotlin_lsp from my Neovim config:
       vim.lsp.config("kotlin_lsp", {
        cmd = vim.lsp.rpc.connect("127.0.0.1", 9999),
        single_file_support = true,
        filetypes = { "kotlin" },
        root_markers = {
          "settings.gradle",
          "settings.gradle.kts",
          "pom.xml",
          "build.gradle",
          "build.gradle.kts",
          "workspace.json",
        },
      })
      vim.lsp.enable("kotlin_lsp")
     
      -- Enable client side debug logging
      vim.lsp.set_log_level("debug")
      if vim.fn.has("nvim-0.5.1") == 1 then
        require("vim.lsp.log").set_format_func(vim.inspect)
      end
  • I reproduced the issue also with barebones Neovim config that has just the snippet as init.lua

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions