nvimdev / lspsaga.nvim

improve neovim lsp experience
MIT License
3.44k stars 286 forks source link

Unable to jump to definition with denols #1440

Open Ttayu opened 4 months ago

Ttayu commented 4 months ago

Describe the bug

I am unable to jump to definition using :Lspsaga goto_definition() with the denols language server, although :lua vim.lsp.buf.definition() works fine for jumping to function definitions with lspconfig. This seems to be because the targetUri returned by denols is special, and the standard textDocument/definition is unable to handle it for jumping. In lspconfig, a special function is implemented specifically for denols to handle this case, as shown in this line

However, lspsaga does not have this special handling (Line) , which is likely why jumping to definition does not work with denols. I would appreciate if this could be looked into and support for the denols targetUri format could be added to lspsaga for seamless definition jumping.

Steps to reproduce

  1. Install denols.
  2. open deno file (e.g. deps.ts) .
  3. :Lspsaga goto_definition()
  4. :lua vim.lsp.buf_definition()

Expected behavior

it should be able to jump to the definition as well as :lua vim.lsp.buf.definition(). It should also be possible to jump to another method such as peek_definition in the same way.

Neovim version (nvim -v)

v0.10.0-dev-2698+g00e71d3da

lspsaga commit

20123469a65b7b8e5a83e9fbd24c5dc7219eaf63

Terminal name/version

wezterm 20240203-110809-5046fc22