From 5b6b13c2c2b42a8e93af85ec59d345d99303e086 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 25 Mar 2024 17:16:09 +1100 Subject: [PATCH] Respond to API changes, and implement semantic tokens queue --- .../Cohost/RazorCohostDynamicRegistrationService.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/RazorCohostDynamicRegistrationService.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/RazorCohostDynamicRegistrationService.cs index b7d2cb3dd19..26bbb233a53 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/RazorCohostDynamicRegistrationService.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServerClient.Razor/Cohost/RazorCohostDynamicRegistrationService.cs @@ -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(clientCapabilities) ?? new(); + var razorCohostClientLanguageServerManager = requestContext.GetRequiredService(); + var semanticTokensRefreshQueue = requestContext.GetRequiredService(); + + _clientCapabilities = JsonConvert.DeserializeObject(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()