Cannot make neovim's native LSP communicate with Godot in C#

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lifer0se

I’ve been using neovim + coc for gdscript for some time now. Recently I decided to switch to neovim’s native LSP. The gdscript side of things works like a charm. However many neovim plugins do not support gdscript.

So I would like to give C# scripting a shot in Godot but can’t seem to get it to work. I’ve downloaded csharp_ls as per the of nvim-lspconfig and the csharp server is working fine; I’m getting linting errors and basic autocomplete but I can’t get it to connect to Godot. Any ideas?

:bust_in_silhouette: Reply From: lifer0se

For anyone interested, the solution is quite simple. Using the williamboman/nvim-lsp-installer plugin, install the omnisharp server and set it up using the options from the instructions of lspconfig. Then go to ~/.local/share/nvim/lsp_servers/omnisharp/ and change the run script’s bin _dir variable to /usr/bin.

May I ask what do you mean specifically by the run script’s bin_dir? I’m using mason along with nvim-lspconfig. Found my omnisharp script in my ~/.local/share/nvim/mason/bin and the script doesn’t have a bin_dir variable in it. Also am trying to get neovim to work with Godot C#, but can’t seem to get it to work.

Myusuki | 2023-03-13 19:34

Yeah I’ve changes my config to mason a while back as well, it seems my old solution does not work nowadays.

However, I don’t have any issues with C# and Godot just with the regular lsp install of omnisharp and having dotnet installed.

I’d say you try an empty dotnet project first to see if that’s working properly, then make sure you’ve built your godot project at least once to generate the needed files for the lsp to work.

lifer0se | 2023-03-13 22:07

Ok, it works after I type Godot.(insert whatever method/ class here) even though I have using Godot; at the top of the file. I’m ok if I have to deal with such, though do let me know if there’s a work around to such an issue. Everything’s working fine so far, thx.

Myusuki | 2023-03-21 17:18