-
Notifications
You must be signed in to change notification settings - Fork 676
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
Adding LSP client completion for Razor handler and removing legacy completion #7205
Conversation
…upport Pushing as draft initially to get early feedback while I am finishing - completionResolve - type clean-up (switch to vscode-languageserver-protocol types when possible) - provisional completion support
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly looks good. Definitely on the right track.
I don't see the change to opt the server into the new completion system. Would need a command line argument added to where rzls is called. Without that, I'm not sure this endpoint would get hit. |
There is matching change in Razor repo here
I haven't gotten that PR out yet. It basically removes the "if" check and the "else" clause. I am guessing there is more clean-up of unnecessary "Legacy" classes. I'll get that out shortly. I confirmed that after that change the new endpoint in VSCode is getting hit and returned data processed. Is there something else needed? |
Thats cool, but it means we need a dual insertion for things to work. The alternative is to pass |
- Using correct LSP types for Roslyn completion items per CR feedback
I'm guessing you meant |
…e need default item data copied to each item.
- We currently have to invoke provisional completion in Roslyn via vscode command vs Roslyn command - Minor cleanup of function names, TODOs - Fixing item kind translation from vscode to LSP (it's off by one)
…provisionally added '.' is removed after we get completions from Roslyn
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests would be wonderful...
Agreed, I'd prefer to add in a follow up PR though to make sure this gets in - unless you feel strongly otherwise. Starting to work on them. |
Follow up is fine, not going to block. |
Adding LSP client completion handler and removing legacy completion
Implementation notes:
razor/completion
andrazor/completionResolve
requests https://github.com/dotnet/razor/blob/main/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_Completion.cs and what old code did in https://github.com/dotnet/vscode-csharp/blob/88bbc90365504031abf62eccde21b402211facce/src/razor/src/completion/razorCompletionItemProvider.ts#L27C14-L27C41 and https://github.com/dotnet/vscode-csharp/blob/88bbc90365504031abf62eccde21b402211facce/src/razor/src/completion/provisionalCompletionOrchestrator.ts#L17C14-L17C47a. for C# (in non-provisional completion case) we call roslyn completion directly to get completion list.
That will already be in LSP format and we can just return it.
b. for HTML, we execute vscode command to get completions. Those will get returned in vscode format, so we need to translate them to LSP format before returning them to Razor server.
c. for C# (in provisional case) we currently have to use vscode command as well instead of calling Roslyn directly. That's what existing code currently does and calling Roslyn directly via Roslyn command causes null to be returned. There is Provisional Completion in Razor should show full tooltip info #7250 filed to follow up on that.
a. Detecting that this is in fact a provisional completion case. We don't need that now since server tells us when it is the case by supplying non-null provisional edit.
b. Detecting when the user is done interacting with completion so that provisional edit (temporarily added '.' in C# projected document) can be removed. We don't need to do that since we just get the data from Roslyn and return to the server. We can remove provisionally added '.' immediately after getting the data from Roslyn.
Main wins after this PR:
Legacy completion code in Razor server can be deleted.
Tag helpers are now added to HTML completion
Correct glyphs/icons are shown for HTML and provisional completion C#