The setup I have works fine for tsserver but not the csharp_ls

local servers =  { 'tsserver', 'csharp_ls' }

local on_attach  = function(client, bufnr)
   vim.keymap.set('n', 'gd', ":vsplit | wincmd w | lua vim.lsp.buf.definition()<cr>", {buffer=0})

local lsp_flags = {
  debounce_text_changes = 150,

for _, lsp in ipairs(servers) do
    on_attach = on_attach,
    flags = lsp_flags

Log confirms that the project is loading and it is getting initialized.

LSP[csharp_ls][Log] csharp-ls: OK, 1 project files loaded

LSP[csharp_ls][Log] csharp-ls: "initialized" notification received from client

But then I get the following error when trying to navigate to a definition.

Error executing vim.schedule lua callback: ...s\neovim\current\share\nvim\runtime/lua/vim/lsp/util.lua:1735: index out of range stack traceback: [C]: in function '_str_byteindex_enc' ...s\neovim\current\share\nvim\runtime/lua/vim/lsp/util.lua:1735: in function 'locations_to_items' ...ovim\current\share\nvim\runtime/lua/vim/lsp/handlers.lua:352: in function 'handler' ...p\apps\neovim\current\share\nvim\runtime/lua/vim/lsp.lua:1390: in function 'cb' vim/_editor.lua:262: in function <vim/_editor.lua:261>

1 Answer 1


I used LspInfo to determine that csharp_ls wasn't finding my solution properly. It found the project, but I was trying to navigate to a definition located in a different project in the same solution. I wasn't able to figure out how to configure csharp_ls to find the solution so I downloaded omnisharp via Mason and it worked out of the box.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.