Skip to content

Handle completions with trailing whitespace on previous lines#2319

Merged
filipw merged 2 commits intoOmniSharp:masterfrom
333fred:override-bug
Jan 6, 2022
Merged

Handle completions with trailing whitespace on previous lines#2319
filipw merged 2 commits intoOmniSharp:masterfrom
333fred:override-bug

Conversation

@333fred
Copy link
Copy Markdown
Contributor

@333fred 333fred commented Dec 31, 2021

LSP filters expect that the range of the main text edit is going to start on the same line as the cursor. However, when trailing whitespace preceeds the override marker, Roslyn will return a single text edit for the whole range that trims that whitespace. This confuses the vscode intellisense engine, which then unhelpfully displays no completions with no user feedback that this filtering is happening. To avoid this, we now detect when this case occurs, and split up the change into non-overlapping edits from before the current line. Fixes dotnet/vscode-csharp#4600.

LSP filters expect that the range of the main text edit is going to start on the same line as the cursor. However, when trailing whitespace preceeds the override marker, Roslyn will return a single text edit for the whole range that trims that whitespace. This confuses the vscode intellisense engine, which then unhelpfully displays no completions with no user feedback that this filtering is happening. To avoid this, we now detect when this case occurs, and split up the change into non-overlapping edits from before the current line. Fixes dotnet/vscode-csharp#4600.
@333fred 333fred requested a review from JoeRobich December 31, 2021 07:14
@333fred
Copy link
Copy Markdown
Contributor Author

333fred commented Dec 31, 2021

microsoft/vscode#41022 would have been very useful for helping debug this issue.

Comment thread tests/OmniSharp.Roslyn.CSharp.Tests/CompletionFacts.cs Outdated
Comment thread src/OmniSharp.Roslyn.CSharp/Services/Completion/CompletionListBuilder_Sync.cs Outdated
@filipw filipw merged commit 553dcd2 into OmniSharp:master Jan 6, 2022
@333fred 333fred deleted the override-bug branch January 6, 2022 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Override code generation not working

2 participants