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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<ILAsmPackageVersion>6.0.0-rtm.21518.12</ILAsmPackageVersion>
<ILDAsmPackageVersion>6.0.0-rtm.21518.12</ILDAsmPackageVersion>
<MicrosoftVisualStudioLanguageServerClientPackagesVersion>17.7.4-preview</MicrosoftVisualStudioLanguageServerClientPackagesVersion>
<MicrosoftVisualStudioLanguageServerProtocolPackagesVersion>17.8.8-preview</MicrosoftVisualStudioLanguageServerProtocolPackagesVersion>
<MicrosoftVisualStudioLanguageServerProtocolPackagesVersion>17.8.9-preview</MicrosoftVisualStudioLanguageServerProtocolPackagesVersion>
<MicrosoftVisualStudioShellPackagesVersion>17.7.35038-preview.1</MicrosoftVisualStudioShellPackagesVersion>
<RefOnlyMicrosoftBuildPackagesVersion>16.10.0</RefOnlyMicrosoftBuildPackagesVersion>
<!-- The version of Roslyn we build Source Generators against that are built in this
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

AssertLocationsEqual(testLspServer.GetLocations("definition"), results);
}

Expand Down