Open kmoschcau opened 2 hours ago
Do you use Mason normally for LSP installs?
I do, but there is no Mason install for rzls yet as far as I know.
registries = {
'github:mason-org/mason-registry',
'github:Crashdummyy/mason-registry',
}
Pass this to your mason setup and you should be able to install rzls and Roslyn via mason
Ps, this is all experimental at the moment. So it isn't documented yet
I also haven't done any testing on windows so there might be some more to do
OK I was able to install it and it seems to start when I open a .razor
file with it. Then I get this message:
[REDACTED]/Components/App.razor__virtual.cs
Error executing vim.schedule lua callback: ...ocal/nvim-data/lazy/rzls.nvim/lua/rzls/documentstore.lua:40: Failed to rename buffer
stack traceback:
[C]: in function 'nvim_buf_set_name'
...ocal/nvim-data/lazy/rzls.nvim/lua/rzls/documentstore.lua:40: in function 'get_or_create_buffer_for_filepath'
...ocal/nvim-data/lazy/rzls.nvim/lua/rzls/documentstore.lua:60: in function 'register_vbufs_by_path'
...ocal/nvim-data/lazy/rzls.nvim/lua/rzls/documentstore.lua:76: in function 'update_vbuf'
...ocal/nvim-data/lazy/rzls.nvim/lua/rzls/handlers/init.lua:41: in function 'handler'
...m Files/Neovim/share/nvim/runtime/lua/vim/lsp/client.lua:998: in function 'fn'
vim/_editor.lua:359: in function <vim/_editor.lua:358>
I get this twice for every razor file in the project as far as I can tell. Opening these files in the background also triggers diagnostic checks from none-ls on each file, which slows things down a bit.
I then get a bunch of other messages, some looking like they are for debugging.
Triggering completion after an @
gives:
nil
LSP[rzls]: Error SERVER_REQUEST_HANDLER_ERROR: "...vim-data/lazy/rzls.nvim/lua/rzls/handlers/completion.lua:15: No virtual document found"
Triggering hover gives:
Error executing vim.schedule lua callback: ...im-data/lazy/rzls.nvim/lua/rzls/clienthandlers/hover.lua:33: assertion failed!
stack traceback:
[C]: in function 'assert'
...im-data/lazy/rzls.nvim/lua/rzls/clienthandlers/hover.lua:33: in function 'handler'
...m Files/Neovim/share/nvim/runtime/lua/vim/lsp/client.lua:681: in function 'fn'
vim/_editor.lua:359: in function <vim/_editor.lua:358>
And editing the buffer in any way gives:
[REDACTED]/Components/Pages/LandingPage.razor__virtual.cs
Error executing vim.schedule lua callback: ...ocal/nvim-data/lazy/rzls.nvim/lua/rzls/documentstore.lua:40: Failed to rename buffer
stack traceback:
[C]: in function 'nvim_buf_set_name'
...ocal/nvim-data/lazy/rzls.nvim/lua/rzls/documentstore.lua:40: in function 'get_or_create_buffer_for_filepath'
...ocal/nvim-data/lazy/rzls.nvim/lua/rzls/documentstore.lua:60: in function 'register_vbufs_by_path'
...ocal/nvim-data/lazy/rzls.nvim/lua/rzls/documentstore.lua:76: in function 'update_vbuf'
...ocal/nvim-data/lazy/rzls.nvim/lua/rzls/handlers/init.lua:41: in function 'handler'
...m Files/Neovim/share/nvim/runtime/lua/vim/lsp/client.lua:998: in function 'fn'
vim/_editor.lua:359: in function <vim/_editor.lua:358>
Oh and writing the buffer gives:
file modified:[REDACTED]\Components\Pages\LandingPage.razor
Error executing luv callback:
...l/nvim-data/lazy/rzls.nvim/lua/rzls/virtual_document.lua:19: E5560: Vimscript function must not be called in a lua loop callback
stack traceback:
[C]: in function 'uri_to_bufnr'
...l/nvim-data/lazy/rzls.nvim/lua/rzls/virtual_document.lua:19: in function 'new'
...ocal/nvim-data/lazy/rzls.nvim/lua/rzls/documentstore.lua:56: in function 'register_vbufs_by_path'
...AppData/Local/nvim-data/lazy/rzls.nvim/lua/rzls/init.lua:172: in function <...AppData/Local/nvim-data/lazy/rzls.nvim/lua/rzls/init.lua:168>
Can you run :checkheath rzls
Sure, that gives me:
rzls: require("rzls.health").check()
rzls.nvim report ~
- ERROR roslyn pipe not connected
So you have no documentstore, and its not connecting to roslyn
Can you share your config for roslyn.nvim and rzls.nvim
Sure. Here's roslyn:
--- @param client vim.lsp.Client the LSP client
local function monkey_patch_semantic_tokens(client)
-- NOTE: Super hacky... Don't know if I like that we set a random variable on
-- the client Seems to work though ~seblj
if client.is_hacked then
return
end
client.is_hacked = true
-- let the runtime know the server can do semanticTokens/full now
client.server_capabilities =
vim.tbl_deep_extend("force", client.server_capabilities, {
semanticTokensProvider = {
full = true,
},
})
-- monkey patch the request proxy
local request_inner = client.request
client.request = function(method, params, handler, req_bufnr)
if method ~= vim.lsp.protocol.Methods.textDocument_semanticTokens_full then
return request_inner(method, params, handler)
end
local target_bufnr = vim.uri_to_bufnr(params.textDocument.uri)
local line_count = vim.api.nvim_buf_line_count(target_bufnr)
local last_line = vim.api.nvim_buf_get_lines(
target_bufnr,
line_count - 1,
line_count,
true
)[1]
return request_inner("textDocument/semanticTokens/range", {
textDocument = params.textDocument,
range = {
["start"] = {
line = 0,
character = 0,
},
["end"] = {
line = line_count - 1,
character = string.len(last_line) - 1,
},
},
}, handler, req_bufnr)
end
end
require("roslyn").setup {
config = {
capabilities = require("lsp.common").capabilities,
handlers = require "rzls.roslyn_handlers",
on_attach = function(client, bufnr)
require "lsp.attach"(client, bufnr)
monkey_patch_semantic_tokens(client)
end,
},
}
And here's rzls:
require("rzls").setup {
capabilities = require("lsp.common").capabilities,
on_attach = require "lsp.attach",
path = "rzls.cmd",
}
you shouldnt need a path field to the rzls set up with a mason installation, it should be detected automatically.
If you run :LspInfo
or :checkhealth lsp
can you see you should see rzls and roslyn running
Hi, I cloned and compiled
dotnet/razor
withdotnet build .\Razor.sln
. Both.\build.ps1
and.\build.cmd
give me errors. The build results in anartifacts\bin\rzls\Debug\net8.0\rzls.dll
. When I use that as apath
withrzls.nvim
, I get thislsp.log
entry:I also tried manually to run the DLL like so:
dotnet rzls.dll
That at least does not produce any errors and just keeps running until terminate it with Ctrl-C.I also tried to set
path
to justC:/Users/KaiMoschcau/Code/razor/artifacts/bin/rzls/Debug/net8.0/
, which results in a warning notification, that the language server is not installed.Lastly I also tried to write a pwsh wrapper script, which just does
dotnet "$HOME\Code\razor\artifacts\bin\rzls\Debug\net8.0\rzls.dll"
. That gives me the following notification:Any help would be appreciated.