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

Remove cohost endpoints #10035

Merged
merged 1 commit into from
Mar 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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