-
Notifications
You must be signed in to change notification settings - Fork 105
Language server's initial response to "initialize" request does not correctly report server capabilities #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Sorry didn't see this the other day. I've changed it to |
No worries - thanks for having a look at it! BTW, might it be worth considering a match on JSON-RPC method name? Because (although this is admittedly an edge case) there's nothing to indicate to an API consumer that creating their own handler interface with the correct |
That's a fair point. My main goal was to just have things be automatic, and I (generally) dislike strings in C# because they're easy to mess up or feel kludgy to get right. We'd have to create a const string field for each item we wanted to add, and then use that anywhere the text is used. That's why I was using the interface to basically remove needing the string, it's only marked one place, implement the interface and you're good to go. That said you make a pull request to change it around I'm willing to bring it in. |
Release should show up on nuget shortly as version |
Yeah, I totally get you - stringly-typed stuff makes me uncomfortable, too :) If this works for now, I personally think it would be enough to simply document the limitation so people understand what they're getting into if they try it; I'd be happy to sketch out a "development guide" in the form of a simple markdown document that describes the basic approach and common pitfalls / gotchas. |
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. |
Defo like that concept - I'm a big believer (especially for protocol libraries) of being strict in what you send, but relaxed / adaptive / forgiving in what you're willing to receive. |
Hmm - just tried the new package, and the call to Not certain whether this change is the reason though - I was on |
Simple repro here: Only happens with |
Interesting - same thing happens in |
I suspect you're right. Having trouble debugging (can't get symbols so VS keeps blindly stepping over the problematic function even when I'm in the disassembly view!), but I'll keep at it. |
Do you currently build symbol packages BTW? |
they build but I don't publish them anywhere yet, I need to wireup symbol source. |
@tintoy I'll see if I can't test with your extension tonight, but let me know if you've made progress. |
Hi - will give it another try shortly (it's 8am here). VS debugger is still a little broken for .net core it seems :/ |
Will try to build packages locally and use them from there... |
(with symbols in the package) |
I will look at symbol source as well... and sorry totally forgot where the timezone sits for that side of the world. I should be used to the timezone dance. |
Heh, no problem - I normally keep odd hours :) So of course it doesn't hang when I use a package built from source (current tip of BUT: It also doesn't work - |
It doesn't even happen if I check out 561a96d, which is the commit on which |
Actually, hang on. Let me check something. |
Found the problem :-) That overload should probably go? |
(I missed it before because your repo is not the |
Wow... I totally missed that because I side step and use the enumerable one! It needs to be changed to call |
Thanks, @david-driscoll! Fixed in |
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 inHandlerCollection
is going to beIRequestHandler<HoverParams, Hover>
notIHoverProvider
:csharp-language-server-protocol/src/Lsp/LanguageServer.cs
Line 130 in 4bc2a15
I believe this could be fixed by either capturing the original interface (
IHoverHandler
) when adding the handler to the collection, finding the underlyingIRequestHandler<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:
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.
The text was updated successfully, but these errors were encountered: