csharp-language-server-protocol: Language server's initial response to "initialize" request does not correctly report server capabilities
Hi.
As noted here the language server is not correctly reporting its capabilities when responding to the initialize request (although if the client supports dynamic registration then the subsequent capability-registration message will correctly report its capabilities).
I believe I’ve tracked this down to the use of LanguageServer.HasHandler<T>, which is never going to behave as expected because the interface captured in HandlerCollection is going to be IRequestHandler<HoverParams, Hover> not IHoverProvider:
I believe this could be fixed by either capturing the original interface (IHoverHandler) when adding the handler to the collection, finding the underlying IRequestHandler<HoverParams, Hover> interface and matching on that instead, or simply matching on JSON-RPC method name (personally, this seems like the most robust and easy-to-reason-about option).
For example:
bool HasHandler<T>()
where T : IJsonRpcHandler
{
var method = LspHelper.GetMethodName<T>();
return _collection.Get(method).Any();
}
I’m happy to open a PR if you don’t have time to fix this, but if so let me know which solution you’d prefer.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 26 (9 by maintainers)
Commits related to this issue
- Use v0.4.1 of LSP packages (OmniSharp/csharp-language-server-protocol#22). — committed to tintoy/dotnet-language-client by tintoy 7 years ago
Oh one other note on the topic. My goal is try and make something that adapts dynamically to the host client, instead of enforcing the adaptation onto server implementors.
IE, if eclipse che only supports LSP 2.0, and vscode supports LSP 13.3 ( 🤣 ), that as long as you reference this library with a version that knows what LSP 13.3 is, that you can support all the versions you want.
I don’t foresee any drastic changes to LSP, besides the dynamic registration ( ✔️ ), and multiple workspaces ( ❌ ). That said I better knock on wood and shut up, lol.