You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This has been a long-standing issue of mine, which I finally got around to troubleshooting
I've been using suda_smart_edit = 1 because it is extremely useful when editing system files
However, I noticed when doing scala development, whenever I would use vim.lsp.buf.definition to a dependency file, I would get an error (this happens on neovim 0.8.1, but also happens on every neovim version I can remember):
"~/myproject/.metals/readonly/dependencies/play_2.13-2.8.18-sources.jar/play/api/mvc/Action.scala" 511L, 18648B
Error executing vim.schedule lua callback: /usr/share/nvim/runtime/lua/vim/uri.lua:86: Invalid buffer id: 26
stack traceback:
[C]: in function 'nvim_buf_get_name'
/usr/share/nvim/runtime/lua/vim/uri.lua:86: in function 'uri_from_bufnr'
/usr/share/nvim/runtime/lua/vim/lsp/util.lua:254: in function 'get_lines'
/usr/share/nvim/runtime/lua/vim/lsp/util.lua:320: in function 'get_line'
/usr/share/nvim/runtime/lua/vim/lsp/util.lua:335: in function 'get_line_byte_from_position'
/usr/share/nvim/runtime/lua/vim/lsp/util.lua:1096: in function 'jump_to_location'
/usr/share/nvim/runtime/lua/vim/lsp/handlers.lua:359: in function 'handler'
/usr/share/nvim/runtime/lua/vim/lsp.lua:1383: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
Press ENTER or type command to continue
Running buffers returns:
:buffers
1 h "api/app/myproject/controllers/MyController.scala" line 353
27 %a "suda:///home/perrin4869/myproject/.metals/readonly/dependencies/play_2.13-2.8.18-sources.jar/play/api/mvc/Action.scala" line 1
Press ENTER or type command to continue
Since I noticed the buffer was renamed to suda:///, I tried disabling the plugin, and the problem was solved.
You can probably reproduce this by doing vim.lsp.buf.definition which would result in opening a readonly file on any lsp server, this is not specific to scala (but probably common in scala due to metals creating readonly dependency files).
I really don't have much of a clue how this could be solved, but I thought I'd report it
The text was updated successfully, but these errors were encountered:
Thanks for the report. Well, I'm not sure but it seems Neovim accidentally enables LSP features on a virtual file (suda://...) even Neovim cannot handle it. So it's a kinda Neovim's runtime issue I guess.
Yeah feel free to close this if you don't consider this a suda issue.
But to be fair, lsp should be enabled in that virtual file, even if it's not writable you can jump to definition, etc
This has been a long-standing issue of mine, which I finally got around to troubleshooting
I've been using
suda_smart_edit = 1
because it is extremely useful when editing system filesHowever, I noticed when doing
scala
development, whenever I would usevim.lsp.buf.definition
to a dependency file, I would get an error (this happens onneovim
0.8.1, but also happens on everyneovim
version I can remember):Running buffers returns:
Since I noticed the buffer was renamed to
suda:///
, I tried disabling the plugin, and the problem was solved.You can probably reproduce this by doing
vim.lsp.buf.definition
which would result in opening areadonly
file on any lsp server, this is not specific to scala (but probably common in scala due tometals
creating readonly dependency files).I really don't have much of a clue how this could be solved, but I thought I'd report it
The text was updated successfully, but these errors were encountered: