OmniSharp / omnisharp-vim

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

Code actions not working #805

Closed sploofy closed 2 years ago

sploofy commented 2 years ago

Hi there,

Code actions have stopped working.

I found this in the logs: [fail]: OmniSharp.MSBuild.ProjectManager Failure while loading the analyzer reference 'Microsoft.CodeAnalysis.CSharp.NetAnalyzers': Type Microsoft.CodeQuality.CSharp.Analyzers.ApiDesignGuidelines.CSharpUsePreferredTermsAnalyzer has invalid vtable method slot 5 with method none If found out that this might be an issue when using .NET 6, which we are. There is a flag in the VSCode plugin called usemodernNet that causes it to use a .NET 6 compiled version of Omnisharp which supposedly fixes this issue if you have them in VSCode.

I haven't been able to figure out what this flag does exactly "under the hood" though.

nickspoons commented 2 years ago

I think the vscode useModernNet is essentially the same as our g:OmniSharp_server_use_net6, which is an instruction to use a different server build. Try adding this to your .vimrc:

let g:OmniSharp_server_use_net6 = 1

Then re-install the server with :OmniSharpInstall

sploofy commented 2 years ago

Thanks Nick,

That did the trick, there are no longer any errors in the log and code actions are back.