Wansmer / symbol-usage.nvim

Display references, definitions and implementations of document symbols
MIT License
255 stars 3 forks source link

Bug: No usage shown using ccls #35

Closed ef3d0c3e closed 4 days ago

ef3d0c3e commented 8 months ago

I have noticed an issue while using symbol-usage with ccls. The usage shown is always 0 (0 usages, 0 defs, 0 implementations). I first believed this issue was related to ccls not giving the correct values. However when I tried nvim's builtin codelens using vim.lsp.codelens.refresh(), it shows the correct values. 2024-01-06-09:19:39 Nvim display the correct value: '1 ref'

I think this issue is related to symbol-usage interaction with ccls, because other LSPs for other languages show the correct values. Calling :lua =vim.lsp.codelens.get() shows the correct codelens being set by nvim:

[...]
 {
    command = {
      arguments = { '{"usr":3289868854496035806,"kind":3,"field":"uses"}' },
      command = "ccls.xref",
      title = "1 ref"
    },
    range = {
      ["end"] = {
        character = 8,
        line = 19
      },
      start = {
        character = 7,
        line = 19
      }
    }
  } }

After a little bit of research, it looks like self.client.request('textDocument/' .. method, params, handler, self.bufnr) gives an empty response to handler which seems to be the cause of the problem.

Wansmer commented 8 months ago

Hello.

symbol-usage does not use the codelens method. It counts usages by references method because references is supported in many lsp clients unlike codelens.

I can't to check if the correct data is returned by ccls because on all my try to run ccls I get the error Client ccls quit with exit code 0 and signal 6.. I don't use c++ in my work and may not know the specifics of running it.

Please, create a repo with a minimal c++ project and instructions on how to run it with nvim-lspconfig settings.