-
Notifications
You must be signed in to change notification settings - Fork 196
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 System.Text.Json for serialization #10551
Conversation
…n still uses on the client
...zor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Models/CodeActionExtensions.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/CompletionListMerger.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DefaultRazorConfigurationService.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/RazorLanguageServerHost.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/RazorLanguageServerHost.cs
Show resolved
Hide resolved
...udio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_CodeActions.cs
Show resolved
Hide resolved
VS Code issues:
|
Integration tests: https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=9811665&view=results ✅ Passed Test insertion: https://dev.azure.com/devdiv/DevDiv/_git/VS/pullrequest/561892
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent change. Well done!
...src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/BaseDelegatedCodeActionResolver.cs
Outdated
Show resolved
Hide resolved
@@ -101,7 +101,7 @@ public DefaultCSharpCodeActionProvider(LanguageServerFeatureOptions languageServ | |||
// flag is on, any perf hit here isn't going to affect real users. | |||
try | |||
{ | |||
if (((JToken)codeAction.Data).ToObject<RazorCodeActionResolutionParams>() is not null) | |||
if (((JsonElement)codeAction.Data).Deserialize<RazorCodeActionResolutionParams>() is not null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This construct is a little strange. I did a bit of a double take when I saw it. 😄
Consider adding a helper to clarify this. Could that be used elsewhere? Maybe something like this?
public static bool CanDeserializeTo<T>(this JsonElement jsonElement)
=> jsonElement.Deserialize<T> is not null;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to do that in a local function, but I don't really want to put it on a help class anywhere, because I would hate for anyone to think that its a useful function to call. This line is only hit when a feature flag is on, that is only for our information, and only possible to turn on for MS internal users, so the badness of the code doesn't worry me here.
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/RazorLanguageServerHost.cs
Show resolved
Hide resolved
...Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/CodeActions/RazorResolveCodeActionParams.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Serialization/RazorUriJsonConverter.cs
Outdated
Show resolved
Hide resolved
Tests are broken because someone decided to update our |
# Conflicts: # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/LegacyRazorCompletionEndpointTest.cs # src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/LegacyRazorCompletionResolveEndpointTest.cs
Fixes #10539
This PR switches us to use System.Text.Json for server to client communication, and opts us in to using it for client to server communication too.
Needs https://devdiv.visualstudio.com/DevDiv/_git/WebTools/pullrequest/561188 to flow to VS main, then I'll kick off a final integration test run for good measure. Without that PR the Wrap With Tag functionality doesn't work.
TODO: