Closed marcelbeumer closed 2 years ago
@marcelbeumer I have the same problem and am now taking a look at the sources.
I reckon the problem is that denols only accepts URIs whose form is in deno:/~
or deno:asset/
(in case of builtin libraries) but neovim builtin lsp only sends URIs in the form of deno://~
.
nvim-lspconfig addresses this difference by defining util functions to convert URIs of deno style and neovim style back and forth before and after each request, but when calling the neovim lsp function(vim.lsp.buf.definition) directly, it sends deno://~
and therefore denols doesn't know where the code is, so responds back the error you mentioned above.
Calling :DenolsDefinition
works in my environment, so I guees it should be fine if you bind the key(gd
) to call :DenolsDefinition
when using denols (seems a bit ugly though)
I am not really familiar with the internal workings of neovim and nvim-lspconfig, so still figuring out the way to fix this.
Maybe I will issue a PR.
Just FYI 👍
I think it might be the case that we need to split the deno config out into it's own plugin, and override the definition handlers to use the appropriate URIs. I don't want to add explicit handling of deno URIs to the neovim core handlers.
You can test #1638
Description
See detailed reproduction steps below. When navigation into a remote module with
lua vim.lsp.buf.definition()
nvim starts showing errors with shape of:An unexpected identifier (deno://<url of remote modue>)
.Neovim version
NVIM v0.6.0-dev+470-ga1e8199ff Build type: Release LuaJIT 2.1.0-beta3
Nvim-lspconfig version
7f902f9
Operating system and version
macOS 11.6
Affected language servers
denols
Steps to reproduce
git clone https://github.com/marcelbeumer/deno-oak-test
cd deno-oak-test
deno cache server.ts
nvim -nu minimal.lua
:e server.ts
2ggw
(to go toApplication
)gd
(tolua vim.lsp.buf.definition()
)<C-K>
(tolua vim.lsp.buf.signature_help()
on the wordApplication
)Error now shows:
denols: -32602: An unexpected specifier (deno://https/deno.land/x/oak%40v9.0.1/applicati on.ts) was provided
. See screenshotActual behavior
Error when doing code navigaiton inside external module
Expected behavior
Code navigaiton inside external module works. I assume the deno language server is capable of doing it as the official vscode extension does work well on this example repo.
Minimal config
Health check
lspconfig: require("lspconfig.health").check()
LSP log
https://gist.github.com/marcelbeumer/e1d39a132d64bd870942a71c26f88726