OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.7k stars 169 forks source link

Silently failing #855

Closed MFDeAngelo closed 10 months ago

MFDeAngelo commented 10 months ago

OmniSharp-Vim was working splendidly for the longest time! However, mine has stopped working recently. It started when I opened a legacy project (.NET Framework 4.8). It didn't like something about that project and has just stopped working for even my current projects (.NET 6). The code is properly highlighted, and it says that the server was started. However, if I run any commands such as :OmniSharpGotoDefinition, it fails silently.

Things that I've tried:

I'm working on a windows 10 system. Here is a link to my vim.init nvim version: NVIM v0.9.0-dev-1338+g9e7426718

Is there a log file that I can check to see what is happening? Or perhaps we could add some kind of system diagnostics command? Anyways, any help on this issue would be greatly appreciated.

Last, but most certainly not least, thank you for the work you've put into this project. It has been an invaluable tool for me and my work.

nickspoons commented 10 months ago

Hi @MFDeAngelo,

Yes there is an OmniSharp-vim log (or rather, OmniSharp-vim writes the OmniSharp-roslyn log to this location), open it with :OmniSharpOpenLog.

However from your config I think your main problem is that you are using 2 different versions of the OmniSharp-roslyn server at once, so it's going to be confusing working out which one has worked previously. In your config you have OmniSharp-vim installed, but you also use nvim-lspconfig to configure a different instance of OmniSharp-roslyn.

I recommend you choose one or the other - either OmniSharp-vim or neovim LSP with nvim-lspconfig.


Having said that, working with both .NET Framework and dotnet6 can be a bit of a challenge to do smoothly.

The key is that for dotnet (non-Framework) projects, you should use the "net6" builds of OmniSharp-roslyn, so with OmniSharp-vim you do this by setting let g:OmniSharp_server_use_net6 = 1. For .NET Framework projects you should use the .NET Framework server build, so use let g:OmniSharp_server_use_net6 = 0. The tricky bit is that OmniSharp-vim will try to install these servers to the same location (%LocalAppData%\omnisharp-vim\omnisharp-roslyn) so if you switch from one setting to the other, you'll need to re-install the server each time.

So if you want to continue with OmniSharp-vim rather than nvim-lsp, try starting a project and then check your log for errors. If the project is failing to load you're most likely using the wrong server build. In which case use the appropriate let g:OmniSharp_server_use_net6 = 0/1, install the associated server with :OmniSharpInstall and restart.

MFDeAngelo commented 10 months ago

Ahh... yeah... I was using it twice. I initially tried nvim-lspconfig. When I couldn't get it to work, I switched to omnisharp-vim. Since it started working I didn't bother to remove nvim-lspconfig. I probably should have removed it anyways. Months later, I thought it was just part of the setup.

I added let g:OmniSharp_server_use_net6 = 1, reinstalled the server, and synced my packer plugins, which worked! Thanks so much for your help!

nickspoons commented 10 months ago

OK great to hear