A clean error list is a good error list.
This commit is contained in:
David Wengier 2024-09-09 18:58:19 +10:00 коммит произвёл GitHub
Родитель b0cd007c25 d1857851fb
Коммит 308833d8b8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
11 изменённых файлов: 11 добавлений и 34 удалений

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

@ -39,6 +39,9 @@ dotnet_separate_import_directive_groups = false
# IDE0005 - Remove unnecessary imports
dotnet_diagnostic.IDE0005.severity = warning
# IDE0052 - Private member can be removed
dotnet_diagnostic.IDE0052.severity = warning
# IDE0046: If expression can be simplified
dotnet_style_prefer_conditional_expression_over_return = false:silent

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

@ -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;

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

@ -6,7 +6,6 @@ using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Razor.Threading;
using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost;
using Microsoft.CodeAnalysis.Razor.Remote;
using Microsoft.VisualStudio.LanguageServer.Protocol;
namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost;
@ -15,14 +14,9 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost;
[Shared]
[CohostEndpoint(VSInternalMethods.WorkspaceSpellCheckableRangesName)]
[ExportCohostStatelessLspService(typeof(CohostWorkspaceSpellCheckEndpoint))]
[method: ImportingConstructor]
#pragma warning restore RS0030 // Do not use banned APIs
internal sealed class CohostWorkspaceSpellCheckEndpoint(
IRemoteServiceInvoker remoteServiceInvoker)
: AbstractRazorCohostRequestHandler<VSInternalWorkspaceSpellCheckableParams, VSInternalWorkspaceSpellCheckableReport[]>
internal sealed class CohostWorkspaceSpellCheckEndpoint : AbstractRazorCohostRequestHandler<VSInternalWorkspaceSpellCheckableParams, VSInternalWorkspaceSpellCheckableReport[]>
{
private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker;
protected override bool MutatesSolutionState => false;
protected override bool RequiresLSPSolution => 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()
{

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

@ -16,7 +16,9 @@ namespace Microsoft.AspNetCore.Razor.PooledObjects;
internal ref struct PooledHashSet<T>
{
private readonly ObjectPool<HashSet<T>> _pool;
#pragma warning disable IDE0052 // Used in NET only code below. Called API doesn't exist on framework.
private readonly int? _capacity;
#pragma warning restore IDE0052
private HashSet<T>? _set;
public PooledHashSet()