Skip to content

Commit

Permalink
Respond to API changes, and implement semantic tokens queue
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwengier committed Mar 25, 2024
1 parent ba73960 commit 5b6b13c
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,23 @@ internal class RazorCohostDynamicRegistrationService(LanguageServerFeatureOption

public VSInternalClientCapabilities ClientCapabilities => _clientCapabilities.AssumeNotNull();

public async Task RegisterAsync(string clientCapabilities, IRazorCohostClientLanguageServerManager razorCohostClientLanguageServerManager, CancellationToken cancellationToken)
public async Task RegisterAsync(string clientCapabilitiesString, RazorCohostRequestContext requestContext, CancellationToken cancellationToken)
{
if (!_languageServerFeatureOptions.UseRazorCohostServer)
{
return;
}

_clientCapabilities = JsonConvert.DeserializeObject<VSInternalClientCapabilities>(clientCapabilities) ?? new();
var razorCohostClientLanguageServerManager = requestContext.GetRequiredService<IRazorCohostClientLanguageServerManager>();
var semanticTokensRefreshQueue = requestContext.GetRequiredService<IRazorSemanticTokensRefreshQueue>();

_clientCapabilities = JsonConvert.DeserializeObject<VSInternalClientCapabilities>(clientCapabilitiesString) ?? new();

// TODO: Get the options from the from the endpoints somehow
if (_clientCapabilities.TextDocument?.SemanticTokens?.DynamicRegistration == true)
{
semanticTokensRefreshQueue.Initialize(clientCapabilitiesString);

await razorCohostClientLanguageServerManager.SendRequestAsync(
Methods.ClientRegisterCapabilityName,
new RegistrationParams()
Expand Down

0 comments on commit 5b6b13c

Please sign in to comment.