Skip to content

Commit

Permalink
Remove cohost endpoints
Browse files Browse the repository at this point in the history
They'll be back, I promise!
  • Loading branch information
davidwengier committed Mar 6, 2024
1 parent 0a163de commit 3d36512
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 542 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,29 +114,20 @@ public static void AddDiagnosticServices(this IServiceCollection services)
services.AddSingleton(sp => new Lazy<RazorTranslateDiagnosticsService>(sp.GetRequiredService<RazorTranslateDiagnosticsService>));
}

public static void AddHoverServices(this IServiceCollection services, LanguageServerFeatureOptions featureOptions)
public static void AddHoverServices(this IServiceCollection services)
{
// Hover services aren't needed in a cohosted world
if (featureOptions.UseRazorCohostServer)
{
return;
}

services.AddHandlerWithCapabilities<HoverEndpoint>();

services.AddSingleton<IHoverService, HoverService>();
}

public static void AddSemanticTokensServices(this IServiceCollection services, LanguageServerFeatureOptions featureOptions)
public static void AddSemanticTokensServices(this IServiceCollection services)
{
if (!featureOptions.UseRazorCohostServer)
{
services.AddHandlerWithCapabilities<SemanticTokensRangeEndpoint>();
// Ensure that we don't add the default service if something else has added one.
services.TryAddSingleton<IRazorSemanticTokensInfoService, RazorSemanticTokensInfoService>();
services.AddHandlerWithCapabilities<SemanticTokensRangeEndpoint>();
// Ensure that we don't add the default service if something else has added one.
services.TryAddSingleton<IRazorSemanticTokensInfoService, RazorSemanticTokensInfoService>();

services.AddSingleton<RazorSemanticTokensLegendService>();
}
services.AddSingleton<RazorSemanticTokensLegendService>();

services.AddHandler<RazorSemanticTokensRefreshEndpoint>();

Expand Down Expand Up @@ -240,12 +231,7 @@ public static void AddDocumentManagementServices(this IServiceCollection service
services.AddSingleton<DocumentProcessedListener, RazorDiagnosticsPublisher>();
}

// Don't generate documents in the language server if cohost is enabled, let cohost do it.
if (!featureOptions.UseRazorCohostServer)
{
services.AddSingleton<DocumentProcessedListener, GeneratedDocumentSynchronizer>();
}

services.AddSingleton<DocumentProcessedListener, GeneratedDocumentSynchronizer>();
services.AddSingleton<DocumentProcessedListener, CodeDocumentReferenceHolder>();

services.AddSingleton<IProjectSnapshotManagerAccessor, LspProjectSnapshotManagerAccessor>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT license. See License.txt in the project root for license information.

using System;
using System.Diagnostics;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.LanguageServer.Common;
Expand All @@ -29,7 +28,6 @@ public HoverEndpoint(
: base(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.CreateLogger<HoverEndpoint>())
{
_hoverService = hoverService ?? throw new ArgumentNullException(nameof(hoverService));
Debug.Assert(languageServerFeatureOptions.UseRazorCohostServer == false, "This endpoint should not be registered when using the Razor Cohost server.");
}

public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, VSInternalClientCapabilities clientCapabilities)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,13 @@ protected override ILspServices ConstructLspServices()
services.AddLifeCycleServices(this, _clientConnection, _lspServerActivationTracker);

services.AddDiagnosticServices();
services.AddSemanticTokensServices(featureOptions);
services.AddSemanticTokensServices();
services.AddDocumentManagementServices(featureOptions);
services.AddCompletionServices(featureOptions);
services.AddFormattingServices();
services.AddCodeActionsServices();
services.AddOptionsServices(_lspOptions);
services.AddHoverServices(featureOptions);
services.AddHoverServices();
services.AddTextDocumentServices();

// Auto insert
Expand Down Expand Up @@ -183,11 +183,8 @@ static void AddHandlers(IServiceCollection services, LanguageServerFeatureOption
services.AddHandler<RazorBreakpointSpanEndpoint>();
services.AddHandler<RazorProximityExpressionsEndpoint>();

if (!featureOptions.UseRazorCohostServer)
{
services.AddHandlerWithCapabilities<DocumentColorEndpoint>();
services.AddSingleton<IDocumentColorService, DocumentColorService>();
}
services.AddHandlerWithCapabilities<DocumentColorEndpoint>();
services.AddSingleton<IDocumentColorService, DocumentColorService>();

services.AddHandler<ColorPresentationEndpoint>();
services.AddHandlerWithCapabilities<FoldingRangeEndpoint>();
Expand All @@ -197,13 +194,10 @@ static void AddHandlers(IServiceCollection services, LanguageServerFeatureOption
services.AddHandlerWithCapabilities<DocumentSymbolEndpoint>();
services.AddHandlerWithCapabilities<MapCodeEndpoint>();

if (!featureOptions.UseRazorCohostServer)
{
services.AddSingleton<IInlayHintService, InlayHintService>();
services.AddSingleton<IInlayHintService, InlayHintService>();

services.AddHandlerWithCapabilities<InlayHintEndpoint>();
services.AddHandler<InlayHintResolveEndpoint>();
}
services.AddHandlerWithCapabilities<InlayHintEndpoint>();
services.AddHandler<InlayHintResolveEndpoint>();
}
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 3d36512

Please sign in to comment.