I try since long now to set up neovim with omnsharp and lsp. But it seems never wanting to work and I really don’t know what I am mising.
My Lsp setup works partly with my sumneko server but even there I get the same messages as with the omnishapr server when using the goToImplementation method.
The error it displays is:
RPC[Error] code_name = MethodNotFound, message = “method textDocument/implementation is not supported by any of the servers registered for the current buffer”
Since this comes with almost all the methods I use from LSP it seems for me a little fishy…
My omnishapr server ist running and has the correct root directory and I don’t see anything missing so far.
I am on Windows and use the new 0.5 versin from neovim
What information do you need more to analyse my problem?
Neovim doesn’t support omnisharp’s “go to implementation” yet. From what I see, when asked for the implementation provider capabilities omnisharp returns an empty table, and currently there’s a “TODO” message there:
-- TODO(ashkan) support more detailed implementation options.
You can see it on the file runtime/lua/vim/lsp/protocol.lua.
If you want to make it work here’s a patch you can use before compiling neovim until this is implemented:
diff --git a/runtime/lua/vim/lsp/protocol.lua b/runtime/lua/vim/lsp/protocol.lua
index 7e43eb84d..08e6382c3 100644
--- a/runtime/lua/vim/lsp/protocol.lua
+++ b/runtime/lua/vim/lsp/protocol.lua
@@ -1025,7 +1025,8 @@ function protocol.resolve_capabilities(server_capabilities)
general_properties.implementation = server_capabilities.implementationProvider
elseif type(server_capabilities.implementationProvider) == 'table' then
-- TODO(ashkan) support more detailed implementation options.
- general_properties.implementation = false
+ -- force true to fix for omnisharp
+ general_properties.implementation = true
else
error("The server sent invalid implementationProvider")
end
I guess you could also modify the already installed lsp/protocol.lua file without the need to build neovim, not sure where that gets installed on windows though.
Alternatively, instead of using “go to implementation”, you could use “find all references” which will list the implementations too and should work without needing any changes:
Hi Thank you for this extensive answer.
It seems that I still have a problem with the LSP-server building/understanding my solution, since I get “unused usings” notifications for usings out of a different project in the same solution. And when I use references I get only an empty list.
When I use the formatting mehod I get a nullreference-exeption.
Any ideas to that?
Having both csproj and sln was problematic for me, I think I had the same issues you mention. The issue with having both is that when you have a solution (sln) with multiple projects (csproj) it would start attaching multiple servers IIRC, when you want to attach a single one for the whole solution. What I did was to just remove csproj from the root_dir and leave only sln:
root_dir = util.root_pattern("*.sln");
Where util is local util = require 'lspconfig/util'
Hope that helps!
Edit: I don’t know about the formatting, I don’t use it but just tested it and it works. Might be related with the other issue so hopefully it gets resolved too.