Joseph Crawford
Joseph Crawford2mo ago

Denols Neovim

Hello Everyone, I have denols setup and we are using the imports in deno.jsonc however, I cannot seem to gd to go to a dependencies definition, any ideas why this may occur? When I try to use gd on a base controller that comes from an import I get the following error I have asked this in the neovim irc channel and received no response after several days so I thought I would ask here hoping someone would have some insight/feedback
Error executing vim.schedule lua callback: ...ar/neovim/0.10.1/share/nvim/runtime/lua/vim/lsp/util.lua:1914: index out of range
stack traceback:
[C]: in function '_str_byteindex_enc'
...ar/neovim/0.10.1/share/nvim/runtime/lua/vim/lsp/util.lua:1914: in function 'locations_to_items'
...yVim/lazy/telescope.nvim/lua/telescope/builtin/__lsp.lua:205: in function 'handler'
.../Cellar/neovim/0.10.1/share/nvim/runtime/lua/vim/lsp.lua:936: in function 'handler'
.../neovim/0.10.1/share/nvim/runtime/lua/vim/lsp/client.lua:687: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Error executing vim.schedule lua callback: ...ar/neovim/0.10.1/share/nvim/runtime/lua/vim/lsp/util.lua:1914: index out of range
stack traceback:
[C]: in function '_str_byteindex_enc'
...ar/neovim/0.10.1/share/nvim/runtime/lua/vim/lsp/util.lua:1914: in function 'locations_to_items'
...yVim/lazy/telescope.nvim/lua/telescope/builtin/__lsp.lua:205: in function 'handler'
.../Cellar/neovim/0.10.1/share/nvim/runtime/lua/vim/lsp.lua:936: in function 'handler'
.../neovim/0.10.1/share/nvim/runtime/lua/vim/lsp/client.lua:687: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
I am using neovim/nvim-lspconfig and his is my entry in my lsp configuration
denols = {
filetypes = { "typescript", "typescriptreact" },
root_dir = function(...)
return nvim_lsp.util.root_pattern("deno.jsonc", "deno.json")(...)
end,
handlers = {
["textDocument/publishDiagnostics"] = nvim_lsp.diagnostic.on_publish_diagnostics,
},
settings = {
deno = {
enable = true,
lint = true,
unstable = true,
suggest = {
imports = {
hosts = {
["https://deno.land"] = true,
},
},
},
},
},
},
denols = {
filetypes = { "typescript", "typescriptreact" },
root_dir = function(...)
return nvim_lsp.util.root_pattern("deno.jsonc", "deno.json")(...)
end,
handlers = {
["textDocument/publishDiagnostics"] = nvim_lsp.diagnostic.on_publish_diagnostics,
},
settings = {
deno = {
enable = true,
lint = true,
unstable = true,
suggest = {
imports = {
hosts = {
["https://deno.land"] = true,
},
},
},
},
},
},
13 Replies
roeland
roeland2mo ago
No idea what is wrong here, but maybe try to specify the correct deno binary?
denols = {
cmd = { '/Users/roeland/.deno/bin/deno', 'lsp' },
settings = {
deno = {
unstable = true,
},
},
},
denols = {
cmd = { '/Users/roeland/.deno/bin/deno', 'lsp' },
settings = {
deno = {
unstable = true,
},
},
},
Joseph Crawford
Joseph CrawfordOP2mo ago
@roeland Thanks for that suggestion, I have added it but I still get the same error after restarting neovim. Anyone else have any suggestions I could try?
Nicholas
Nicholas2mo ago
got similar issue
Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp/util.lua:1136: Cursor position outside buffer
stack traceback:
[C]: in function 'nvim_win_set_cursor'
/usr/share/nvim/runtime/lua/vim/lsp/util.lua:1136: in function 'jump_to_location'
...nvim/lazy/telescope.nvim/lua/telescope/builtin/__lsp.lua:187: in function 'handler'
/usr/share/nvim/runtime/lua/vim/lsp/client.lua:687: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/lsp/util.lua:1136: Cursor position outside buffer
stack traceback:
[C]: in function 'nvim_win_set_cursor'
/usr/share/nvim/runtime/lua/vim/lsp/util.lua:1136: in function 'jump_to_location'
...nvim/lazy/telescope.nvim/lua/telescope/builtin/__lsp.lua:187: in function 'handler'
/usr/share/nvim/runtime/lua/vim/lsp/client.lua:687: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Joseph Crawford
Joseph CrawfordOP2mo ago
@Nicholas I am in the same boat after I disabled the offset_encoding to utf-8, see here: https://github.com/neovim/neovim/issues/30719#issuecomment-2400538866 I am not sure if the issue is due to nvim-lspconfig or lazyvim as of yet. If you end up getting past that please let me know what you found. I am going to look into this more but my time is limited currently
Nicholas
Nicholas2mo ago
not a lazyvim issue for sure, I'm on a minimal setup using Kickstart.nvim, my lsp dosn't have overrides except checking the deno.json to not interfere with a regular 'ts_ls', global and mason deno version is 2.0
Nicholas
Nicholas2mo ago
@Joseph Crawford I saw your comment on the nvim-lsp repo, followed others guys conversation and it seems an issue with telescope... I applied the commit to the "telescope.nvim/lua/telescope/builtin/__lsp.lua" from here https://github.com/nvim-telescope/telescope.nvim/pull/2770/commits/2d9e3be46fcd6cba79928667a14fc557948d1ca0 It works now! :party_deno:
GitHub
fix(lsp): pass server resp through client handlers (1) by jamestrew...
For LSP methods/pickers: references definition typeDefinition implementation Passes the server results through client (and neovim&#39;s) lsp handler function. This lets those handlers deal wi...
Joseph Crawford
Joseph CrawfordOP2mo ago
@Nicholas wow thank you, I never would have found that @Nicholas is there a way for me to apply that commit or is this something I have to wait to be merged and released? I am not sure if I applied it if updates would overwrite and then I would be fighting lazyvim's update system etc.
Nicholas
Nicholas2mo ago
@Joseph Crawford you're right, local changes will actually prevent telescope updates...
No description
Joseph Crawford
Joseph CrawfordOP2mo ago
hmm that is what I figured... Will keep my eye on this, being a draft currently I am not sure it will make it into an update anytime soon. It seems like they will need to re-think their soluion as that PR is quite old and targeting < 0.10
mcilvena
mcilvena2mo ago
I don't know if you figured this out but I fixed/avoided it by changing my keymaps to avoid using Telescope:
--map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
map('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
--map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
map('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
Joseph Crawford
Joseph CrawfordOP4w ago
where did you put this settihng? I wasn't sure how to override lazyvim and didn't want to modify the source so I have been living without the ability
mcilvena
mcilvena4w ago
If you're using LazyVim, it should be configured this way by default: https://github.com/LazyVim/LazyVim/blob/cb40a09538dc0c417a7ffbbacdbdec90be4a792c/lua/lazyvim/plugins/lsp/keymaps.lua#L17. Maybe check that you haven't configured it differently somewhere else, such as where the which-key plugin is setup.
GitHub
LazyVim/lua/lazyvim/plugins/lsp/keymaps.lua at cb40a09538dc0c417a7f...
Neovim config for the lazy. Contribute to LazyVim/LazyVim development by creating an account on GitHub.
Joseph Crawford
Joseph CrawfordOP4w ago
GitHub
LazyVim/lua/lazyvim/plugins/extras/editor/telescope.lua at 7c7c196a...
Neovim config for the lazy. Contribute to LazyVim/LazyVim development by creating an account on GitHub.