Skip to content

Commit 8e11180

Browse files
Fix provisional completion corrupting generated C# documents (#10806)
Fixes #10759 Initially when investigating this I was digging into buffer versions and race conditions, but now that the editor fix is in, and we are self versioned, the bug stood out much more obviously: A character offset was being passed in to a parameter that expected a length 🤦‍♂️ Sadly none of the `RazorCustomMessageTarget` code is testable. Cohosting will make this trivial though, as we would simply create a new `Document` with the provisional change, and drop it on the floor when we're finished.
2 parents da86194 + 39942a2 commit 8e11180

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_Completion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ private static TextEdit BuildRevertedEdit(TextEdit provisionalTextEdit)
189189
revertedProvisionalTextEdit = VsLspFactory.CreateTextEdit(
190190
range: VsLspFactory.CreateSingleLineRange(
191191
range.Start,
192-
length: range.End.Character + provisionalTextEdit.NewText.Length),
192+
length: provisionalTextEdit.NewText.Length),
193193
newText: string.Empty);
194194
}
195195
else

0 commit comments

Comments
 (0)