This commit is contained in:
David Wengier 2024-09-06 15:49:49 +10:00
Родитель 9678b91d4d
Коммит 34421760e7
8 изменённых файлов: 5 добавлений и 27 удалений

Просмотреть файл

@ -31,14 +31,12 @@ internal class OnAutoInsertEndpoint(
IClientConnection clientConnection,
IAutoInsertService autoInsertService,
RazorLSPOptionsMonitor optionsMonitor,
IAdhocWorkspaceFactory workspaceFactory,
IRazorFormattingService razorFormattingService,
ILoggerFactory loggerFactory)
: AbstractRazorDelegatingEndpoint<VSInternalDocumentOnAutoInsertParams, VSInternalDocumentOnAutoInsertResponseItem?>(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger<OnAutoInsertEndpoint>()), ICapabilitiesProvider
{
private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions;
private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor;
private readonly IAdhocWorkspaceFactory _workspaceFactory = workspaceFactory;
private readonly IRazorFormattingService _razorFormattingService = razorFormattingService;
private readonly IAutoInsertService _autoInsertService = autoInsertService;

Просмотреть файл

@ -8,7 +8,6 @@ using Microsoft.AspNetCore.Razor.Language;
using Microsoft.CodeAnalysis.ExternalAccess.Razor;
using Microsoft.CodeAnalysis.Razor.Protocol.DocumentSymbols;
using Microsoft.CodeAnalysis.Razor.Remote;
using Microsoft.CodeAnalysis.Razor.Workspaces;
using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using ExternalHandlers = Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.Handlers;
@ -24,7 +23,6 @@ internal sealed partial class RemoteDocumentSymbolService(in ServiceArgs args) :
}
private readonly IDocumentSymbolService _documentSymbolService = args.ExportProvider.GetExportedValue<IDocumentSymbolService>();
private readonly IFilePathService _filePathService = args.ExportProvider.GetExportedValue<IFilePathService>();
public ValueTask<SumType<DocumentSymbol[], SymbolInformation[]>?> GetDocumentSymbolsAsync(JsonSerializableRazorPinnedSolutionInfoWrapper solutionInfo, JsonSerializableDocumentId razorDocumentId, bool useHierarchicalSymbols, CancellationToken cancellationToken)
=> RunServiceAsync(

Просмотреть файл

@ -44,7 +44,6 @@ internal class CohostOnAutoInsertEndpoint(
{
private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker;
private readonly IClientSettingsManager _clientSettingsManager = clientSettingsManager;
private readonly IEnumerable<IOnAutoInsertTriggerCharacterProvider> _onAutoInsertTriggerCharacterProviders = onAutoInsertTriggerCharacterProviders;
private readonly IHtmlDocumentSynchronizer _htmlDocumentSynchronizer = htmlDocumentSynchronizer;
private readonly LSPRequestInvoker _requestInvoker = requestInvoker;
private readonly ILogger _logger = loggerFactory.GetOrCreateLogger<CohostOnAutoInsertEndpoint>();
@ -55,12 +54,12 @@ internal class CohostOnAutoInsertEndpoint(
{
var providerTriggerCharacters = onAutoInsertTriggerCharacterProviders.Select((provider) => provider.TriggerCharacter).Distinct();
ImmutableArray<string> _triggerCharacters = [
ImmutableArray<string> triggerCharacters = [
.. providerTriggerCharacters,
.. AutoInsertService.HtmlAllowedAutoInsertTriggerCharacters,
.. AutoInsertService.CSharpAllowedAutoInsertTriggerCharacters ];
return _triggerCharacters;
return triggerCharacters;
}
protected override bool MutatesSolutionState => false;

Просмотреть файл

@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Razor;
using Microsoft.AspNetCore.Razor.LanguageServer.Hosting;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost;
using Microsoft.CodeAnalysis.Razor.Logging;
using Microsoft.CodeAnalysis.Razor.Remote;
using Microsoft.CodeAnalysis.Razor.Workspaces;
using Microsoft.VisualStudio.LanguageServer.ContainedLanguage;
@ -34,15 +33,13 @@ internal class CohostSignatureHelpEndpoint(
IRemoteServiceInvoker remoteServiceInvoker,
IClientSettingsManager clientSettingsManager,
IHtmlDocumentSynchronizer htmlDocumentSynchronizer,
LSPRequestInvoker requestInvoker,
ILoggerFactory loggerFactory)
LSPRequestInvoker requestInvoker)
: AbstractRazorCohostDocumentRequestHandler<SignatureHelpParams, SumType<SignatureHelp, RoslynSignatureHelp>?>, IDynamicRegistrationProvider
{
private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker;
private readonly IClientSettingsManager _clientSettingsManager = clientSettingsManager;
private readonly IHtmlDocumentSynchronizer _htmlDocumentSynchronizer = htmlDocumentSynchronizer;
private readonly LSPRequestInvoker _requestInvoker = requestInvoker;
private readonly ILogger _logger = loggerFactory.GetOrCreateLogger<CohostFoldingRangeEndpoint>();
protected override bool MutatesSolutionState => false;

Просмотреть файл

@ -29,8 +29,6 @@ internal class SnippetService
private readonly IAdvancedSettingsStorage _advancedSettingsStorage;
private IVsExpansionManager? _vsExpansionManager;
private readonly object _cacheGuard = new();
private static readonly Guid s_CSharpLanguageId = new("694dd9b6-b865-4c5b-ad85-86356e9c88dc");
private static readonly Guid s_HtmlLanguageId = new("9bbfd173-9770-47dc-b191-651b7ff493cd");

Просмотреть файл

@ -4,7 +4,6 @@
using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.LanguageServer.Formatting;
using Microsoft.AspNetCore.Razor.LanguageServer.Test;
using Microsoft.CodeAnalysis.Razor.AutoInsert;
using Microsoft.CodeAnalysis.Razor.ProjectSystem;
using Microsoft.CodeAnalysis.Testing;
@ -34,7 +33,6 @@ public partial class OnAutoInsertEndpointTest
languageServer,
new AutoInsertService([insertProvider]),
optionsMonitor,
TestAdhocWorkspaceFactory.Instance,
formattingService,
LoggerFactory);
var @params = new VSInternalDocumentOnAutoInsertParams()
@ -84,7 +82,6 @@ public partial class OnAutoInsertEndpointTest
languageServer,
new AutoInsertService([insertProvider1, insertProvider2]),
optionsMonitor,
TestAdhocWorkspaceFactory.Instance,
formattingService,
LoggerFactory);
var @params = new VSInternalDocumentOnAutoInsertParams()
@ -137,7 +134,6 @@ public partial class OnAutoInsertEndpointTest
languageServer,
new AutoInsertService([insertProvider1, insertProvider2]),
optionsMonitor,
TestAdhocWorkspaceFactory.Instance,
formattingService,
LoggerFactory);
var @params = new VSInternalDocumentOnAutoInsertParams()
@ -182,7 +178,6 @@ public partial class OnAutoInsertEndpointTest
languageServer,
new AutoInsertService([insertProvider]),
optionsMonitor,
TestAdhocWorkspaceFactory.Instance,
formattingService,
LoggerFactory);
var @params = new VSInternalDocumentOnAutoInsertParams()
@ -225,7 +220,6 @@ public partial class OnAutoInsertEndpointTest
languageServer,
new AutoInsertService([insertProvider]),
optionsMonitor,
TestAdhocWorkspaceFactory.Instance,
formattingService,
LoggerFactory);
var @params = new VSInternalDocumentOnAutoInsertParams()
@ -266,7 +260,6 @@ public partial class OnAutoInsertEndpointTest
languageServer,
new AutoInsertService([insertProvider]),
optionsMonitor,
TestAdhocWorkspaceFactory.Instance,
formattingService,
LoggerFactory);
var @params = new VSInternalDocumentOnAutoInsertParams()
@ -412,7 +405,6 @@ public partial class OnAutoInsertEndpointTest
languageServer,
new AutoInsertService([insertProvider]),
optionsMonitor,
TestAdhocWorkspaceFactory.Instance,
formattingService,
LoggerFactory);

Просмотреть файл

@ -5,7 +5,6 @@ using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.LanguageServer.Test;
using Microsoft.CodeAnalysis.Razor.AutoInsert;
using Microsoft.VisualStudio.LanguageServer.Protocol;
using Xunit;
@ -34,7 +33,6 @@ public partial class OnAutoInsertEndpointTest(ITestOutputHelper testOutput) : Si
languageServer,
autoInsertService,
optionsMonitor,
TestAdhocWorkspaceFactory.Instance,
null!,
LoggerFactory);
var @params = new VSInternalDocumentOnAutoInsertParams()
@ -76,7 +74,6 @@ public partial class OnAutoInsertEndpointTest(ITestOutputHelper testOutput) : Si
languageServer,
new AutoInsertService([insertProvider]),
optionsMonitor,
TestAdhocWorkspaceFactory.Instance,
null!,
LoggerFactory);
var uri = new Uri("file://path/test.razor");
@ -120,7 +117,6 @@ public partial class OnAutoInsertEndpointTest(ITestOutputHelper testOutput) : Si
languageServer,
new AutoInsertService([insertProvider]),
optionsMonitor,
TestAdhocWorkspaceFactory.Instance,
razorFormattingService: null!,
LoggerFactory);
var @params = new VSInternalDocumentOnAutoInsertParams()
@ -161,7 +157,7 @@ public partial class OnAutoInsertEndpointTest(ITestOutputHelper testOutput) : Si
DocumentMappingService,
languageServer,
new AutoInsertService([insertProvider]),
optionsMonitor, TestAdhocWorkspaceFactory.Instance,
optionsMonitor,
razorFormattingService: null!,
LoggerFactory);
var @params = new VSInternalDocumentOnAutoInsertParams()

Просмотреть файл

@ -99,7 +99,7 @@ public class CohostSignatureHelpEndpointTest(ITestOutputHelper testOutputHelper)
var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentSignatureHelpName, null)]);
var endpoint = new CohostSignatureHelpEndpoint(RemoteServiceInvoker, clientSettingsManager, TestHtmlDocumentSynchronizer.Instance, requestInvoker, LoggerFactory);
var endpoint = new CohostSignatureHelpEndpoint(RemoteServiceInvoker, clientSettingsManager, TestHtmlDocumentSynchronizer.Instance, requestInvoker);
var signatureHelpContext = new SignatureHelpContext()
{