Skip to content
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

Use new version of protocol to correctly serialize URIs #69453

Merged
merged 1 commit into from
Aug 10, 2023

Conversation

dibarbet
Copy link
Member

@dibarbet dibarbet commented Aug 9, 2023

No description provided.

@dibarbet dibarbet requested a review from tmat August 9, 2023 23:03
@dibarbet dibarbet requested review from a team as code owners August 9, 2023 23:03
@dotnet-issue-labeler dotnet-issue-labeler bot added Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead labels Aug 9, 2023
@arkalyanms
Copy link
Member

this seems like a good candidate for "merge without requirements" to unblock the C# release.

@@ -37,6 +37,8 @@ void M()
await using var testLspServer = await CreateTestLspServerAsync(markup, mutatingLspWorkspace);

var results = await RunGotoDefinitionAsync(testLspServer, testLspServer.GetLocations("caret").Single());
// Verify that as originally serialized, the URI had a file scheme.
Assert.True(results.Single().Uri.OriginalString.StartsWith("file"));
Copy link
Member

@tmat tmat Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is necessarily correct assertion.
It is entirely correct to create Uri instance using local path: new Uri(@"C:\a.cs"). This gets internally translated to file:///C:/a.as, so the AbsoluteUri would be fine but OriginalString would be C:\a.cs.

Copy link
Member Author

@dibarbet dibarbet Aug 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the correct assertion for this particular test. The go to definition result is in a file with a path, so the json string the server serializes should be a file schemed URI. (e.g. file:///C:\a.cs)

The test client will then convert the server's json string response into LSP types (this is results variable - its not the servers original csharp type, its the csharp type after the response has been deserialized back into csharp types on the client). So the original string it uses should be the file schemed URI that it got from the server.

Copy link
Member

@tmat tmat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, other than the assertion.

@dibarbet
Copy link
Member Author

dibarbet commented Aug 9, 2023

this seems like a good candidate for "merge without requirements" to unblock the C# release.

I want to verify unit tests pass here at least, so will let it run

@dibarbet dibarbet merged commit 6da04e2 into dotnet:main Aug 10, 2023
27 checks passed
@ghost ghost added this to the Next milestone Aug 10, 2023
@dibarbet dibarbet deleted the update_lsp_uri branch August 10, 2023 01:25
@dibarbet dibarbet modified the milestones: Next, 17.8 P2 Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE untriaged Issues and PRs which have not yet been triaged by a lead
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants