Search code examples
linuxneovimlanguage-server-protocolnvim-lspconfig

csharp_ls not working with Neovim built-in lsp


I installed csharp_ls like in official nvim lsp docs. I have dotnet-sdk installed:

$ dotnet --version
5.0.205

as well as csharp-ls:

$ whereis csharp-ls
csharp-ls: /home/user/.dotnet/tools/csharp-ls

But when I try to run it in neovim, I get this error:

:lua require'lspconfig'.csharp_ls.setup{}

E5108: Error executing lua [string ":lua"]:1: attempt to index field 'csharp_ls' (a nil value)

My nvim config:

call plug#begin('~/.config/nvim/plugged')

Plug 'tpope/vim-fugitive'

Plug 'itchyny/lightline.vim'

Plug 'gruvbox-community/gruvbox'

Plug 'neovim/nvim-lspconfig'

Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'
Plug 'hrsh7th/nvim-cmp'

Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}  

Plug 'nvim-lua/plenary.nvim'
Plug 'nvim-lua/popup.nvim'
Plug 'nvim-telescope/telescope.nvim'

call plug#end()

lua << EOF

    require'lspconfig'.tsserver.setup{}
    require'lspconfig'.vuels.setup{}
    require'lspconfig'.vimls.setup{}
    require'lspconfig'.bashls.setup{}
    require'lspconfig'.csharp_ls.setup{}

EOF

What am I missing here?


Solution

  • I checked the files for nvim-lspconfig and I realized that csharp_ls wasn't even there.
    So I ran a git pull to get the latest files and it solved the problem.