Skip to content

Commit

Permalink
Merge pull request #72260 from dibarbet/fix_uri_override
Browse files Browse the repository at this point in the history
Avoid URI serialization issues in override completion by passing full text document identifier
  • Loading branch information
dibarbet authored Feb 25, 2024
2 parents e8c0381 + b069918 commit 3059a07
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ await GetChangeAndPopulateSimpleTextEditAsync(
{
CommandIdentifier = CompleteComplexEditCommand,
Title = nameof(CompleteComplexEditCommand),
Arguments = [textDocumentIdentifier.Uri, textEdit, isSnippetString, lspOffset]
Arguments = [textDocumentIdentifier, textEdit, isSnippetString, lspOffset]
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ class A { }";

Assert.Equal(DefaultLspCompletionResultCreationService.CompleteComplexEditCommand, resolvedItem.Command.CommandIdentifier);
Assert.Equal(nameof(DefaultLspCompletionResultCreationService.CompleteComplexEditCommand), resolvedItem.Command.Title);
Assert.Equal(completionParams.TextDocument.Uri, ProtocolConversions.CreateAbsoluteUri((string)resolvedItem.Command.Arguments[0]));
AssertJsonEquals(completionParams.TextDocument, resolvedItem.Command.Arguments[0]);
AssertJsonEquals(expectedEdit, resolvedItem.Command.Arguments[1]);
Assert.Equal(false, resolvedItem.Command.Arguments[2]);
Assert.Equal((long)14, resolvedItem.Command.Arguments[3]);
Expand Down Expand Up @@ -855,7 +855,7 @@ public async Task TestHandleExceptionFromGetCompletionChange(bool mutatingLspWor
Assert.Equal(nameof(DefaultLspCompletionResultCreationService.CompleteComplexEditCommand), resolvedItem.Command.Title);
Assert.Equal(DefaultLspCompletionResultCreationService.CompleteComplexEditCommand, resolvedItem.Command.CommandIdentifier);

Assert.Equal(completionParams.TextDocument.Uri, ProtocolConversions.CreateAbsoluteUri((string)resolvedItem.Command.Arguments[0]));
AssertJsonEquals(completionParams.TextDocument, resolvedItem.Command.Arguments[0]);

var expectedEdit = new TextEdit { Range = new LSP.Range { Start = new(0, 5), End = new(0, 5) }, NewText = "ComplexItem" };
AssertJsonEquals(expectedEdit, resolvedItem.Command.Arguments[1]);
Expand Down Expand Up @@ -912,7 +912,7 @@ public class MyClass : BaseClass
Assert.Equal(nameof(DefaultLspCompletionResultCreationService.CompleteComplexEditCommand), resolvedItem.Command.Title);
Assert.Equal(DefaultLspCompletionResultCreationService.CompleteComplexEditCommand, resolvedItem.Command.CommandIdentifier);

Assert.Equal(completionParams.TextDocument.Uri, ProtocolConversions.CreateAbsoluteUri((string)resolvedItem.Command.Arguments[0]));
AssertJsonEquals(completionParams.TextDocument, resolvedItem.Command.Arguments[0]);

var expectedEdit = new TextEdit { Range = new LSP.Range { Start = new(7, 4), End = new(7, 13) }, NewText = "public override global::System.Boolean AbstractMethod(global::System.Int32 x)\r\n {\r\n throw new System.NotImplementedException();\r\n }" };
AssertJsonEquals(expectedEdit, resolvedItem.Command.Arguments[1]);
Expand Down

0 comments on commit 3059a07

Please sign in to comment.