-
Notifications
You must be signed in to change notification settings - Fork 217
Fix override completion in VS Code for Cohosting #11938
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
Fix override completion in VS Code for Cohosting #11938
Conversation
The SingleOrDefault here is running on a non-nullable TextChange, so the "default" result was `default(TextChange)` but all the callers, which get back `TextChange?`, were checking for null.
Sometimes resolve doesn't add an edit, but allowing that in tests means we can't validate that we expect a TextEdit, and ensuring we don't regress that is more important
src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/CompletionListMerger.cs
Show resolved
Hide resolved
...c/Microsoft.CodeAnalysis.Razor.Workspaces/Completion/Delegation/DelegatedCompletionHelper.cs
Outdated
Show resolved
Hide resolved
| // rather than the one LSP knows about. | ||
| if (resolvedCompletionItem.Command is | ||
| { | ||
| CommandIdentifier: "roslyn.client.completionComplexEdit", |
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.
Consider lifting this to a const, if we can't reference the const in 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.
👍
Will do this as a follow up, along with #11911 (comment), since both will require dual, or at least timed, insertion fun.
| if (resolvedCompletionItem.Command is | ||
| { | ||
| CommandIdentifier: "roslyn.client.completionComplexEdit", | ||
| Arguments: [TextDocumentIdentifier, TextEdit complexEdit, _, int nextCursorPosition] args |
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.
Would it be useful to add a Debug.Assert somewhere to validate the number of arguments and their types? That would shine a light if Roslyn ever changes the shape of the data for this command.
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.
Good idea. In fact, it's probably worth making it a log message so we get user reports (though I'll have to add another parameter to this method 😛)
Razor side of dotnet/roslyn#78949 Two followups from previous PRs: * Export formatting options for Razor testing: #11911 (comment) * Share const for complex edit command name: #11938 (comment) Won't build, of course, without the above PR merged and packages referenced
Fixes #11840
Two main bits to this change:
ItemDefaults.Datafor VS Code, and all of our data merging and wrapping didn't support itI broke things up into lots of commits because it was lots of little changes in lots of places, so might be easier to review that way.