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

Update semantic tokens service to better support The Future™ #10036

Merged
merged 2 commits into from
Mar 7, 2024

Conversation

davidwengier
Copy link
Contributor

@davidwengier davidwengier commented Mar 6, 2024

In order to work in cohosting, and hence OOP, its a lot easier with a couple of relatively simple changes to the semantic tokens service:

  1. Use MS.CA.Text types instead of LSP protocol types
  2. Extract C# tokens requests to a separate service

This PR does both of those things, and also:

  1. Move telemetry reporting out of the service, up into the endpoint

This is targeting the "regress cohosting" branch because it turns out this new design is impossible in cohosting right now 🤦‍♂️

Part of #9519

@davidwengier davidwengier requested a review from a team as a code owner March 6, 2024 04:04

namespace Microsoft.AspNetCore.Razor.LanguageServer.Semantic;

internal class LSPCSharpSemanticTokensProvider(IClientConnection clientConnection, IRazorLoggerFactory loggerFactory) : ICSharpSemanticTokensProvider
Copy link
Contributor Author

@davidwengier davidwengier Mar 6, 2024

Choose a reason for hiding this comment

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

This is a direct move from the sematic tokens service (and change to use LinePositionSpan). The idea is the OOP will have a different implementation of this service (that doesn't use LSP)

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll trust you this and won't be reviewing this file :)

@@ -1006,12 +1006,14 @@ private async Task VerifySemanticTokensAsync(string documentText, bool precise,
options.HtmlVirtualDocumentSuffix == "__virtual.html",
MockBehavior.Strict);

var cSharpSemanticTokensProvider = new LSPCSharpSemanticTokensProvider(_clientConnection.Object, LoggerFactory);
Copy link
Contributor

Choose a reason for hiding this comment

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

cShar

super-nit :) funky capitalization, seems like we use "csharpXXX" elsewhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

100%! I was chasing the code fixes for a bunch of these, but I guess I missed a few. Thanks!

Copy link
Contributor

@alexgav alexgav left a comment

Choose a reason for hiding this comment

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

:shipit:

@davidwengier davidwengier merged commit 9a18d3d into main Mar 7, 2024
12 checks passed
@davidwengier davidwengier deleted the SemanticTokensService branch March 7, 2024 06:39
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Mar 7, 2024
@RikkiGibson RikkiGibson modified the milestones: Next, 17.10 P3 Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants