OmniSharp / omnisharp-vim

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

How do I use Nvim-cmp with Omnisharp-vim? #779

Closed ankushKun closed 2 years ago

ankushKun commented 2 years ago

How can I setup Omnisharp-vim to show completions using nvim-cmp built in lsp without me having to do <C-x><C-o> as said in the readme.

I also want to be able to be able to get errors and warnings showed to me like this image ^ Nvim LSP

Is it possible to use navies built in lsp along with Omnisharp-vim to provide these functions?

nvim-lsp-installer has an option to install Omnisharp, and also provides completion and warnings/errors in the code, but I can find how to configure it to use mono like I did with omnisharo, nor do I get :OmniSharp... commands with it. I'll be using it with unity, and LSP Omnisharp (the one installed but the lsp installer) does not seem to recognise Unity classes and namespaces, I think it does not load the .sln file. However omnisharp=vim works.

This is how I load lsp Omnisharp

require('nvim-lsp-installer').setup {}
local lspconfig = require("lspconfig")
local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol.make_client_capabilities())
lspconfig.omnisharp.setup { capabilities = capabilities }

Thanks.

nickspoons commented 2 years ago

OmniSharp-vim and neovim LSP are 2 totally different and separate language server clients. They can both use the OmniSharp-roslyn server but not the same instance: each client will start its own server.

So, you can use them both simultaneously, for e.g. completion and diagnostics from nvim-lsp and :OmniSharpRunTestInFile and :OmniSharpRensme from OmniSharp-vim, but will want to disable diagnostics and completion and possibly highlighting (if nvim-lsp does that?) in one or the other so these common features aren't duplicated in your session.

I don't know how to configure nvim-lsp though, this is the wrong place to ask about that.