From 5b022226813c8f8af240c84b2b0e4b236c350afb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9rald=20Barr=C3=A9?= Date: Mon, 21 Feb 2022 20:26:03 -0500 Subject: [PATCH 001/131] Add support for yield return to CompleteStatementCommandHandler --- .../CompleteStatementCommandHandler.cs | 1 + ...arpCompleteStatementCommandHandlerTests.cs | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/EditorFeatures/CSharp/CompleteStatement/CompleteStatementCommandHandler.cs b/src/EditorFeatures/CSharp/CompleteStatement/CompleteStatementCommandHandler.cs index 81f053ad3f23d..2819f320b9962 100644 --- a/src/EditorFeatures/CSharp/CompleteStatement/CompleteStatementCommandHandler.cs +++ b/src/EditorFeatures/CSharp/CompleteStatement/CompleteStatementCommandHandler.cs @@ -334,6 +334,7 @@ private static bool TryGetCaretPositionToMove(SyntaxNode statementNode, Snapshot case SyntaxKind.GotoCaseStatement: case SyntaxKind.LocalDeclarationStatement: case SyntaxKind.ReturnStatement: + case SyntaxKind.YieldReturnStatement: case SyntaxKind.ThrowStatement: case SyntaxKind.FieldDeclaration: case SyntaxKind.DelegateDeclaration: diff --git a/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs b/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs index 2cbd4e5a2ac15..80f6a31a6fe8d 100644 --- a/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs +++ b/src/EditorFeatures/CSharpTest/CompleteStatement/CSharpCompleteStatementCommandHandlerTests.cs @@ -4114,6 +4114,29 @@ void M($$) VerifyNoSpecialSemicolonHandling(code); } + [WorkItem(54709, "https://github.com/dotnet/roslyn/issues/54709")] + [WpfFact, Trait(Traits.Feature, Traits.Features.CompleteStatement)] + public void YieldReturn() + { + var code = @" +class D +{ + private static IEnumerable M() + { + yield return GetNumber($$) + } +}"; + var expected = @" +class D +{ + private static IEnumerable M() + { + yield return GetNumber();$$ + } +}"; + VerifyTypingSemicolon(code, expected); + } + [WorkItem(917499, "https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems/edit/917499")] [WpfTheory, Trait(Traits.Feature, Traits.Features.CompleteStatement)] [InlineData("/$$* comments */")] From 494ef047503e729fda923542c13c978e303ee755 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 16 Mar 2022 14:41:24 -0700 Subject: [PATCH 002/131] Move more package initialization to BG. --- .../Diagnostics/DiagnosticProgressReporter.cs | 32 ++++++++-------- .../IVisualStudioDiagnosticAnalyzerService.cs | 6 ++- .../VisualStudioDiagnosticAnalyzerService.cs | 7 ++-- .../Core/Def/IAnalyzerNodeSetup.cs | 6 ++- ...tudioMetadataAsSourceFileSupportService.cs | 21 ++++++---- .../MiscellaneousFilesWorkspace.cs | 34 ++++++++++------- .../RuleSets/RuleSetEventHandler.cs | 3 +- .../VisualStudioAddSolutionItemService.cs | 6 +-- src/VisualStudio/Core/Def/RoslynPackage.cs | 38 +++++++++---------- .../SyncNamespacesCommandHandler.cs | 13 +++++-- ...StudioDiagnosticListTableCommandHandler.cs | 20 +++++++--- .../RemoveUnusedReferencesCommandHandler.cs | 21 ++++++---- .../SolutionExplorer/AnalyzerItemTracker.cs | 33 +++------------- .../SolutionExplorer/AnalyzerNodeSetup.cs | 11 ++++-- .../AnalyzersCommandHandler.cs | 5 ++- 15 files changed, 142 insertions(+), 114 deletions(-) diff --git a/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs b/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs index 0e53c1bd6904d..bc9995d927682 100644 --- a/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs +++ b/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs @@ -6,9 +6,9 @@ using System.ComponentModel.Composition; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.SolutionCrawler; +using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.TaskStatusCenter; using Roslyn.Utilities; @@ -18,9 +18,13 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Diagnostics internal sealed class TaskCenterSolutionAnalysisProgressReporter { private static readonly TimeSpan s_minimumInterval = TimeSpan.FromMilliseconds(200); + private static readonly TaskHandlerOptions _options = new() + { + Title = ServicesVSResources.Running_low_priority_background_processes, + ActionsAfterCompletion = CompletionActions.None + }; - private readonly IVsTaskStatusCenterService _taskCenterService; - private readonly TaskHandlerOptions _options; + private IVsTaskStatusCenterService? _taskCenterService; #region Fields protected by _lock @@ -29,6 +33,7 @@ internal sealed class TaskCenterSolutionAnalysisProgressReporter /// report UI changes concurrently. /// private readonly object _lock = new(); + private readonly VisualStudioWorkspace _workspace; /// /// Task used to trigger throttled UI updates in an interval @@ -79,20 +84,17 @@ internal sealed class TaskCenterSolutionAnalysisProgressReporter [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public TaskCenterSolutionAnalysisProgressReporter( - SVsTaskStatusCenterService taskStatusCenterService, - IDiagnosticService diagnosticService, - VisualStudioWorkspace workspace) + public TaskCenterSolutionAnalysisProgressReporter(VisualStudioWorkspace workspace) { - _taskCenterService = (IVsTaskStatusCenterService)taskStatusCenterService; - _options = new TaskHandlerOptions() - { - Title = ServicesVSResources.Running_low_priority_background_processes, - ActionsAfterCompletion = CompletionActions.None - }; + _workspace = workspace; + } + + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) + { + _taskCenterService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); - var crawlerService = workspace.Services.GetRequiredService(); - var reporter = crawlerService.GetProgressReporter(workspace); + var crawlerService = _workspace.Services.GetRequiredService(); + var reporter = crawlerService.GetProgressReporter(_workspace); if (reporter.InProgress) { diff --git a/src/VisualStudio/Core/Def/Diagnostics/IVisualStudioDiagnosticAnalyzerService.cs b/src/VisualStudio/Core/Def/Diagnostics/IVisualStudioDiagnosticAnalyzerService.cs index cde726c388d86..14912beeb9c16 100644 --- a/src/VisualStudio/Core/Def/Diagnostics/IVisualStudioDiagnosticAnalyzerService.cs +++ b/src/VisualStudio/Core/Def/Diagnostics/IVisualStudioDiagnosticAnalyzerService.cs @@ -2,9 +2,11 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; using Microsoft.CodeAnalysis; +using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; namespace Microsoft.VisualStudio.LanguageServices.Implementation.Diagnostics @@ -34,6 +36,6 @@ internal interface IVisualStudioDiagnosticAnalyzerService /// /// Initializes the service. /// - void Initialize(IServiceProvider serviceProvider); + Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken); } } diff --git a/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs b/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs index a54b89aef1dde..e6e1a14815e45 100644 --- a/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs +++ b/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs @@ -65,14 +65,15 @@ public VisualStudioDiagnosticAnalyzerService( _globalOptions = globalOptions; } - public void Initialize(IServiceProvider serviceProvider) + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - _serviceProvider = serviceProvider; + _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Run Code Analysis" menu command for CPS based managed projects. - var menuCommandService = (IMenuCommandService)_serviceProvider.GetService(typeof(IMenuCommandService)); + var menuCommandService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); if (menuCommandService != null) { + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); VisualStudioCommandHandlerHelpers.AddCommand(menuCommandService, RunCodeAnalysisForSelectedProjectCommandId, VSConstants.VSStd2K, OnRunCodeAnalysisForSelectedProject, OnRunCodeAnalysisForSelectedProjectStatus); VisualStudioCommandHandlerHelpers.AddCommand(menuCommandService, ID.RoslynCommands.RunCodeAnalysisForProject, Guids.RoslynGroupId, OnRunCodeAnalysisForSelectedProject, OnRunCodeAnalysisForSelectedProjectStatus); VisualStudioCommandHandlerHelpers.AddCommand(menuCommandService, ID.RoslynCommands.AnalysisScopeDefault, Guids.RoslynGroupId, OnSetAnalysisScopeDefault, OnSetAnalysisScopeDefaultStatus); diff --git a/src/VisualStudio/Core/Def/IAnalyzerNodeSetup.cs b/src/VisualStudio/Core/Def/IAnalyzerNodeSetup.cs index 773de549137f4..8dbac5b13a673 100644 --- a/src/VisualStudio/Core/Def/IAnalyzerNodeSetup.cs +++ b/src/VisualStudio/Core/Def/IAnalyzerNodeSetup.cs @@ -4,7 +4,9 @@ #nullable disable -using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.VisualStudio.Shell; namespace Microsoft.VisualStudio.LanguageServices { @@ -13,7 +15,7 @@ namespace Microsoft.VisualStudio.LanguageServices /// internal interface IAnalyzerNodeSetup { - void Initialize(IServiceProvider serviceProvider); + Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken); void Unregister(); } } diff --git a/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs b/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs index fb0c644ca17c1..d9abf55bd9665 100644 --- a/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs +++ b/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs @@ -6,6 +6,9 @@ using System; using System.ComponentModel.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.MetadataAsSource; using Microsoft.VisualStudio.Shell; @@ -16,20 +19,24 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation [Export(typeof(VisualStudioMetadataAsSourceFileSupportService))] internal sealed class VisualStudioMetadataAsSourceFileSupportService : IVsSolutionEvents { + private readonly IThreadingContext _threadingContext; private readonly IMetadataAsSourceFileService _metadataAsSourceFileService; -#pragma warning disable IDE0052 // Remove unread private members - Used to store the AdviseSolutionEvents cookie. - private readonly uint _eventCookie; -#pragma warning restore IDE0052 // Remove unread private members - [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public VisualStudioMetadataAsSourceFileSupportService(SVsServiceProvider serviceProvider, IMetadataAsSourceFileService metadataAsSourceFileService) + public VisualStudioMetadataAsSourceFileSupportService( + IThreadingContext threadingContext, + IMetadataAsSourceFileService metadataAsSourceFileService) { + _threadingContext = threadingContext; _metadataAsSourceFileService = metadataAsSourceFileService; + } - var solution = (IVsSolution)serviceProvider.GetService(typeof(SVsSolution)); - ErrorHandler.ThrowOnFailure(solution.AdviseSolutionEvents(this, out _eventCookie)); + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) + { + var solution = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + ErrorHandler.ThrowOnFailure(solution.AdviseSolutionEvents(this, out _)); } public int OnAfterCloseSolution(object pUnkReserved) diff --git a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs index c4a3abf31ebce..b7f14fe8417e6 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs @@ -12,6 +12,8 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Threading; +using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Features.Workspaces; @@ -33,10 +35,12 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem [Export(typeof(MiscellaneousFilesWorkspace))] internal sealed partial class MiscellaneousFilesWorkspace : Workspace, IRunningDocumentTableEventListener { + private readonly IThreadingContext _threadingContext; + private readonly IVsEditorAdaptersFactoryService _editorAdaptersFactoryService; private readonly IMetadataAsSourceFileService _fileTrackingMetadataAsSourceService; - private readonly Lazy _lazyTextManager; - private readonly RunningDocumentTableEventTracker _runningDocumentTableEventTracker; + private IVsTextManager _textManager; + private RunningDocumentTableEventTracker _runningDocumentTableEventTracker; private readonly Dictionary _languageInformationByLanguageGuid = new(); @@ -62,25 +66,29 @@ public MiscellaneousFilesWorkspace( IThreadingContext threadingContext, IVsEditorAdaptersFactoryService editorAdaptersFactoryService, IMetadataAsSourceFileService fileTrackingMetadataAsSourceService, - VisualStudioWorkspace visualStudioWorkspace, - SVsServiceProvider serviceProvider) + VisualStudioWorkspace visualStudioWorkspace) : base(visualStudioWorkspace.Services.HostServices, WorkspaceKind.MiscellaneousFiles) { _foregroundThreadAffinitization = new ForegroundThreadAffinitizedObject(threadingContext, assertIsForeground: false); + _threadingContext = threadingContext; + _editorAdaptersFactoryService = editorAdaptersFactoryService; _fileTrackingMetadataAsSourceService = fileTrackingMetadataAsSourceService; - _lazyTextManager = new Lazy(() => - { - _foregroundThreadAffinitization.AssertIsForeground(); - return (IVsTextManager)serviceProvider.GetService(typeof(SVsTextManager)); - }); - - var runningDocumentTable = (IVsRunningDocumentTable)serviceProvider.GetService(typeof(SVsRunningDocumentTable)); - _runningDocumentTableEventTracker = new RunningDocumentTableEventTracker(threadingContext, editorAdaptersFactoryService, runningDocumentTable, this); _metadataReferences = ImmutableArray.CreateRange(CreateMetadataReferences()); } + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) + { + _textManager = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + var runningDocumentTable = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + + _runningDocumentTableEventTracker = new RunningDocumentTableEventTracker( + _threadingContext, _editorAdaptersFactoryService, runningDocumentTable, this); + } + void IRunningDocumentTableEventListener.OnOpenDocument(string moniker, ITextBuffer textBuffer, IVsHierarchy _, IVsWindowFrame __) => TrackOpenedDocument(moniker, textBuffer); void IRunningDocumentTableEventListener.OnCloseDocument(string moniker) => TryUntrackClosingDocument(moniker); @@ -113,7 +121,7 @@ private LanguageInformation TryGetLanguageInformation(string filename) { LanguageInformation languageInformation = null; - if (ErrorHandler.Succeeded(_lazyTextManager.Value.MapFilenameToLanguageSID(filename, out var fileLanguageGuid))) + if (ErrorHandler.Succeeded(_textManager.MapFilenameToLanguageSID(filename, out var fileLanguageGuid))) { _languageInformationByLanguageGuid.TryGetValue(fileLanguageGuid, out languageInformation); } diff --git a/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs b/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs index aa3a08a88213c..e79de55df864a 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs @@ -10,6 +10,7 @@ using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.VisualStudio.Shell; @@ -34,7 +35,7 @@ public RuleSetEventHandler( _serviceProvider = serviceProvider; } - public void Register() + public async Task RegisterAsync(CancellationToken cancellationToken) { if (!_eventsHookedUp) { diff --git a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs index 4f4b86b9a9e43..681a1d7a82666 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs @@ -41,10 +41,10 @@ public VisualStudioAddSolutionItemService( _fileChangeTrackers = new ConcurrentDictionary(StringComparer.OrdinalIgnoreCase); } - public void Initialize(IServiceProvider serviceProvider) + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) { - _dte = (DTE)serviceProvider.GetService(typeof(DTE)); - _fileChangeService = (IVsFileChangeEx)serviceProvider.GetService(typeof(SVsFileChangeEx)); + _dte = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + _fileChangeService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); } public void TrackFilePathAndAddSolutionItemWhenFileCreated(string filePath) diff --git a/src/VisualStudio/Core/Def/RoslynPackage.cs b/src/VisualStudio/Core/Def/RoslynPackage.cs index 1c0fae5a5d8f0..e276387dd4e07 100644 --- a/src/VisualStudio/Core/Def/RoslynPackage.cs +++ b/src/VisualStudio/Core/Def/RoslynPackage.cs @@ -191,34 +191,34 @@ private void InitializeColors() protected override async Task LoadComponentsAsync(CancellationToken cancellationToken) { - await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + await TaskScheduler.Default; - await GetServiceAsync(typeof(SVsTaskStatusCenterService)).ConfigureAwait(true); - await GetServiceAsync(typeof(SVsErrorList)).ConfigureAwait(true); - await GetServiceAsync(typeof(SVsSolution)).ConfigureAwait(true); - await GetServiceAsync(typeof(SVsShell)).ConfigureAwait(true); - await GetServiceAsync(typeof(SVsRunningDocumentTable)).ConfigureAwait(true); - await GetServiceAsync(typeof(SVsTextManager)).ConfigureAwait(true); + await GetServiceAsync(typeof(SVsTaskStatusCenterService)).ConfigureAwait(false); + await GetServiceAsync(typeof(SVsErrorList)).ConfigureAwait(false); + await GetServiceAsync(typeof(SVsSolution)).ConfigureAwait(false); + await GetServiceAsync(typeof(SVsShell)).ConfigureAwait(false); + await GetServiceAsync(typeof(SVsRunningDocumentTable)).ConfigureAwait(false); + await GetServiceAsync(typeof(SVsTextManager)).ConfigureAwait(false); // we need to load it as early as possible since we can have errors from // package from each language very early - this.ComponentModel.GetService(); - this.ComponentModel.GetService().Initialize(this); + await this.ComponentModel.GetService().InitializeAsync(this).ConfigureAwait(false); + await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); - this.ComponentModel.GetService(); + await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); // The misc files workspace needs to be loaded on the UI thread. This way it will have // the appropriate task scheduler to report events on. this.ComponentModel.GetService(); // Load and initialize the add solution item service so ConfigurationUpdater can use it to create editorconfig files. - this.ComponentModel.GetService().Initialize(this); + await this.ComponentModel.GetService().InitializeAsync(this).ConfigureAwait(false); - this.ComponentModel.GetService().Initialize(this); - this.ComponentModel.GetService().Initialize(this); - this.ComponentModel.GetService().Initialize(this); + await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); + await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); + await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); - LoadAnalyzerNodeComponents(); + await LoadAnalyzerNodeComponentsAsync(cancellationToken).ConfigureAwait(false); LoadComponentsBackgroundAsync(cancellationToken).Forget(); } @@ -320,15 +320,13 @@ private void DisposeVisualStudioServices() } } - private void LoadAnalyzerNodeComponents() + private async Task LoadAnalyzerNodeComponentsAsync(CancellationToken cancellationToken) { - this.ComponentModel.GetService().Initialize(this); + await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); _ruleSetEventHandler = this.ComponentModel.GetService(); if (_ruleSetEventHandler != null) - { - _ruleSetEventHandler.Register(); - } + await _ruleSetEventHandler.RegisterAsync(cancellationToken).ConfigureAwait(false); } private void UnregisterAnalyzerTracker() diff --git a/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs b/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs index 431282f6f70d9..60f398f75e12c 100644 --- a/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs +++ b/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs @@ -7,8 +7,11 @@ using System.ComponentModel.Design; using System.Composition; using System.Linq; +using System.Threading; +using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeActions; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; @@ -26,6 +29,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.SyncNamespaces internal sealed class SyncNamespacesCommandHandler { private readonly VisualStudioWorkspace _workspace; + private readonly IThreadingContext _threadingContext; private readonly IUIThreadOperationExecutor _threadOperationExecutor; private readonly IGlobalOptionService _globalOptions; private IServiceProvider? _serviceProvider; @@ -33,25 +37,28 @@ internal sealed class SyncNamespacesCommandHandler [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public SyncNamespacesCommandHandler( + IThreadingContext threadingContext, IUIThreadOperationExecutor threadOperationExecutor, VisualStudioWorkspace workspace, IGlobalOptionService globalOptions) { + _threadingContext = threadingContext; _threadOperationExecutor = threadOperationExecutor; _workspace = workspace; _globalOptions = globalOptions; } - public void Initialize(IServiceProvider serviceProvider) + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { Contract.ThrowIfNull(serviceProvider); - _serviceProvider = serviceProvider; + _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Remove Unused References" menu command for CPS based managed projects. - var menuCommandService = (IMenuCommandService)_serviceProvider.GetService(typeof(IMenuCommandService)); + var menuCommandService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); if (menuCommandService != null) { + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); VisualStudioCommandHandlerHelpers.AddCommand(menuCommandService, ID.RoslynCommands.SyncNamespaces, Guids.RoslynGroupId, OnSyncNamespacesForSelectedProject, OnSyncNamespacesForSelectedProjectStatus); } } diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs index 722578c8fa93a..8dc4983b31034 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis.CodeFixes.Suppression; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.Implementation; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Shared.Extensions; @@ -32,18 +33,21 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource [Export(typeof(VisualStudioDiagnosticListTableCommandHandler))] internal partial class VisualStudioDiagnosticListTableCommandHandler { + private readonly IThreadingContext _threadingContext; private readonly VisualStudioWorkspace _workspace; private readonly VisualStudioSuppressionFixService _suppressionFixService; private readonly VisualStudioDiagnosticListSuppressionStateService _suppressionStateService; private readonly IUIThreadOperationExecutor _uiThreadOperationExecutor; private readonly IDiagnosticAnalyzerService _diagnosticService; private readonly ICodeActionEditHandlerService _editHandlerService; - private readonly IWpfTableControl? _tableControl; + + private IWpfTableControl? _tableControl; private readonly IAsynchronousOperationListener _listener; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioDiagnosticListTableCommandHandler( + IThreadingContext threadingContext, SVsServiceProvider serviceProvider, VisualStudioWorkspace workspace, IVisualStudioSuppressionFixService suppressionFixService, @@ -53,24 +57,26 @@ public VisualStudioDiagnosticListTableCommandHandler( ICodeActionEditHandlerService editHandlerService, IAsynchronousOperationListenerProvider listenerProvider) { + _threadingContext = threadingContext; _workspace = workspace; _suppressionFixService = (VisualStudioSuppressionFixService)suppressionFixService; _suppressionStateService = (VisualStudioDiagnosticListSuppressionStateService)suppressionStateService; _uiThreadOperationExecutor = uiThreadOperationExecutor; _diagnosticService = diagnosticService; _editHandlerService = editHandlerService; - - var errorList = serviceProvider.GetService(typeof(SVsErrorList)) as IErrorList; - _tableControl = errorList?.TableControl; _listener = listenerProvider.GetListener(FeatureAttribute.ErrorList); } - public void Initialize(IServiceProvider serviceProvider) + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { + var errorList = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + _tableControl = errorList?.TableControl; + // Add command handlers for bulk suppression commands. - var menuCommandService = (IMenuCommandService)serviceProvider.GetService(typeof(IMenuCommandService)); + var menuCommandService = (IMenuCommandService?)await serviceProvider.GetServiceAsync(typeof(IMenuCommandService)).ConfigureAwait(false); if (menuCommandService != null) { + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); AddErrorListSetSeverityMenuHandlers(menuCommandService); // The Add/Remove suppression(s) have been moved to the VS code analysis layer, so we don't add the commands here. @@ -84,6 +90,8 @@ public void Initialize(IServiceProvider serviceProvider) private void AddErrorListSetSeverityMenuHandlers(IMenuCommandService menuCommandService) { + Contract.ThrowIfFalse(_threadingContext.HasMainThread); + AddCommand(menuCommandService, ID.RoslynCommands.ErrorListSetSeveritySubMenu, delegate { }, OnErrorListSetSeveritySubMenuStatus); // Severity menu items diff --git a/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs b/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs index 1fad69beb7021..14bcc3cd1ca61 100644 --- a/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs +++ b/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs @@ -9,8 +9,10 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; +using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Editor.Shared.Options; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.UnusedReferences; @@ -30,40 +32,43 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.UnusedReference internal sealed class RemoveUnusedReferencesCommandHandler { private const string ProjectAssetsFilePropertyName = "ProjectAssetsFile"; - - private readonly Lazy _lazyReferenceCleanupService; + private readonly IThreadingContext _threadingContext; private readonly RemoveUnusedReferencesDialogProvider _unusedReferenceDialogProvider; private readonly VisualStudioWorkspace _workspace; private readonly IGlobalOptionService _globalOptions; private readonly IUIThreadOperationExecutor _threadOperationExecutor; private IServiceProvider? _serviceProvider; + private IReferenceCleanupService ReferenceCleanupService + => _workspace.Services.GetRequiredService(); + [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public RemoveUnusedReferencesCommandHandler( + IThreadingContext threadingContext, RemoveUnusedReferencesDialogProvider unusedReferenceDialogProvider, IUIThreadOperationExecutor threadOperationExecutor, VisualStudioWorkspace workspace, IGlobalOptionService globalOptions) { + _threadingContext = threadingContext; _unusedReferenceDialogProvider = unusedReferenceDialogProvider; _threadOperationExecutor = threadOperationExecutor; _workspace = workspace; _globalOptions = globalOptions; - - _lazyReferenceCleanupService = new(() => workspace.Services.GetRequiredService()); } - public void Initialize(IServiceProvider serviceProvider) + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { Contract.ThrowIfNull(serviceProvider); - _serviceProvider = serviceProvider; + _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Remove Unused References" menu command for CPS based managed projects. - var menuCommandService = (IMenuCommandService)_serviceProvider.GetService(typeof(IMenuCommandService)); + var menuCommandService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); if (menuCommandService != null) { + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); VisualStudioCommandHandlerHelpers.AddCommand(menuCommandService, ID.RoslynCommands.RemoveUnusedReferences, Guids.RoslynGroupId, OnRemoveUnusedReferencesForSelectedProject, OnRemoveUnusedReferencesForSelectedProjectStatus); } } @@ -185,7 +190,7 @@ private ImmutableArray GetUnusedReferencesForProject(Solution s { var unusedReferences = ThreadHelper.JoinableTaskFactory.Run(async () => { - var projectReferences = await _lazyReferenceCleanupService.Value.GetProjectReferencesAsync(projectFilePath, cancellationToken).ConfigureAwait(true); + var projectReferences = await this.ReferenceCleanupService.GetProjectReferencesAsync(projectFilePath, cancellationToken).ConfigureAwait(true); var unusedReferenceAnalysisService = solution.Workspace.Services.GetRequiredService(); return await unusedReferenceAnalysisService.GetUnusedReferencesAsync(solution, projectFilePath, projectAssetsFile, projectReferences, cancellationToken).ConfigureAwait(true); }); diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs index d786d06ae5491..bcd8fb0bf165a 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs @@ -6,6 +6,7 @@ using System.Collections.Immutable; using System.ComponentModel.Composition; using System.Linq; +using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; @@ -20,7 +21,6 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplore [Export] internal class AnalyzerItemsTracker : IVsSelectionEvents { - private readonly IServiceProvider _serviceProvider; private IVsMonitorSelection? _vsMonitorSelection = null; private uint _selectionEventsCookie = 0; @@ -28,30 +28,19 @@ internal class AnalyzerItemsTracker : IVsSelectionEvents [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public AnalyzerItemsTracker( - [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) + public AnalyzerItemsTracker() { - _serviceProvider = serviceProvider; } - public void Register() + public async Task RegisterAsync(IAsyncServiceProvider serviceProvider) { - var vsMonitorSelection = GetMonitorSelection(); - - if (vsMonitorSelection != null) - { - vsMonitorSelection.AdviseSelectionEvents(this, out _selectionEventsCookie); - } + _vsMonitorSelection ??= await serviceProvider.GetServiceAsync().ConfigureAwait(false); + _vsMonitorSelection?.AdviseSelectionEvents(this, out _selectionEventsCookie); } public void Unregister() { - var vsMonitorSelection = GetMonitorSelection(); - - if (vsMonitorSelection != null) - { - vsMonitorSelection.UnadviseSelectionEvents(_selectionEventsCookie); - } + _vsMonitorSelection?.UnadviseSelectionEvents(_selectionEventsCookie); } public IVsHierarchy? SelectedHierarchy { get; private set; } @@ -132,15 +121,5 @@ private static object[] GetSelectedObjects(ISelectionContainer? selectionContain return selectedObjects; } - - private IVsMonitorSelection? GetMonitorSelection() - { - if (_vsMonitorSelection == null) - { - _vsMonitorSelection = _serviceProvider.GetService(typeof(SVsShellMonitorSelection)) as IVsMonitorSelection; - } - - return _vsMonitorSelection; - } } } diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs index fb752c36ba7ae..3b6e5e3026340 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs @@ -5,7 +5,10 @@ using System; using System.ComponentModel.Composition; using System.ComponentModel.Design; +using System.Threading; +using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.VisualStudio.Shell; namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplorer { @@ -23,10 +26,12 @@ public AnalyzerNodeSetup(AnalyzerItemsTracker analyzerTracker, AnalyzersCommandH _analyzerCommandHandler = analyzerCommandHandler; } - public void Initialize(IServiceProvider serviceProvider) + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - _analyzerTracker.Register(); - _analyzerCommandHandler.Initialize((IMenuCommandService)serviceProvider.GetService(typeof(IMenuCommandService))); + await _analyzerTracker.RegisterAsync(serviceProvider).ConfigureAwait(false); + await _analyzerCommandHandler.InitializeAsync( + await serviceProvider.GetServiceAsync().ConfigureAwait(false), + cancellationToken).ConfigureAwait(false); } public void Unregister() diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs index 9bb3f34a2df6b..a2f36a1e8df05 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs @@ -13,6 +13,7 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; +using System.Threading; using System.Threading.Tasks; using EnvDTE; using Microsoft.CodeAnalysis; @@ -94,10 +95,12 @@ public AnalyzersCommandHandler( /// /// Hook up the context menu handlers. /// - public void Initialize(IMenuCommandService menuCommandService) + public async Task InitializeAsync(IMenuCommandService menuCommandService, CancellationToken cancellationToken) { if (menuCommandService != null) { + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + // Analyzers folder context menu items _addMenuItem = AddCommandHandler(menuCommandService, ID.RoslynCommands.AddAnalyzer, AddAnalyzerHandler); _ = AddCommandHandler(menuCommandService, ID.RoslynCommands.OpenRuleSet, OpenRuleSetHandler); From 22d7247b40f26f2bbf53485297a95109f1686429 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 17 Mar 2022 17:38:47 -0700 Subject: [PATCH 003/131] Lint --- .../Def/Diagnostics/DiagnosticProgressReporter.cs | 2 ++ .../ProjectSystem/RuleSets/RuleSetEventHandler.cs | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs b/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs index bc9995d927682..49b7321a769c1 100644 --- a/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs +++ b/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs @@ -159,6 +159,8 @@ private void UpdateUI(ProgressData progressData) // Start the task center task if not already running. if (_taskHandler == null) { + Contract.ThrowIfNull(_taskCenterService); + // Register a new task handler to handle a new task center task. // Each task handler can only register one task, so we must create a new one each time we start. _taskHandler = _taskCenterService.PreRegister(_options, data: default); diff --git a/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs b/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs index e79de55df864a..dd97f6399c1fe 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs @@ -12,6 +12,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; @@ -23,6 +24,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.R [Export(typeof(RuleSetEventHandler))] internal sealed class RuleSetEventHandler : IVsTrackProjectDocumentsEvents2, IVsTrackProjectDocumentsEvents3, IVsTrackProjectDocumentsEvents4 { + private readonly IThreadingContext _threadingContext; private readonly IServiceProvider _serviceProvider; private bool _eventsHookedUp = false; private uint _cookie = 0; @@ -30,8 +32,10 @@ internal sealed class RuleSetEventHandler : IVsTrackProjectDocumentsEvents2, IVs [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public RuleSetEventHandler( + IThreadingContext threadingContext, [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider) { + _threadingContext = threadingContext; _serviceProvider = serviceProvider; } @@ -39,11 +43,14 @@ public async Task RegisterAsync(CancellationToken cancellationToken) { if (!_eventsHookedUp) { - var trackProjectDocuments = (IVsTrackProjectDocuments2)_serviceProvider.GetService(typeof(SVsTrackProjectDocuments)); + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - if (ErrorHandler.Succeeded(trackProjectDocuments.AdviseTrackProjectDocumentsEvents(this, out _cookie))) + if (!_eventsHookedUp) { - _eventsHookedUp = true; + var trackProjectDocuments = (IVsTrackProjectDocuments2)_serviceProvider.GetService(typeof(SVsTrackProjectDocuments)); + + if (ErrorHandler.Succeeded(trackProjectDocuments.AdviseTrackProjectDocumentsEvents(this, out _cookie))) + _eventsHookedUp = true; } } } From 306b35decf1db0a24b1e9214a33042d4e793bf7f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 17 Mar 2022 20:02:52 -0700 Subject: [PATCH 004/131] More cases --- ...sticListSuppressionStateServiceAccessor.cs | 2 -- src/VisualStudio/Core/Def/RoslynPackage.cs | 1 + ...osticTableControlEventProcessorProvider.cs | 4 ++-- ...ioDiagnosticListSuppressionStateService.cs | 21 ++++++++++++++----- ...StudioDiagnosticListTableCommandHandler.cs | 4 ++-- .../VisualStudioSuppressionFixService.cs | 4 ++-- 6 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/VisualStudio/Core/Def/ExternalAccess/LegacyCodeAnalysis/LegacyCodeAnalysisVisualStudioDiagnosticListSuppressionStateServiceAccessor.cs b/src/VisualStudio/Core/Def/ExternalAccess/LegacyCodeAnalysis/LegacyCodeAnalysisVisualStudioDiagnosticListSuppressionStateServiceAccessor.cs index 934560687eed9..05378f08b14f1 100644 --- a/src/VisualStudio/Core/Def/ExternalAccess/LegacyCodeAnalysis/LegacyCodeAnalysisVisualStudioDiagnosticListSuppressionStateServiceAccessor.cs +++ b/src/VisualStudio/Core/Def/ExternalAccess/LegacyCodeAnalysis/LegacyCodeAnalysisVisualStudioDiagnosticListSuppressionStateServiceAccessor.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Composition; using Microsoft.CodeAnalysis.ExternalAccess.LegacyCodeAnalysis.Api; diff --git a/src/VisualStudio/Core/Def/RoslynPackage.cs b/src/VisualStudio/Core/Def/RoslynPackage.cs index 819bb2fd9ac42..25264ef1ad2bd 100644 --- a/src/VisualStudio/Core/Def/RoslynPackage.cs +++ b/src/VisualStudio/Core/Def/RoslynPackage.cs @@ -204,6 +204,7 @@ protected override async Task LoadComponentsAsync(CancellationToken cancellation // package from each language very early await this.ComponentModel.GetService().InitializeAsync(this).ConfigureAwait(false); await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); + await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); diff --git a/src/VisualStudio/Core/Def/TableDataSource/DiagnosticTableControlEventProcessorProvider.cs b/src/VisualStudio/Core/Def/TableDataSource/DiagnosticTableControlEventProcessorProvider.cs index 6d3ebbe4577c9..9e00dbbe68ad9 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/DiagnosticTableControlEventProcessorProvider.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/DiagnosticTableControlEventProcessorProvider.cs @@ -24,9 +24,9 @@ internal partial class DiagnosticTableControlEventProcessorProvider : AbstractTa [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public DiagnosticTableControlEventProcessorProvider( - IVisualStudioDiagnosticListSuppressionStateService suppressionStateService) + VisualStudioDiagnosticListSuppressionStateService suppressionStateService) { - _suppressionStateService = (VisualStudioDiagnosticListSuppressionStateService)suppressionStateService; + _suppressionStateService = suppressionStateService; } protected override EventProcessor CreateEventProcessor() diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs index e34b66bd51341..0c3e101690c6a 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs @@ -13,6 +13,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CodeFixes.Suppression; using Microsoft.CodeAnalysis.Diagnostics; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; @@ -29,11 +30,14 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource /// Service to maintain information about the suppression state of specific set of items in the error list. /// [Export(typeof(IVisualStudioDiagnosticListSuppressionStateService))] + [Export(typeof(VisualStudioDiagnosticListSuppressionStateService))] internal class VisualStudioDiagnosticListSuppressionStateService : IVisualStudioDiagnosticListSuppressionStateService { + private readonly IThreadingContext _threadingContext; private readonly VisualStudioWorkspace _workspace; - private readonly IVsUIShell _shellService; - private readonly IWpfTableControl? _tableControl; + + private IVsUIShell? _shellService; + private IWpfTableControl? _tableControl; private int _selectedActiveItems; private int _selectedSuppressedItems; @@ -45,14 +49,21 @@ internal class VisualStudioDiagnosticListSuppressionStateService : IVisualStudio [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioDiagnosticListSuppressionStateService( - SVsServiceProvider serviceProvider, + IThreadingContext threadingContext, VisualStudioWorkspace workspace) { + _threadingContext = threadingContext; _workspace = workspace; - _shellService = (IVsUIShell)serviceProvider.GetService(typeof(SVsUIShell)); - var errorList = serviceProvider.GetService(typeof(SVsErrorList)) as IErrorList; + } + + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) + { + _shellService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + var errorList = await serviceProvider.GetServiceAsync(throwOnFailure: false).ConfigureAwait(false); _tableControl = errorList?.TableControl; + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + ClearState(); InitializeFromTableControlIfNeeded(); } diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs index 8dc4983b31034..e46001557b69d 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs @@ -51,7 +51,7 @@ public VisualStudioDiagnosticListTableCommandHandler( SVsServiceProvider serviceProvider, VisualStudioWorkspace workspace, IVisualStudioSuppressionFixService suppressionFixService, - IVisualStudioDiagnosticListSuppressionStateService suppressionStateService, + VisualStudioDiagnosticListSuppressionStateService suppressionStateService, IUIThreadOperationExecutor uiThreadOperationExecutor, IDiagnosticAnalyzerService diagnosticService, ICodeActionEditHandlerService editHandlerService, @@ -60,7 +60,7 @@ public VisualStudioDiagnosticListTableCommandHandler( _threadingContext = threadingContext; _workspace = workspace; _suppressionFixService = (VisualStudioSuppressionFixService)suppressionFixService; - _suppressionStateService = (VisualStudioDiagnosticListSuppressionStateService)suppressionStateService; + _suppressionStateService = suppressionStateService; _uiThreadOperationExecutor = uiThreadOperationExecutor; _diagnosticService = diagnosticService; _editHandlerService = editHandlerService; diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs index c0603edd00fbe..25e42d0db9d70 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs @@ -62,7 +62,7 @@ public VisualStudioSuppressionFixService( IDiagnosticAnalyzerService diagnosticService, ICodeFixService codeFixService, ICodeActionEditHandlerService editHandlerService, - IVisualStudioDiagnosticListSuppressionStateService suppressionStateService, + VisualStudioDiagnosticListSuppressionStateService suppressionStateService, IUIThreadOperationExecutor uiThreadOperationExecutor, IVsHierarchyItemManager vsHierarchyItemManager, IAsynchronousOperationListenerProvider listenerProvider, @@ -72,7 +72,7 @@ public VisualStudioSuppressionFixService( _diagnosticService = diagnosticService; _buildErrorDiagnosticService = workspace.ExternalErrorDiagnosticUpdateSource; _codeFixService = codeFixService; - _suppressionStateService = (VisualStudioDiagnosticListSuppressionStateService)suppressionStateService; + _suppressionStateService = suppressionStateService; _editHandlerService = editHandlerService; _uiThreadOperationExecutor = uiThreadOperationExecutor; _vsHierarchyItemManager = vsHierarchyItemManager; From 235b7f8d04b9a3f928ea704150ccd0f8ae8de489 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 17 Mar 2022 21:53:34 -0700 Subject: [PATCH 005/131] Come back to UI thread before calling vs interface --- src/VisualStudio/Core/Def/RoslynPackage.cs | 2 ++ .../VisualStudioSuppressionFixService.cs | 13 +++++++++---- .../Impl/SolutionExplorer/AnalyzerItemTracker.cs | 9 +++++++-- .../Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs | 2 +- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/VisualStudio/Core/Def/RoslynPackage.cs b/src/VisualStudio/Core/Def/RoslynPackage.cs index 25264ef1ad2bd..c96349cf7b4f8 100644 --- a/src/VisualStudio/Core/Def/RoslynPackage.cs +++ b/src/VisualStudio/Core/Def/RoslynPackage.cs @@ -28,6 +28,7 @@ using Microsoft.VisualStudio.LanguageServices.Implementation.LanguageService; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem; using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.RuleSets; +using Microsoft.VisualStudio.LanguageServices.Implementation.Suppression; using Microsoft.VisualStudio.LanguageServices.Implementation.SyncNamespaces; using Microsoft.VisualStudio.LanguageServices.Implementation.TableDataSource; using Microsoft.VisualStudio.LanguageServices.Implementation.UnusedReferences; @@ -203,6 +204,7 @@ protected override async Task LoadComponentsAsync(CancellationToken cancellation // we need to load it as early as possible since we can have errors from // package from each language very early await this.ComponentModel.GetService().InitializeAsync(this).ConfigureAwait(false); + await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs index 25e42d0db9d70..9401a561d9e0e 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs @@ -38,10 +38,10 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Suppression /// Service to compute and apply bulk suppression fixes. /// [Export(typeof(IVisualStudioSuppressionFixService))] + [Export(typeof(VisualStudioSuppressionFixService))] internal sealed class VisualStudioSuppressionFixService : IVisualStudioSuppressionFixService { private readonly VisualStudioWorkspaceImpl _workspace; - private readonly IWpfTableControl? _tableControl; private readonly IAsynchronousOperationListener _listener; private readonly IDiagnosticAnalyzerService _diagnosticService; private readonly ExternalErrorDiagnosticUpdateSource _buildErrorDiagnosticService; @@ -54,6 +54,8 @@ internal sealed class VisualStudioSuppressionFixService : IVisualStudioSuppressi private readonly IHierarchyItemToProjectIdMap _projectMap; private readonly IGlobalOptionService _globalOptions; + private IWpfTableControl? _tableControl; + [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioSuppressionFixService( @@ -78,13 +80,16 @@ public VisualStudioSuppressionFixService( _vsHierarchyItemManager = vsHierarchyItemManager; _fixMultipleOccurencesService = workspace.Services.GetRequiredService(); _projectMap = workspace.Services.GetRequiredService(); - - var errorList = serviceProvider.GetService(typeof(SVsErrorList)) as IErrorList; - _tableControl = errorList?.TableControl; _listener = listenerProvider.GetListener(FeatureAttribute.ErrorList); _globalOptions = globalOptions; } + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) + { + var errorList = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + _tableControl = errorList?.TableControl; + } + public bool AddSuppressions(IVsHierarchy? projectHierarchy) { if (_tableControl == null) diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs index bcd8fb0bf165a..83f4f8550663b 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs @@ -6,7 +6,9 @@ using System.Collections.Immutable; using System.ComponentModel.Composition; using System.Linq; +using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.VisualStudio.Shell; using Microsoft.VisualStudio.Shell.Interop; @@ -23,18 +25,21 @@ internal class AnalyzerItemsTracker : IVsSelectionEvents { private IVsMonitorSelection? _vsMonitorSelection = null; private uint _selectionEventsCookie = 0; + private readonly IThreadingContext _threadingContext; public event EventHandler? SelectedHierarchyItemChanged; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public AnalyzerItemsTracker() + public AnalyzerItemsTracker(IThreadingContext threadingContext) { + _threadingContext = threadingContext; } - public async Task RegisterAsync(IAsyncServiceProvider serviceProvider) + public async Task RegisterAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { _vsMonitorSelection ??= await serviceProvider.GetServiceAsync().ConfigureAwait(false); + await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); _vsMonitorSelection?.AdviseSelectionEvents(this, out _selectionEventsCookie); } diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs index 3b6e5e3026340..3bc2241efcc25 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs @@ -28,7 +28,7 @@ public AnalyzerNodeSetup(AnalyzerItemsTracker analyzerTracker, AnalyzersCommandH public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - await _analyzerTracker.RegisterAsync(serviceProvider).ConfigureAwait(false); + await _analyzerTracker.RegisterAsync(serviceProvider, cancellationToken).ConfigureAwait(false); await _analyzerCommandHandler.InitializeAsync( await serviceProvider.GetServiceAsync().ConfigureAwait(false), cancellationToken).ConfigureAwait(false); From cc292553679833b3b04c6df3bfdd54ec13960efe Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 17 Mar 2022 22:20:24 -0700 Subject: [PATCH 006/131] actually initialize --- src/VisualStudio/Core/Def/RoslynPackage.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/VisualStudio/Core/Def/RoslynPackage.cs b/src/VisualStudio/Core/Def/RoslynPackage.cs index c96349cf7b4f8..41ddff8f52d2f 100644 --- a/src/VisualStudio/Core/Def/RoslynPackage.cs +++ b/src/VisualStudio/Core/Def/RoslynPackage.cs @@ -209,10 +209,7 @@ protected override async Task LoadComponentsAsync(CancellationToken cancellation await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); - - // The misc files workspace needs to be loaded on the UI thread. This way it will have - // the appropriate task scheduler to report events on. - this.ComponentModel.GetService(); + await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); // Load and initialize the add solution item service so ConfigurationUpdater can use it to create editorconfig files. await this.ComponentModel.GetService().InitializeAsync(this).ConfigureAwait(false); From 2d279efdf99c64c1cd1efe8113cff387a5b56658 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 17 Mar 2022 22:24:24 -0700 Subject: [PATCH 007/131] front load workspace --- src/VisualStudio/Core/Def/RoslynPackage.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/Core/Def/RoslynPackage.cs b/src/VisualStudio/Core/Def/RoslynPackage.cs index 41ddff8f52d2f..5594564a83199 100644 --- a/src/VisualStudio/Core/Def/RoslynPackage.cs +++ b/src/VisualStudio/Core/Def/RoslynPackage.cs @@ -164,6 +164,8 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke var settingsEditorFactory = this.ComponentModel.GetService(); RegisterEditorFactory(settingsEditorFactory); + + await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); } private async Task LoadOptionPersistersAsync(IComponentModel componentModel, CancellationToken cancellationToken) @@ -209,7 +211,6 @@ protected override async Task LoadComponentsAsync(CancellationToken cancellation await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); - await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); // Load and initialize the add solution item service so ConfigurationUpdater can use it to create editorconfig files. await this.ComponentModel.GetService().InitializeAsync(this).ConfigureAwait(false); From 577a04b95e47add1219b088c13f3e3c20a5a8900 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Thu, 17 Mar 2022 23:33:42 -0700 Subject: [PATCH 008/131] REmove arg --- src/VisualStudio/Core/Def/RoslynPackage.cs | 2 +- .../Suppression/VisualStudioSuppressionFixService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VisualStudio/Core/Def/RoslynPackage.cs b/src/VisualStudio/Core/Def/RoslynPackage.cs index 5594564a83199..d6e363e1c5525 100644 --- a/src/VisualStudio/Core/Def/RoslynPackage.cs +++ b/src/VisualStudio/Core/Def/RoslynPackage.cs @@ -206,7 +206,7 @@ protected override async Task LoadComponentsAsync(CancellationToken cancellation // we need to load it as early as possible since we can have errors from // package from each language very early await this.ComponentModel.GetService().InitializeAsync(this).ConfigureAwait(false); - await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); + await this.ComponentModel.GetService().InitializeAsync(this).ConfigureAwait(false); await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs index 9401a561d9e0e..5ee25d35ef426 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs @@ -84,7 +84,7 @@ public VisualStudioSuppressionFixService( _globalOptions = globalOptions; } - public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) { var errorList = await serviceProvider.GetServiceAsync().ConfigureAwait(false); _tableControl = errorList?.TableControl; From c62d81c1ca36928405af042f5982a4a661c7af3b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 19 Mar 2022 14:36:55 -0700 Subject: [PATCH 009/131] Use extension --- .../Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs index 83f4f8550663b..368a2956b1e50 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs @@ -38,7 +38,8 @@ public AnalyzerItemsTracker(IThreadingContext threadingContext) public async Task RegisterAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - _vsMonitorSelection ??= await serviceProvider.GetServiceAsync().ConfigureAwait(false); + _vsMonitorSelection ??= await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); _vsMonitorSelection?.AdviseSelectionEvents(this, out _selectionEventsCookie); } From db462afeceda1973fc4c8fbb626e4a8363bd1e70 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 19 Mar 2022 14:37:42 -0700 Subject: [PATCH 010/131] Use extension --- .../Core/Def/Diagnostics/DiagnosticProgressReporter.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs b/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs index 49b7321a769c1..1e37aa920dd51 100644 --- a/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs +++ b/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs @@ -6,6 +6,7 @@ using System.ComponentModel.Composition; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.SolutionCrawler; using Microsoft.VisualStudio.Shell; @@ -33,6 +34,7 @@ internal sealed class TaskCenterSolutionAnalysisProgressReporter /// report UI changes concurrently. /// private readonly object _lock = new(); + private readonly IThreadingContext _threadingContext; private readonly VisualStudioWorkspace _workspace; /// @@ -84,14 +86,18 @@ internal sealed class TaskCenterSolutionAnalysisProgressReporter [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public TaskCenterSolutionAnalysisProgressReporter(VisualStudioWorkspace workspace) + public TaskCenterSolutionAnalysisProgressReporter( + IThreadingContext threadingContext, + VisualStudioWorkspace workspace) { + _threadingContext = threadingContext; _workspace = workspace; } public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) { - _taskCenterService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + _taskCenterService = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); var crawlerService = _workspace.Services.GetRequiredService(); var reporter = crawlerService.GetProgressReporter(_workspace); From d577e8c36861aa5dcf7f2de95395451c6406954e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 19 Mar 2022 14:39:04 -0700 Subject: [PATCH 011/131] Use extension --- .../Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs | 6 ++++-- .../VisualStudioDiagnosticListTableCommandHandler.cs | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs index b7f14fe8417e6..6d31132d379f1 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs @@ -80,8 +80,10 @@ public MiscellaneousFilesWorkspace( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - _textManager = await serviceProvider.GetServiceAsync().ConfigureAwait(false); - var runningDocumentTable = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + _textManager = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var runningDocumentTable = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs index e46001557b69d..48a417284f726 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs @@ -69,7 +69,8 @@ public VisualStudioDiagnosticListTableCommandHandler( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - var errorList = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + var errorList = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); _tableControl = errorList?.TableControl; // Add command handlers for bulk suppression commands. From c11df69aea115de6744c29e97c75a4c2ee65d1a3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 19 Mar 2022 14:42:49 -0700 Subject: [PATCH 012/131] Use extension --- .../VisualStudioDiagnosticAnalyzerService.cs | 3 ++- .../VisualStudioAddSolutionItemService.cs | 3 ++- .../SyncNamespaces/SyncNamespacesCommandHandler.cs | 3 ++- .../RemoveUnusedReferencesCommandHandler.cs | 3 ++- .../Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs | 11 +++++++++-- 5 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs b/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs index 494584e2306c2..e3c6c9a8b0035 100644 --- a/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs +++ b/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs @@ -70,7 +70,8 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Run Code Analysis" menu command for CPS based managed projects. - var menuCommandService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + var menuCommandService = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); if (menuCommandService != null) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs index 681a1d7a82666..2dc392a65a218 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs @@ -43,7 +43,8 @@ public VisualStudioAddSolutionItemService( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) { - _dte = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + _dte = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); _fileChangeService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); } diff --git a/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs b/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs index 3f569e135c665..e3089658e394c 100644 --- a/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs +++ b/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs @@ -55,7 +55,8 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Remove Unused References" menu command for CPS based managed projects. - var menuCommandService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + var menuCommandService = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); if (menuCommandService != null) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs b/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs index 1a781cabc25d6..202a0366f0ffb 100644 --- a/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs +++ b/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs @@ -65,7 +65,8 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Remove Unused References" menu command for CPS based managed projects. - var menuCommandService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + var menuCommandService = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); if (menuCommandService != null) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs index 3bc2241efcc25..73fdeba2e070c 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs @@ -7,6 +7,7 @@ using System.ComponentModel.Design; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.VisualStudio.Shell; @@ -15,13 +16,18 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplore [Export(typeof(IAnalyzerNodeSetup))] internal sealed class AnalyzerNodeSetup : IAnalyzerNodeSetup { + private readonly IThreadingContext _threadingContext; private readonly AnalyzerItemsTracker _analyzerTracker; private readonly AnalyzersCommandHandler _analyzerCommandHandler; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public AnalyzerNodeSetup(AnalyzerItemsTracker analyzerTracker, AnalyzersCommandHandler analyzerCommandHandler) + public AnalyzerNodeSetup( + IThreadingContext threadingContext, + AnalyzerItemsTracker analyzerTracker, + AnalyzersCommandHandler analyzerCommandHandler) { + _threadingContext = threadingContext; _analyzerTracker = analyzerTracker; _analyzerCommandHandler = analyzerCommandHandler; } @@ -30,7 +36,8 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell { await _analyzerTracker.RegisterAsync(serviceProvider, cancellationToken).ConfigureAwait(false); await _analyzerCommandHandler.InitializeAsync( - await serviceProvider.GetServiceAsync().ConfigureAwait(false), + await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false), cancellationToken).ConfigureAwait(false); } From 8c11d45d343ec97d3fca005c5ba85a418b46dad3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 19 Mar 2022 14:47:22 -0700 Subject: [PATCH 013/131] Use extension --- .../VisualStudioMetadataAsSourceFileSupportService.cs | 3 ++- .../VisualStudioDiagnosticListSuppressionStateService.cs | 6 ++++-- .../Suppression/VisualStudioSuppressionFixService.cs | 7 ++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs b/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs index d9abf55bd9665..3fac6189f742d 100644 --- a/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs +++ b/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs @@ -34,7 +34,8 @@ public VisualStudioMetadataAsSourceFileSupportService( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - var solution = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + var solution = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); ErrorHandler.ThrowOnFailure(solution.AdviseSolutionEvents(this, out _)); } diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs index 0c3e101690c6a..d2efa80e7f3bc 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs @@ -58,8 +58,10 @@ public VisualStudioDiagnosticListSuppressionStateService( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - _shellService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); - var errorList = await serviceProvider.GetServiceAsync(throwOnFailure: false).ConfigureAwait(false); + _shellService = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var errorList = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory, throwOnFailure: false).ConfigureAwait(false); _tableControl = errorList?.TableControl; await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs index 5ee25d35ef426..ba96088d74752 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs @@ -16,6 +16,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editor.Implementation; using Microsoft.CodeAnalysis.Editor.Implementation.Suggestions; +using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; @@ -41,6 +42,7 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.Suppression [Export(typeof(VisualStudioSuppressionFixService))] internal sealed class VisualStudioSuppressionFixService : IVisualStudioSuppressionFixService { + private readonly IThreadingContext _threadingContext; private readonly VisualStudioWorkspaceImpl _workspace; private readonly IAsynchronousOperationListener _listener; private readonly IDiagnosticAnalyzerService _diagnosticService; @@ -59,6 +61,7 @@ internal sealed class VisualStudioSuppressionFixService : IVisualStudioSuppressi [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public VisualStudioSuppressionFixService( + IThreadingContext threadingContext, SVsServiceProvider serviceProvider, VisualStudioWorkspaceImpl workspace, IDiagnosticAnalyzerService diagnosticService, @@ -70,6 +73,7 @@ public VisualStudioSuppressionFixService( IAsynchronousOperationListenerProvider listenerProvider, IGlobalOptionService globalOptions) { + _threadingContext = threadingContext; _workspace = workspace; _diagnosticService = diagnosticService; _buildErrorDiagnosticService = workspace.ExternalErrorDiagnosticUpdateSource; @@ -86,7 +90,8 @@ public VisualStudioSuppressionFixService( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) { - var errorList = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + var errorList = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); _tableControl = errorList?.TableControl; } From 966d478ffa525f4299d53009dec9a9fd11a8b03d Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sat, 19 Mar 2022 14:48:11 -0700 Subject: [PATCH 014/131] Use extension --- .../Def/ProjectSystem/VisualStudioAddSolutionItemService.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs index 2dc392a65a218..173094b61ba66 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs @@ -45,7 +45,8 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) { _dte = await serviceProvider.GetServiceAsync( _threadingContext.JoinableTaskFactory).ConfigureAwait(false); - _fileChangeService = await serviceProvider.GetServiceAsync().ConfigureAwait(false); + _fileChangeService = await serviceProvider.GetServiceAsync( + _threadingContext.JoinableTaskFactory).ConfigureAwait(false); } public void TrackFilePathAndAddSolutionItemWhenFileCreated(string filePath) From 288d45e85a29b04ab8f9384086b88dda124c56e3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 20 Mar 2022 20:43:11 -0700 Subject: [PATCH 015/131] move --- .../Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs index 6d31132d379f1..041ba747da2f2 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs @@ -39,9 +39,6 @@ internal sealed partial class MiscellaneousFilesWorkspace : Workspace, IRunningD private readonly IVsEditorAdaptersFactoryService _editorAdaptersFactoryService; private readonly IMetadataAsSourceFileService _fileTrackingMetadataAsSourceService; - private IVsTextManager _textManager; - private RunningDocumentTableEventTracker _runningDocumentTableEventTracker; - private readonly Dictionary _languageInformationByLanguageGuid = new(); /// @@ -60,6 +57,9 @@ internal sealed partial class MiscellaneousFilesWorkspace : Workspace, IRunningD private readonly ForegroundThreadAffinitizedObject _foregroundThreadAffinitization; + private IVsTextManager _textManager; + private RunningDocumentTableEventTracker _runningDocumentTableEventTracker; + [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public MiscellaneousFilesWorkspace( From 067879a6e7b17d252572e40bd62ed7c36c38b14b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 20 Mar 2022 20:44:52 -0700 Subject: [PATCH 016/131] Add comment --- src/VisualStudio/Core/Def/RoslynPackage.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/VisualStudio/Core/Def/RoslynPackage.cs b/src/VisualStudio/Core/Def/RoslynPackage.cs index d4b53d1769aa0..4786fc171d2d1 100644 --- a/src/VisualStudio/Core/Def/RoslynPackage.cs +++ b/src/VisualStudio/Core/Def/RoslynPackage.cs @@ -165,6 +165,9 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke var settingsEditorFactory = this.ComponentModel.GetService(); RegisterEditorFactory(settingsEditorFactory); + // Misc workspace has to be up and running by the time our package is usable so that it can track running + // doc events and appropriately map files to/from it and other relevant workspaces (like the + // metadata-as-source workspace). await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); } From 4f9912785c436335480cd94b0de6dcc63f0b23b5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 20 Mar 2022 20:45:44 -0700 Subject: [PATCH 017/131] REvert --- .../Def/SyncNamespaces/SyncNamespacesCommandHandler.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs b/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs index e3089658e394c..6f10de75ce194 100644 --- a/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs +++ b/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs @@ -29,23 +29,23 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.SyncNamespaces internal sealed class SyncNamespacesCommandHandler { private readonly VisualStudioWorkspace _workspace; - private readonly IThreadingContext _threadingContext; private readonly IUIThreadOperationExecutor _threadOperationExecutor; private readonly IGlobalOptionService _globalOptions; + private readonly IThreadingContext _threadingContext; private IServiceProvider? _serviceProvider; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public SyncNamespacesCommandHandler( - IThreadingContext threadingContext, IUIThreadOperationExecutor threadOperationExecutor, VisualStudioWorkspace workspace, - IGlobalOptionService globalOptions) + IGlobalOptionService globalOptions, + IThreadingContext threadingContext) { - _threadingContext = threadingContext; _threadOperationExecutor = threadOperationExecutor; _workspace = workspace; _globalOptions = globalOptions; + _threadingContext = threadingContext; } public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) From 1312d328b615eee14d591a64f387d40a3520409b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 20 Mar 2022 20:49:12 -0700 Subject: [PATCH 018/131] Cleanup --- .../Core/Def/Diagnostics/DiagnosticProgressReporter.cs | 3 +-- .../Diagnostics/VisualStudioDiagnosticAnalyzerService.cs | 3 +-- .../VisualStudioMetadataAsSourceFileSupportService.cs | 3 +-- .../Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs | 6 ++---- .../Def/ProjectSystem/VisualStudioAddSolutionItemService.cs | 6 ++---- .../Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs | 3 +-- .../VisualStudioDiagnosticListSuppressionStateService.cs | 6 ++---- .../VisualStudioDiagnosticListTableCommandHandler.cs | 3 +-- .../Suppression/VisualStudioSuppressionFixService.cs | 3 +-- .../RemoveUnusedReferencesCommandHandler.cs | 3 +-- .../Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs | 3 +-- .../Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs | 3 +-- 12 files changed, 15 insertions(+), 30 deletions(-) diff --git a/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs b/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs index 1e37aa920dd51..668e1c63e7e01 100644 --- a/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs +++ b/src/VisualStudio/Core/Def/Diagnostics/DiagnosticProgressReporter.cs @@ -96,8 +96,7 @@ public TaskCenterSolutionAnalysisProgressReporter( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) { - _taskCenterService = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + _taskCenterService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); var crawlerService = _workspace.Services.GetRequiredService(); var reporter = crawlerService.GetProgressReporter(_workspace); diff --git a/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs b/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs index e3c6c9a8b0035..8414e55aa0bb8 100644 --- a/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs +++ b/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs @@ -70,8 +70,7 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Run Code Analysis" menu command for CPS based managed projects. - var menuCommandService = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var menuCommandService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); if (menuCommandService != null) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs b/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs index 3fac6189f742d..509ce6ff28aae 100644 --- a/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs +++ b/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs @@ -34,8 +34,7 @@ public VisualStudioMetadataAsSourceFileSupportService( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - var solution = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var solution = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); ErrorHandler.ThrowOnFailure(solution.AdviseSolutionEvents(this, out _)); } diff --git a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs index 041ba747da2f2..3088cb61a357a 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs @@ -80,10 +80,8 @@ public MiscellaneousFilesWorkspace( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - _textManager = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); - var runningDocumentTable = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + _textManager = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var runningDocumentTable = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs index 173094b61ba66..89959bb687a0b 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioAddSolutionItemService.cs @@ -43,10 +43,8 @@ public VisualStudioAddSolutionItemService( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) { - _dte = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); - _fileChangeService = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + _dte = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); + _fileChangeService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); } public void TrackFilePathAndAddSolutionItemWhenFileCreated(string filePath) diff --git a/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs b/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs index 6f10de75ce194..33e8e73bbf733 100644 --- a/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs +++ b/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs @@ -55,8 +55,7 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Remove Unused References" menu command for CPS based managed projects. - var menuCommandService = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var menuCommandService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); if (menuCommandService != null) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs index d2efa80e7f3bc..d7bf1e20f3912 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListSuppressionStateService.cs @@ -58,10 +58,8 @@ public VisualStudioDiagnosticListSuppressionStateService( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - _shellService = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); - var errorList = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory, throwOnFailure: false).ConfigureAwait(false); + _shellService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var errorList = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory, throwOnFailure: false).ConfigureAwait(false); _tableControl = errorList?.TableControl; await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs index 48a417284f726..8ccc2ba69aea8 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs @@ -69,8 +69,7 @@ public VisualStudioDiagnosticListTableCommandHandler( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - var errorList = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var errorList = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); _tableControl = errorList?.TableControl; // Add command handlers for bulk suppression commands. diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs index ba96088d74752..4d371d414d905 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs @@ -90,8 +90,7 @@ public VisualStudioSuppressionFixService( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) { - var errorList = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var errorList = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); _tableControl = errorList?.TableControl; } diff --git a/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs b/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs index 202a0366f0ffb..b3372f97129dc 100644 --- a/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs +++ b/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs @@ -65,8 +65,7 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Remove Unused References" menu command for CPS based managed projects. - var menuCommandService = await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var menuCommandService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); if (menuCommandService != null) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs index 368a2956b1e50..2bcf7456dd0da 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs @@ -38,8 +38,7 @@ public AnalyzerItemsTracker(IThreadingContext threadingContext) public async Task RegisterAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - _vsMonitorSelection ??= await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false); + _vsMonitorSelection ??= await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); _vsMonitorSelection?.AdviseSelectionEvents(this, out _selectionEventsCookie); } diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs index 73fdeba2e070c..99fd0e62bd282 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs @@ -36,8 +36,7 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell { await _analyzerTracker.RegisterAsync(serviceProvider, cancellationToken).ConfigureAwait(false); await _analyzerCommandHandler.InitializeAsync( - await serviceProvider.GetServiceAsync( - _threadingContext.JoinableTaskFactory).ConfigureAwait(false), + await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false), cancellationToken).ConfigureAwait(false); } From c00d7f3272c140bb236ccbcefe5fa45533c6d338 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 20 Mar 2022 20:51:17 -0700 Subject: [PATCH 019/131] Add comment --- .../VisualStudioMetadataAsSourceFileSupportService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs b/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs index 509ce6ff28aae..73e6586c4d365 100644 --- a/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs +++ b/src/VisualStudio/Core/Def/Implementation/VisualStudioMetadataAsSourceFileSupportService.cs @@ -36,6 +36,7 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell { var solution = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + // Intentionally ignore the event-cookie we get back out. We never stop listening to solution events. ErrorHandler.ThrowOnFailure(solution.AdviseSolutionEvents(this, out _)); } From 21778974ef828693e8d167f34256ad550b4610b8 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 20 Mar 2022 20:52:33 -0700 Subject: [PATCH 020/131] reorder --- .../VisualStudioDiagnosticListTableCommandHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs index 8ccc2ba69aea8..cc1337b280315 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs @@ -40,9 +40,9 @@ internal partial class VisualStudioDiagnosticListTableCommandHandler private readonly IUIThreadOperationExecutor _uiThreadOperationExecutor; private readonly IDiagnosticAnalyzerService _diagnosticService; private readonly ICodeActionEditHandlerService _editHandlerService; + private readonly IAsynchronousOperationListener _listener; private IWpfTableControl? _tableControl; - private readonly IAsynchronousOperationListener _listener; [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] From 7e143400c03777cba84c00395aec973782c8b82f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 20 Mar 2022 20:53:39 -0700 Subject: [PATCH 021/131] reorder --- .../Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs index 2bcf7456dd0da..a5d14f43750f0 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs @@ -23,9 +23,10 @@ namespace Microsoft.VisualStudio.LanguageServices.Implementation.SolutionExplore [Export] internal class AnalyzerItemsTracker : IVsSelectionEvents { + private readonly IThreadingContext _threadingContext; + private IVsMonitorSelection? _vsMonitorSelection = null; private uint _selectionEventsCookie = 0; - private readonly IThreadingContext _threadingContext; public event EventHandler? SelectedHierarchyItemChanged; From b69000b8abe125939a8b838406ef7a01029f8a4c Mon Sep 17 00:00:00 2001 From: DoctorKrolic Date: Mon, 21 Mar 2022 23:22:48 +0300 Subject: [PATCH 022/131] Check accessibility before offering "Implement interface" codefix --- .../ImplementInterfaceTests.cs | 96 +++++++++++++++++++ .../AbstractImplementInterfaceService.cs | 49 +++++++++- 2 files changed, 144 insertions(+), 1 deletion(-) diff --git a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs index 093dd5c8b8500..88386d1e2aa96 100644 --- a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs +++ b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs @@ -8293,6 +8293,102 @@ public async Task TestInaccessibleMember_03() }.RunAsync(); } + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_Property() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"internal class Foo {} + +internal interface I +{ + Foo MyProperty { get; } +} + +public class C : {|CS0535:I|} +{ +}", +@"internal class Foo {} + +internal interface I +{ + Foo MyProperty { get; } +} + +public class C : {|CS0535:I|} +{ + Foo I.MyProperty + { + get + { + throw new System.NotImplementedException(); + } + } +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_Method_InaccessibleReturnType() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"internal class Foo {} + +internal interface I +{ + Foo M(); +} + +public class C : {|CS0535:I|} +{ +}", +@"internal class Foo {} + +internal interface I +{ + Foo M(); +} + +public class C : {|CS0535:I|} +{ + Foo I.M() + { + throw new System.NotImplementedException(); + } +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_Method_InaccessibleParameterType() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"internal class Foo {} + +internal interface I +{ + void M(Foo foo); +} + +public class C : {|CS0535:I|} +{ +}", +@"internal class Foo {} + +internal interface I +{ + void M(Foo foo); +} + +public class C : {|CS0535:I|} +{ + void I.M(Foo foo) + { + throw new System.NotImplementedException(); + } +}"); + } + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestInaccessibleAccessor_01() { diff --git a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs index b551def32576f..e4a1a0918de71 100644 --- a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs +++ b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs @@ -72,7 +72,54 @@ private IEnumerable GetActions(Document document, ImplementTypeOptio if (state.MembersWithoutExplicitOrImplicitImplementationWhichCanBeImplicitlyImplemented.Length > 0) { - yield return ImplementInterfaceCodeAction.CreateImplementCodeAction(this, document, options, state); + var hasInaccessibleMembers = false; + + foreach (var (_, members) in state.MembersWithoutExplicitOrImplicitImplementationWhichCanBeImplicitlyImplemented) + { + foreach (var member in members) + { + switch (member) + { + case IPropertySymbol propertySymbol: + + if (propertySymbol.Type.DeclaredAccessibility > Accessibility.NotApplicable && + propertySymbol.Type.DeclaredAccessibility < state.ClassOrStructType.DeclaredAccessibility) + { + hasInaccessibleMembers = true; + goto AccessibilityChecked; + } + + break; + case IMethodSymbol methodSymbol: + + if (methodSymbol.ReturnType.DeclaredAccessibility > Accessibility.NotApplicable && + methodSymbol.ReturnType.DeclaredAccessibility < state.ClassOrStructType.DeclaredAccessibility) + { + hasInaccessibleMembers = true; + goto AccessibilityChecked; + } + + foreach (var parameter in methodSymbol.Parameters) + { + if (parameter.Type.DeclaredAccessibility > Accessibility.NotApplicable && + parameter.Type.DeclaredAccessibility < state.ClassOrStructType.DeclaredAccessibility) + { + hasInaccessibleMembers = true; + goto AccessibilityChecked; + } + } + + break; + } + } + } + +AccessibilityChecked: + + if (!hasInaccessibleMembers) + { + yield return ImplementInterfaceCodeAction.CreateImplementCodeAction(this, document, options, state); + } if (ShouldImplementDisposePattern(state, explicitly: false)) { From 6c4f7727576c16c2299f391fbdeb6e36b7d7ffe1 Mon Sep 17 00:00:00 2001 From: DoctorKrolic Date: Tue, 22 Mar 2022 22:41:46 +0300 Subject: [PATCH 023/131] Changed algorithm to not always remove suggestion, moved accessibility check to a separate helper class, added a bunch of tests --- .../ImplementInterfaceTests.cs | 217 ++++++++++++++++++ ...entInterfaceService.AccessibilityHelper.cs | 114 +++++++++ ...actImplementInterfaceService.CodeAction.cs | 11 +- .../AbstractImplementInterfaceService.cs | 42 +--- 4 files changed, 347 insertions(+), 37 deletions(-) create mode 100644 src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs diff --git a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs index 88386d1e2aa96..eaa42543b1360 100644 --- a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs +++ b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs @@ -8389,6 +8389,223 @@ void I.M(Foo foo) }"); } + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_Event() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"internal delegate void MyDelegate(); + +internal interface I +{ + event MyDelegate Event; +} + +public class C : {|CS0535:I|} +{ +}", +@"internal delegate void MyDelegate(); + +internal interface I +{ + event MyDelegate Event; +} + +public class C : {|CS0535:I|} +{ + event MyDelegate I.Event + { + add + { + throw new System.NotImplementedException(); + } + + remove + { + throw new System.NotImplementedException(); + } + } +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_Indexer_InaccessibleReturnType() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"internal class Foo {} + +internal interface I +{ + Foo this[int i] { get; } +} + +public class C : {|CS0535:I|} +{ +}", +@"internal class Foo {} + +internal interface I +{ + Foo this[int i] { get; } +} + +public class C : {|CS0535:I|} +{ + Foo I.this[int i] + { + get + { + throw new System.NotImplementedException(); + } + } +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_Indexer_InaccessibleParameterType() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"internal class Foo {} + +internal interface I +{ + int this[Foo foo] { get; } +} + +public class C : {|CS0535:I|} +{ +}", +@"internal class Foo {} + +internal interface I +{ + int this[Foo foo] { get; } +} + +public class C : {|CS0535:I|} +{ + int I.this[Foo foo] + { + get + { + throw new System.NotImplementedException(); + } + } +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_InaccessibleMemberAsGenericArgument() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"using System.Collections.Generic; + +internal class Foo {} + +internal interface I +{ + List M(); +} + +public class C : {|CS0535:I|} +{ +}", +@"using System.Collections.Generic; + +internal class Foo {} + +internal interface I +{ + List M(); +} + +public class C : {|CS0535:I|} +{ + List I.M() + { + throw new System.NotImplementedException(); + } +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_InaccessibleMemberDueToContainingType() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"internal class Container +{ + public class Foo {} +} + +internal interface I +{ + Container.Foo M(); +} + +public class C : {|CS0535:I|} +{ +}", +@"internal class Container +{ + public class Foo {} +} + +internal interface I +{ + Container.Foo M(); +} + +public class C : {|CS0535:I|} +{ + Container.Foo I.M() + { + throw new System.NotImplementedException(); + } +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_SeveralMembers_ShouldExplicitlyImplementOnlyInaccessible() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"internal class Foo {} + +internal interface I +{ + int N(); + Foo M(); +} + +public class C : {|CS0535:{|CS0535:I|}|} +{ +}", +@"internal class Foo {} + +internal interface I +{ + int N(); + Foo M(); +} + +public class C : {|CS0535:{|CS0535:I|}|} +{ + public int N() + { + throw new System.NotImplementedException(); + } + + Foo I.M() + { + throw new System.NotImplementedException(); + } +}"); + } + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] public async Task TestInaccessibleAccessor_01() { diff --git a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs new file mode 100644 index 0000000000000..14662d8bb3146 --- /dev/null +++ b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs @@ -0,0 +1,114 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.ImplementInterface +{ + internal abstract partial class AbstractImplementInterfaceService + { + private static class AccessibilityHelper + { + public static bool IsLessAccessibleThan(ISymbol first, INamedTypeSymbol second) + { + if (first.DeclaredAccessibility <= Accessibility.NotApplicable || + second.DeclaredAccessibility <= Accessibility.NotApplicable) + { + return false; + } + + if (first.DeclaredAccessibility < second.DeclaredAccessibility) + { + return true; + } + + switch (first) + { + case IPropertySymbol propertySymbol: + if (IsTypeLessAccessibleThanOtherType(propertySymbol.Type, second)) + { + return true; + } + + if (propertySymbol.GetMethod is not null) + { + foreach (var parameter in propertySymbol.GetMethod.Parameters) + { + if (IsTypeLessAccessibleThanOtherType(parameter.Type, second)) + { + return true; + } + } + } + + if (propertySymbol.SetMethod is not null) + { + foreach (var parameter in propertySymbol.SetMethod.Parameters) + { + if (IsTypeLessAccessibleThanOtherType(parameter.Type, second)) + { + return true; + } + } + } + + return false; + + case IMethodSymbol methodSymbol: + if (IsTypeLessAccessibleThanOtherType(methodSymbol.ReturnType, second)) + { + return true; + } + + foreach (var parameter in methodSymbol.Parameters) + { + if (IsTypeLessAccessibleThanOtherType(parameter.Type, second)) + { + return true; + } + } + + return false; + + case IEventSymbol eventSymbol: + return IsTypeLessAccessibleThanOtherType(eventSymbol.Type, second); + + default: + return false; + } + } + + private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol first, INamedTypeSymbol second) + { + if (first.DeclaredAccessibility <= Accessibility.NotApplicable || + second.DeclaredAccessibility <= Accessibility.NotApplicable) + { + return false; + } + + if (first.DeclaredAccessibility < second.DeclaredAccessibility) + { + return true; + } + + if (first is INamedTypeSymbol namedType) + { + foreach (var genericParam in namedType.TypeArguments) + { + if (IsTypeLessAccessibleThanOtherType(genericParam, second)) + { + return true; + } + } + } + + if (first.ContainingType is not null && + IsTypeLessAccessibleThanOtherType(first.ContainingType, second)) + { + return true; + } + + return false; + } + } + } +} diff --git a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction.cs b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction.cs index 359183f3815c6..4e73cbbb3ea53 100644 --- a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction.cs +++ b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.CodeAction.cs @@ -311,7 +311,7 @@ private ISymbol GenerateMember( // See if we need to generate an invisible member. If we do, then reset the name // back to what then member wants it to be. - var generateInvisibleMember = GenerateInvisibleMember(member, memberName); + var generateInvisibleMember = ShouldGenerateInvisibleMember(member, memberName); memberName = generateInvisibleMember ? member.Name : memberName; // The language doesn't allow static abstract implementations of interface methods. i.e, @@ -332,7 +332,7 @@ private ISymbol GenerateMember( addNew, addUnsafe, propertyGenerationBehavior); } - private bool GenerateInvisibleMember(ISymbol member, string memberName) + private bool ShouldGenerateInvisibleMember(ISymbol member, string memberName) { if (Service.HasHiddenExplicitImplementation) { @@ -355,6 +355,13 @@ private bool GenerateInvisibleMember(ISymbol member, string memberName) { return true; } + + // If the member is less accessible than type, for which we are implementing it, + // then only explicit implementation is valid. + if (AccessibilityHelper.IsLessAccessibleThan(member, State.ClassOrStructType)) + { + return true; + } } // Can't generate an invisible member if the language doesn't support it. diff --git a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs index e4a1a0918de71..1e8a1a5d0c1e6 100644 --- a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs +++ b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs @@ -72,51 +72,23 @@ private IEnumerable GetActions(Document document, ImplementTypeOptio if (state.MembersWithoutExplicitOrImplicitImplementationWhichCanBeImplicitlyImplemented.Length > 0) { - var hasInaccessibleMembers = false; + var totalMemberCount = 0; + var inaccessibleMemberCount = 0; foreach (var (_, members) in state.MembersWithoutExplicitOrImplicitImplementationWhichCanBeImplicitlyImplemented) { foreach (var member in members) { - switch (member) + totalMemberCount++; + + if (AccessibilityHelper.IsLessAccessibleThan(member, state.ClassOrStructType)) { - case IPropertySymbol propertySymbol: - - if (propertySymbol.Type.DeclaredAccessibility > Accessibility.NotApplicable && - propertySymbol.Type.DeclaredAccessibility < state.ClassOrStructType.DeclaredAccessibility) - { - hasInaccessibleMembers = true; - goto AccessibilityChecked; - } - - break; - case IMethodSymbol methodSymbol: - - if (methodSymbol.ReturnType.DeclaredAccessibility > Accessibility.NotApplicable && - methodSymbol.ReturnType.DeclaredAccessibility < state.ClassOrStructType.DeclaredAccessibility) - { - hasInaccessibleMembers = true; - goto AccessibilityChecked; - } - - foreach (var parameter in methodSymbol.Parameters) - { - if (parameter.Type.DeclaredAccessibility > Accessibility.NotApplicable && - parameter.Type.DeclaredAccessibility < state.ClassOrStructType.DeclaredAccessibility) - { - hasInaccessibleMembers = true; - goto AccessibilityChecked; - } - } - - break; + inaccessibleMemberCount++; } } } -AccessibilityChecked: - - if (!hasInaccessibleMembers) + if (totalMemberCount != inaccessibleMemberCount) { yield return ImplementInterfaceCodeAction.CreateImplementCodeAction(this, document, options, state); } From a221b75be69abdde85c97bca5dc9511eea06b783 Mon Sep 17 00:00:00 2001 From: DoctorKrolic Date: Wed, 23 Mar 2022 20:03:14 +0300 Subject: [PATCH 024/131] Respect C# naming conventions when generating parameter for record --- .../CSharpTest/AddParameter/AddParameterTests.cs | 13 +++++++++++++ .../AbstractAddParameterCodeFixProvider.cs | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs b/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs index 958cf1812f78b..36d8f8d03962b 100644 --- a/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs +++ b/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs @@ -2902,5 +2902,18 @@ public static class IsExternalInit { } } ", parseOptions: TestOptions.Regular.WithLanguageVersion(LanguageVersion.CSharp9)); } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddParameter)] + [WorkItem(56952, "https://github.com/dotnet/roslyn/issues/56952")] + public async Task TestRecordsNamingConventions() + { + await TestInRegularAndScript1Async(@"[|new Test(""repro"")|]; + +record Test(); +", @"new Test(""repro""); + +record Test(string V); +"); + } } } diff --git a/src/Features/Core/Portable/AddParameter/AbstractAddParameterCodeFixProvider.cs b/src/Features/Core/Portable/AddParameter/AbstractAddParameterCodeFixProvider.cs index 7cd5fb2b89dfe..98207d33b8bbf 100644 --- a/src/Features/Core/Portable/AddParameter/AbstractAddParameterCodeFixProvider.cs +++ b/src/Features/Core/Portable/AddParameter/AbstractAddParameterCodeFixProvider.cs @@ -370,7 +370,7 @@ private static async Task FixAsync( // The argumentNameSuggestion is the base for the parameter name. // For each method declaration the name is made unique to avoid name collisions. var (argumentNameSuggestion, isNamedArgument) = await GetNameSuggestionForArgumentAsync( - invocationDocument, argument, cancellationToken).ConfigureAwait(false); + invocationDocument, argument, method.ContainingType, cancellationToken).ConfigureAwait(false); var newParameterIndex = isNamedArgument ? (int?)null : argumentList.IndexOf(argument); return await AddParameterService.AddParameterAsync( @@ -396,7 +396,7 @@ private static async Task FixAsync( } private static async Task<(string argumentNameSuggestion, bool isNamed)> GetNameSuggestionForArgumentAsync( - Document invocationDocument, TArgumentSyntax argument, CancellationToken cancellationToken) + Document invocationDocument, TArgumentSyntax argument, INamedTypeSymbol containingType, CancellationToken cancellationToken) { var syntaxFacts = invocationDocument.GetRequiredLanguageService(); @@ -411,7 +411,7 @@ private static async Task FixAsync( var expression = syntaxFacts.GetExpressionOfArgument(argument); var semanticFacts = invocationDocument.GetRequiredLanguageService(); argumentName = semanticFacts.GenerateNameForExpression( - semanticModel, expression, capitalize: false, cancellationToken: cancellationToken); + semanticModel, expression, capitalize: containingType.IsRecord, cancellationToken: cancellationToken); return (argumentNameSuggestion: argumentName, isNamed: false); } } From f65727c24c5cfa20b080c4ce2f819f0d692454e4 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 23 Mar 2022 11:27:35 -0700 Subject: [PATCH 025/131] Remove unnecessary switch to UI thread --- .../Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs | 5 ++--- .../Def/ProjectSystem/RunningDocumentTableEventTracker.cs | 6 +++++- src/VisualStudio/Core/Def/RoslynPackage.cs | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs index 3088cb61a357a..98025ac542f43 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs @@ -78,13 +78,12 @@ public MiscellaneousFilesWorkspace( _metadataReferences = ImmutableArray.CreateRange(CreateMetadataReferences()); } - public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) + public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) { + await TaskScheduler.Default; _textManager = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); var runningDocumentTable = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); - await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); - _runningDocumentTableEventTracker = new RunningDocumentTableEventTracker( _threadingContext, _editorAdaptersFactoryService, runningDocumentTable, this); } diff --git a/src/VisualStudio/Core/Def/ProjectSystem/RunningDocumentTableEventTracker.cs b/src/VisualStudio/Core/Def/ProjectSystem/RunningDocumentTableEventTracker.cs index 6a5472bbc838e..3b869fe35f369 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/RunningDocumentTableEventTracker.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/RunningDocumentTableEventTracker.cs @@ -29,6 +29,9 @@ internal sealed class RunningDocumentTableEventTracker : IVsRunningDocTableEvent private readonly IRunningDocumentTableEventListener _listener; private uint _runningDocumentTableEventsCookie; + /// + /// This constructor can be called on any thread. + /// public RunningDocumentTableEventTracker(IThreadingContext threadingContext, IVsEditorAdaptersFactoryService editorAdaptersFactoryService, IVsRunningDocumentTable runningDocumentTable, IRunningDocumentTableEventListener listener) { @@ -38,12 +41,13 @@ public RunningDocumentTableEventTracker(IThreadingContext threadingContext, IVsE Contract.ThrowIfNull(listener); _foregroundAffinitization = new ForegroundThreadAffinitizedObject(threadingContext, assertIsForeground: false); + // casting is free threaded past 16.0 _runningDocumentTable = (IVsRunningDocumentTable4)runningDocumentTable; _editorAdaptersFactoryService = editorAdaptersFactoryService; _listener = listener; // Advise / Unadvise for the RDT is free threaded past 16.0 - ((IVsRunningDocumentTable)_runningDocumentTable).AdviseRunningDocTableEvents(this, out _runningDocumentTableEventsCookie); + runningDocumentTable.AdviseRunningDocTableEvents(this, out _runningDocumentTableEventsCookie); } public int OnAfterFirstDocumentLock(uint docCookie, uint dwRDTLockType, uint dwReadLocksRemaining, uint dwEditLocksRemaining) diff --git a/src/VisualStudio/Core/Def/RoslynPackage.cs b/src/VisualStudio/Core/Def/RoslynPackage.cs index 4786fc171d2d1..cd202ef736c4a 100644 --- a/src/VisualStudio/Core/Def/RoslynPackage.cs +++ b/src/VisualStudio/Core/Def/RoslynPackage.cs @@ -168,7 +168,7 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke // Misc workspace has to be up and running by the time our package is usable so that it can track running // doc events and appropriately map files to/from it and other relevant workspaces (like the // metadata-as-source workspace). - await this.ComponentModel.GetService().InitializeAsync(this, cancellationToken).ConfigureAwait(false); + await this.ComponentModel.GetService().InitializeAsync(this).ConfigureAwait(false); } private async Task LoadOptionPersistersAsync(IComponentModel componentModel, CancellationToken cancellationToken) From 0dd1dedc6d4f32393af32aa381475633e540aac0 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 23 Mar 2022 11:30:02 -0700 Subject: [PATCH 026/131] Async load --- .../Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs | 1 + .../Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs | 5 ++--- src/VisualStudio/Core/Def/RoslynPackage.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs index 98025ac542f43..981767452bd41 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/MiscellaneousFilesWorkspace.cs @@ -28,6 +28,7 @@ using Microsoft.VisualStudio.Shell.Interop; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.TextManager.Interop; +using Microsoft.VisualStudio.Threading; using Roslyn.Utilities; namespace Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem diff --git a/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs b/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs index dd97f6399c1fe..8799a4bfae112 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/RuleSets/RuleSetEventHandler.cs @@ -39,16 +39,15 @@ public RuleSetEventHandler( _serviceProvider = serviceProvider; } - public async Task RegisterAsync(CancellationToken cancellationToken) + public async Task RegisterAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { if (!_eventsHookedUp) { + var trackProjectDocuments = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); if (!_eventsHookedUp) { - var trackProjectDocuments = (IVsTrackProjectDocuments2)_serviceProvider.GetService(typeof(SVsTrackProjectDocuments)); - if (ErrorHandler.Succeeded(trackProjectDocuments.AdviseTrackProjectDocumentsEvents(this, out _cookie))) _eventsHookedUp = true; } diff --git a/src/VisualStudio/Core/Def/RoslynPackage.cs b/src/VisualStudio/Core/Def/RoslynPackage.cs index cd202ef736c4a..ccead2d180960 100644 --- a/src/VisualStudio/Core/Def/RoslynPackage.cs +++ b/src/VisualStudio/Core/Def/RoslynPackage.cs @@ -332,7 +332,7 @@ private async Task LoadAnalyzerNodeComponentsAsync(CancellationToken cancellatio _ruleSetEventHandler = this.ComponentModel.GetService(); if (_ruleSetEventHandler != null) - await _ruleSetEventHandler.RegisterAsync(cancellationToken).ConfigureAwait(false); + await _ruleSetEventHandler.RegisterAsync(this, cancellationToken).ConfigureAwait(false); } private void UnregisterAnalyzerTracker() From 77deef2eb7750d1e8445744249e86904d5ee4c10 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 23 Mar 2022 11:32:02 -0700 Subject: [PATCH 027/131] do not throw on failure --- .../VisualStudioDiagnosticListTableCommandHandler.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs index cc1337b280315..7d0b1ee59b307 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioDiagnosticListTableCommandHandler.cs @@ -69,11 +69,11 @@ public VisualStudioDiagnosticListTableCommandHandler( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - var errorList = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var errorList = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory, throwOnFailure: false).ConfigureAwait(false); _tableControl = errorList?.TableControl; // Add command handlers for bulk suppression commands. - var menuCommandService = (IMenuCommandService?)await serviceProvider.GetServiceAsync(typeof(IMenuCommandService)).ConfigureAwait(false); + var menuCommandService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory, throwOnFailure: false).ConfigureAwait(false); if (menuCommandService != null) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); From ae60cbf7a021a36f1413090ca0e20cef559c8987 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 23 Mar 2022 11:35:31 -0700 Subject: [PATCH 028/131] Add throwOnFailure: False --- .../Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs | 2 +- .../Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs | 2 +- .../Suppression/VisualStudioSuppressionFixService.cs | 2 +- .../UnusedReferences/RemoveUnusedReferencesCommandHandler.cs | 2 +- .../Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs | 2 +- .../Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs | 2 +- .../Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs b/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs index 8414e55aa0bb8..900ee36be1bd1 100644 --- a/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs +++ b/src/VisualStudio/Core/Def/Diagnostics/VisualStudioDiagnosticAnalyzerService.cs @@ -70,7 +70,7 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Run Code Analysis" menu command for CPS based managed projects. - var menuCommandService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var menuCommandService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory, throwOnFailure: false).ConfigureAwait(false); if (menuCommandService != null) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs b/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs index 33e8e73bbf733..b5b17572123e8 100644 --- a/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs +++ b/src/VisualStudio/Core/Def/SyncNamespaces/SyncNamespacesCommandHandler.cs @@ -55,7 +55,7 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Remove Unused References" menu command for CPS based managed projects. - var menuCommandService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var menuCommandService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory, throwOnFailure: false).ConfigureAwait(false); if (menuCommandService != null) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs index 4d371d414d905..d835b1f65e8d9 100644 --- a/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs +++ b/src/VisualStudio/Core/Def/TableDataSource/Suppression/VisualStudioSuppressionFixService.cs @@ -90,7 +90,7 @@ public VisualStudioSuppressionFixService( public async Task InitializeAsync(IAsyncServiceProvider serviceProvider) { - var errorList = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var errorList = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory, throwOnFailure: false).ConfigureAwait(false); _tableControl = errorList?.TableControl; } diff --git a/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs b/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs index b3372f97129dc..0423ee6898abf 100644 --- a/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs +++ b/src/VisualStudio/Core/Def/UnusedReferences/RemoveUnusedReferencesCommandHandler.cs @@ -65,7 +65,7 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell _serviceProvider = (IServiceProvider)serviceProvider; // Hook up the "Remove Unused References" menu command for CPS based managed projects. - var menuCommandService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); + var menuCommandService = await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory, throwOnFailure: false).ConfigureAwait(false); if (menuCommandService != null) { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs index a5d14f43750f0..b1ff07aae803e 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerItemTracker.cs @@ -39,7 +39,7 @@ public AnalyzerItemsTracker(IThreadingContext threadingContext) public async Task RegisterAsync(IAsyncServiceProvider serviceProvider, CancellationToken cancellationToken) { - _vsMonitorSelection ??= await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); + _vsMonitorSelection ??= await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory, throwOnFailure: false).ConfigureAwait(false); await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); _vsMonitorSelection?.AdviseSelectionEvents(this, out _selectionEventsCookie); } diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs index 99fd0e62bd282..76729d0e538b5 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzerNodeSetup.cs @@ -36,7 +36,7 @@ public async Task InitializeAsync(IAsyncServiceProvider serviceProvider, Cancell { await _analyzerTracker.RegisterAsync(serviceProvider, cancellationToken).ConfigureAwait(false); await _analyzerCommandHandler.InitializeAsync( - await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false), + await serviceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory, throwOnFailure: false).ConfigureAwait(false), cancellationToken).ConfigureAwait(false); } diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs index a2f36a1e8df05..2f864f7978726 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs @@ -95,7 +95,7 @@ public AnalyzersCommandHandler( /// /// Hook up the context menu handlers. /// - public async Task InitializeAsync(IMenuCommandService menuCommandService, CancellationToken cancellationToken) + public async Task InitializeAsync(IMenuCommandService? menuCommandService, CancellationToken cancellationToken) { if (menuCommandService != null) { From 14291475e62aa6780c17f0e532bcf6f496656bf1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 23 Mar 2022 13:03:19 -0700 Subject: [PATCH 029/131] lint --- .../Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs index 2f864f7978726..a2f36a1e8df05 100644 --- a/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs +++ b/src/VisualStudio/Core/Impl/SolutionExplorer/AnalyzersCommandHandler.cs @@ -95,7 +95,7 @@ public AnalyzersCommandHandler( /// /// Hook up the context menu handlers. /// - public async Task InitializeAsync(IMenuCommandService? menuCommandService, CancellationToken cancellationToken) + public async Task InitializeAsync(IMenuCommandService menuCommandService, CancellationToken cancellationToken) { if (menuCommandService != null) { From ef6f2fda64e5b1ae5c718ac00411a7ba5b2d6835 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Wed, 23 Mar 2022 15:36:16 -0700 Subject: [PATCH 030/131] Don't eagerly load services Loading these services during the VisualStudioProject constructor means they're being loaded during the initial project creation which is earlier than they're needed and can hold up other work. Let's not ask for them until we actually need them. --- .../Def/ProjectSystem/VisualStudioProject.cs | 38 +++++++++++-------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProject.cs b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProject.cs index 7beec9db272fe..e7474a7aa84fb 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProject.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProject.cs @@ -29,8 +29,6 @@ internal sealed partial class VisualStudioProject private readonly VisualStudioWorkspaceImpl _workspace; private readonly HostDiagnosticUpdateSource _hostDiagnosticUpdateSource; - private readonly IWorkspaceTelemetryService? _telemetryService; - private readonly IWorkspaceStatusService? _workspaceStatusService; /// /// Provides dynamic source files for files added through . @@ -158,9 +156,6 @@ internal VisualStudioProject( _dynamicFileInfoProviders = dynamicFileInfoProviders; _hostDiagnosticUpdateSource = hostDiagnosticUpdateSource; - _telemetryService = _workspace.Services.GetService(); - _workspaceStatusService = _workspace.Services.GetService(); - Id = id; Language = language; _displayName = displayName; @@ -239,18 +234,29 @@ private void ChangeProjectProperty(ref T field, T newValue, Action(); + + if (telemetryService?.HasActiveSession == true) + { + var workspaceStatusService = _workspace.Services.GetService(); + + // We only log telemetry during solution open + + // Importantly, we do not await/wait on the fullyLoadedStateTask. We do not want to ever be waiting on work + // that may end up touching the UI thread (As we can deadlock if GetTagsSynchronous waits on us). Instead, + // we only check if the Task is completed. Prior to that we will assume we are still loading. Once this + // task is completed, we know that the WaitUntilFullyLoadedAsync call will have actually finished and we're + // fully loaded. + var isFullyLoadedTask = workspaceStatusService?.IsFullyLoadedAsync(CancellationToken.None); + var isFullyLoaded = isFullyLoadedTask is { IsCompleted: true } && isFullyLoadedTask.GetAwaiter().GetResult(); + + if (!isFullyLoaded) + { + TryReportCompilationThrownAway(_workspace.CurrentSolution.State, Id); + } + } } if (_activeBatchScopes > 0) From 954a6ab0661815d66975278a9debf1222459138e Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 23 Mar 2022 16:17:09 -0700 Subject: [PATCH 031/131] Cleanup --- .../SymbolSearch/Windows/SymbolSearchUpdateEngine.Update.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Features/Core/Portable/SymbolSearch/Windows/SymbolSearchUpdateEngine.Update.cs b/src/Features/Core/Portable/SymbolSearch/Windows/SymbolSearchUpdateEngine.Update.cs index 5b8c3138c167d..d355eed9bf548 100644 --- a/src/Features/Core/Portable/SymbolSearch/Windows/SymbolSearchUpdateEngine.Update.cs +++ b/src/Features/Core/Portable/SymbolSearch/Windows/SymbolSearchUpdateEngine.Update.cs @@ -531,9 +531,7 @@ private async Task TryDownloadFileAsync(IRemoteControlClient client, C { await LogInfoAsync("Read file from client", cancellationToken).ConfigureAwait(false); - // "ReturnsNull": Only return a file if we have it locally *and* it's not older than our polling time (1 day). - - using var stream = await client.ReadFileAsync(BehaviorOnStale.ReturnNull).ConfigureAwait(false); + using var stream = await client.ReadFileAsync(BehaviorOnStale.ReturnStale).ConfigureAwait(false); if (stream == null) { From 8c243095595e627e11106cb0961359566233c4c0 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Thu, 24 Mar 2022 10:10:03 -0700 Subject: [PATCH 032/131] Fix a race condition in IDE diagnostic service for stale diagnostics Fixes [AB#1487574](https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1487574/) If you edit a document, which either fixes or introduces compiler diagnostics in another open document, but you do a tab switch to that open document before diagnostic computation kicked off by prior edit finishes, than we end up cancelling existing tasks queued for diagnostic computation from that prior edit. We kick off new tasks for diagnostic computation for the new active document, but the newly active document did not have any code change, so has identical text and semantic version and we end up skipping diagnostics computation for it, leaving behind stale diagnostics OR not showing new diagnostics that were introduced from the edit in prior active document. Fix is to always recompute the active document diagnostics on switching active documents and avoid any possible race conditions --- ...sticIncrementalAnalyzer_IncrementalAnalyzer.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs b/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs index 34faa68d9cef3..bb8a2c3b518bf 100644 --- a/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs +++ b/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs @@ -267,14 +267,13 @@ private void RaiseDiagnosticsRemovedIfRequiredForClosedOrResetDocument(TextDocum public async Task ActiveDocumentSwitchedAsync(TextDocument document, CancellationToken cancellationToken) { - // When the analysis scope is set to 'ActiveFile' and the active document is switched, - // we retrigger analysis of newly active document. - // For the remaining analysis scopes, we always analyze all the open files, so switching active - // documents between two open files doesn't require us to retrigger analysis of the newly active document. - if (GlobalOptions.GetBackgroundAnalysisScope(document.Project.Language) != BackgroundAnalysisScope.ActiveFile) - { - return; - } + // Retrigger analysis of newly active document to always get up-to-date diagnostics. + // Note that we do so regardless of the current background analysis scope, + // as we might have switched the document _while_ the diagnostic refresh was in progress for + // all open documents, which can lead to cancellation of diagnostic recomputation task + // for the newly active document. This can lead to a race condition where we end up with + // stale diagnostics for the active document. We avoid that by always recomputing + // the diagnostics for the newly active document whenever active document is switched. // First reset the document states. await TextDocumentResetAsync(document, cancellationToken).ConfigureAwait(false); From 8e5a95ec01ff7dbdb18b7e999c826ff146028177 Mon Sep 17 00:00:00 2001 From: DoctorKrolic Date: Thu, 24 Mar 2022 21:44:46 +0300 Subject: [PATCH 033/131] PR feedback --- .../ImplementInterfaceTests.cs | 80 +++++++++---------- ...entInterfaceService.AccessibilityHelper.cs | 22 ++--- .../AbstractImplementInterfaceService.cs | 2 + 3 files changed, 48 insertions(+), 56 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs index eaa42543b1360..a7f23a75cb112 100644 --- a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs +++ b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs @@ -8298,26 +8298,26 @@ public async Task TestInaccessibleMember_03() public async Task TestAccessibility_Property() { await TestWithAllCodeStyleOptionsOffAsync( -@"internal class Foo {} +@"internal class Goo {} internal interface I { - Foo MyProperty { get; } + Goo MyProperty { get; } } public class C : {|CS0535:I|} { }", -@"internal class Foo {} +@"internal class Goo {} internal interface I { - Foo MyProperty { get; } + Goo MyProperty { get; } } public class C : {|CS0535:I|} { - Foo I.MyProperty + Goo I.MyProperty { get { @@ -8332,26 +8332,26 @@ Foo I.MyProperty public async Task TestAccessibility_Method_InaccessibleReturnType() { await TestWithAllCodeStyleOptionsOffAsync( -@"internal class Foo {} +@"internal class Goo {} internal interface I { - Foo M(); + Goo M(); } public class C : {|CS0535:I|} { }", -@"internal class Foo {} +@"internal class Goo {} internal interface I { - Foo M(); + Goo M(); } public class C : {|CS0535:I|} { - Foo I.M() + Goo I.M() { throw new System.NotImplementedException(); } @@ -8363,26 +8363,26 @@ Foo I.M() public async Task TestAccessibility_Method_InaccessibleParameterType() { await TestWithAllCodeStyleOptionsOffAsync( -@"internal class Foo {} +@"internal class Goo {} internal interface I { - void M(Foo foo); + void M(Goo goo); } public class C : {|CS0535:I|} { }", -@"internal class Foo {} +@"internal class Goo {} internal interface I { - void M(Foo foo); + void M(Goo goo); } public class C : {|CS0535:I|} { - void I.M(Foo foo) + void I.M(Goo goo) { throw new System.NotImplementedException(); } @@ -8433,26 +8433,26 @@ event MyDelegate I.Event public async Task TestAccessibility_Indexer_InaccessibleReturnType() { await TestWithAllCodeStyleOptionsOffAsync( -@"internal class Foo {} +@"internal class Goo {} internal interface I { - Foo this[int i] { get; } + Goo this[int i] { get; } } public class C : {|CS0535:I|} { }", -@"internal class Foo {} +@"internal class Goo {} internal interface I { - Foo this[int i] { get; } + Goo this[int i] { get; } } public class C : {|CS0535:I|} { - Foo I.this[int i] + Goo I.this[int i] { get { @@ -8467,26 +8467,26 @@ Foo I.this[int i] public async Task TestAccessibility_Indexer_InaccessibleParameterType() { await TestWithAllCodeStyleOptionsOffAsync( -@"internal class Foo {} +@"internal class Goo {} internal interface I { - int this[Foo foo] { get; } + int this[Goo goo] { get; } } public class C : {|CS0535:I|} { }", -@"internal class Foo {} +@"internal class Goo {} internal interface I { - int this[Foo foo] { get; } + int this[Goo goo] { get; } } public class C : {|CS0535:I|} { - int I.this[Foo foo] + int I.this[Goo goo] { get { @@ -8503,11 +8503,11 @@ public async Task TestAccessibility_InaccessibleMemberAsGenericArgument() await TestWithAllCodeStyleOptionsOffAsync( @"using System.Collections.Generic; -internal class Foo {} +internal class Goo {} internal interface I { - List M(); + List M(); } public class C : {|CS0535:I|} @@ -8515,16 +8515,16 @@ public class C : {|CS0535:I|} }", @"using System.Collections.Generic; -internal class Foo {} +internal class Goo {} internal interface I { - List M(); + List M(); } public class C : {|CS0535:I|} { - List I.M() + List I.M() { throw new System.NotImplementedException(); } @@ -8538,12 +8538,12 @@ public async Task TestAccessibility_InaccessibleMemberDueToContainingType() await TestWithAllCodeStyleOptionsOffAsync( @"internal class Container { - public class Foo {} + public class Goo {} } internal interface I { - Container.Foo M(); + Container.Goo M(); } public class C : {|CS0535:I|} @@ -8551,17 +8551,17 @@ public class C : {|CS0535:I|} }", @"internal class Container { - public class Foo {} + public class Goo {} } internal interface I { - Container.Foo M(); + Container.Goo M(); } public class C : {|CS0535:I|} { - Container.Foo I.M() + Container.Goo I.M() { throw new System.NotImplementedException(); } @@ -8573,23 +8573,23 @@ Container.Foo I.M() public async Task TestAccessibility_SeveralMembers_ShouldExplicitlyImplementOnlyInaccessible() { await TestWithAllCodeStyleOptionsOffAsync( -@"internal class Foo {} +@"internal class Goo {} internal interface I { int N(); - Foo M(); + Goo M(); } public class C : {|CS0535:{|CS0535:I|}|} { }", -@"internal class Foo {} +@"internal class Goo {} internal interface I { int N(); - Foo M(); + Goo M(); } public class C : {|CS0535:{|CS0535:I|}|} @@ -8599,7 +8599,7 @@ public int N() throw new System.NotImplementedException(); } - Foo I.M() + Goo I.M() { throw new System.NotImplementedException(); } diff --git a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs index 14662d8bb3146..3bfa750dd1b0b 100644 --- a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs +++ b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs @@ -29,26 +29,16 @@ public static bool IsLessAccessibleThan(ISymbol first, INamedTypeSymbol second) return true; } - if (propertySymbol.GetMethod is not null) + if (propertySymbol.GetMethod is not null && + IsLessAccessibleThan(propertySymbol.GetMethod, second)) { - foreach (var parameter in propertySymbol.GetMethod.Parameters) - { - if (IsTypeLessAccessibleThanOtherType(parameter.Type, second)) - { - return true; - } - } + return true; } - if (propertySymbol.SetMethod is not null) + if (propertySymbol.SetMethod is not null && + IsLessAccessibleThan(propertySymbol.SetMethod, second)) { - foreach (var parameter in propertySymbol.SetMethod.Parameters) - { - if (IsTypeLessAccessibleThanOtherType(parameter.Type, second)) - { - return true; - } - } + return true; } return false; diff --git a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs index 1e8a1a5d0c1e6..0e2e1a871a7fe 100644 --- a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs +++ b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.cs @@ -88,6 +88,8 @@ private IEnumerable GetActions(Document document, ImplementTypeOptio } } + // If all members to implement are inaccessible, then "Implement interface" codeaction + // will be the same as "Implement interface explicitly", so there is no point in having both of them if (totalMemberCount != inaccessibleMemberCount) { yield return ImplementInterfaceCodeAction.CreateImplementCodeAction(this, document, options, state); From f4faa3f4100827566e74404d79ef26162abb3a52 Mon Sep 17 00:00:00 2001 From: DoctorKrolic Date: Thu, 24 Mar 2022 22:57:03 +0300 Subject: [PATCH 034/131] Added test for record struct --- .../CSharpTest/AddParameter/AddParameterTests.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs b/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs index 36d8f8d03962b..3a230f21fe671 100644 --- a/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs +++ b/src/EditorFeatures/CSharpTest/AddParameter/AddParameterTests.cs @@ -2913,6 +2913,19 @@ record Test(); ", @"new Test(""repro""); record Test(string V); +"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddParameter)] + [WorkItem(56952, "https://github.com/dotnet/roslyn/issues/56952")] + public async Task TestRecordsNamingConventions_RecordStruct() + { + await TestInRegularAndScript1Async(@"[|new Test(""repro"")|]; + +record struct Test(); +", @"new Test(""repro""); + +record struct Test(string V); "); } } From e05579fd1722e9ea6d1d36fab78dce8e998311cd Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Wed, 23 Mar 2022 15:42:20 -0700 Subject: [PATCH 035/131] Swich off the UI thread when our work doesn't need it anymore --- .../Core/Def/ProjectSystem/VisualStudioProjectFactory.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProjectFactory.cs b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProjectFactory.cs index e5eee81510868..5590cb6405044 100644 --- a/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProjectFactory.cs +++ b/src/VisualStudio/Core/Def/ProjectSystem/VisualStudioProjectFactory.cs @@ -74,7 +74,10 @@ public async Task CreateAndAddToWorkspaceAsync( ? filePath : null; - await _visualStudioWorkspaceImpl.EnsureDocumentOptionProvidersInitializedAsync(cancellationToken).ConfigureAwait(true); + // After the call to EnsureDocumentOptionProvidersInitializedAsync, everything can be off the UI thread. + // Thus, we have a ConfigureAwait(false) on the call and switch explicitly after. + await _visualStudioWorkspaceImpl.EnsureDocumentOptionProvidersInitializedAsync(cancellationToken).ConfigureAwait(false); + await TaskScheduler.Default; // From this point on, we start mutating the solution. So make us non cancellable. cancellationToken = CancellationToken.None; From c15cde510b7773d71580d734ffc183b17fd1b61c Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 25 Mar 2022 12:31:35 +0200 Subject: [PATCH 036/131] Move IDE0078 codefix to Analyzers --- src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems | 3 ++- .../CSharpUsePatternCombinatorsCodeFixProvider.cs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/UsePatternCombinators/CSharpUsePatternCombinatorsCodeFixProvider.cs (97%) diff --git a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems index 80e167d2963a9..9be7985bbe7cb 100644 --- a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems +++ b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems @@ -19,6 +19,7 @@ + @@ -80,4 +81,4 @@ - \ No newline at end of file + diff --git a/src/Features/CSharp/Portable/UsePatternCombinators/CSharpUsePatternCombinatorsCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UsePatternCombinators/CSharpUsePatternCombinatorsCodeFixProvider.cs similarity index 97% rename from src/Features/CSharp/Portable/UsePatternCombinators/CSharpUsePatternCombinatorsCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/UsePatternCombinators/CSharpUsePatternCombinatorsCodeFixProvider.cs index 9a02160af5a77..8dff5954c094b 100644 --- a/src/Features/CSharp/Portable/UsePatternCombinators/CSharpUsePatternCombinatorsCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePatternCombinators/CSharpUsePatternCombinatorsCodeFixProvider.cs @@ -118,7 +118,7 @@ private static PatternSyntax AsPatternSyntax(AnalyzedPattern pattern) private static ExpressionSyntax AsExpressionSyntax(ExpressionSyntax expr, AnalyzedPattern p) { var semanticModel = p.Target.SemanticModel; - Debug.Assert(semanticModel != null); + RoslynDebug.Assert(semanticModel != null); var type = semanticModel.GetTypeInfo(expr).Type; if (type != null) { @@ -148,7 +148,9 @@ public MyCodeAction(string title, Func> create { } +#if !CODE_STYLE // 'CodeActionPriority' is not a public API, hence not supported in CodeStyle layer. internal override CodeActionPriority Priority => CodeActionPriority.Low; +#endif } } } From 2af25b679fa1731243e6bbc1f6f072fe826f8e3e Mon Sep 17 00:00:00 2001 From: DoctorKrolic Date: Fri, 25 Mar 2022 21:55:04 +0300 Subject: [PATCH 037/131] PR feedback 2, added generic constraints tests --- .../ImplementInterfaceTests.cs | 93 +++++++++++++++++++ ...entInterfaceService.AccessibilityHelper.cs | 42 +++++++-- 2 files changed, 127 insertions(+), 8 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs index a7f23a75cb112..f3380570364e8 100644 --- a/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs +++ b/src/EditorFeatures/CSharpTest/ImplementInterface/ImplementInterfaceTests.cs @@ -8568,6 +8568,99 @@ Container.Goo I.M() }"); } + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_InaccessibleGenericConstraintAsReturnType() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"internal class Goo {} + +internal interface I +{ + T M() where T: Goo; +} + +public class C : {|CS0535:I|} +{ +}", +@"internal class Goo {} + +internal interface I +{ + T M() where T: Goo; +} + +public class C : {|CS0535:I|} +{ + T I.M() + { + throw new System.NotImplementedException(); + } +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_InaccessibleGenericConstraintAsParameter() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"internal class Goo {} + +internal interface I +{ + void M(T arg) where T: Goo; +} + +public class C : {|CS0535:I|} +{ +}", +@"internal class Goo {} + +internal interface I +{ + void M(T arg) where T: Goo; +} + +public class C : {|CS0535:I|} +{ + void I.M(T arg) + { + throw new System.NotImplementedException(); + } +}"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] + [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] + public async Task TestAccessibility_InaccessibleGenericConstraintWhichIsNotUsed() + { + await TestWithAllCodeStyleOptionsOffAsync( +@"internal class Goo {} + +internal interface I +{ + void M() where T: Goo; +} + +public class C : {|CS0535:I|} +{ +}", +@"internal class Goo {} + +internal interface I +{ + void M() where T: Goo; +} + +public class C : {|CS0535:I|} +{ + void I.M() + { + throw new System.NotImplementedException(); + } +}"); + } + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsImplementInterface)] [WorkItem(4146, "https://github.com/dotnet/roslyn/issues/4146")] public async Task TestAccessibility_SeveralMembers_ShouldExplicitlyImplementOnlyInaccessible() diff --git a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs index 3bfa750dd1b0b..ca9e34d13e334 100644 --- a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs +++ b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs @@ -8,8 +8,13 @@ internal abstract partial class AbstractImplementInterfaceService { private static class AccessibilityHelper { - public static bool IsLessAccessibleThan(ISymbol first, INamedTypeSymbol second) + public static bool IsLessAccessibleThan(ISymbol? first, INamedTypeSymbol second) { + if (first is null) + { + return false; + } + if (first.DeclaredAccessibility <= Accessibility.NotApplicable || second.DeclaredAccessibility <= Accessibility.NotApplicable) { @@ -29,14 +34,12 @@ public static bool IsLessAccessibleThan(ISymbol first, INamedTypeSymbol second) return true; } - if (propertySymbol.GetMethod is not null && - IsLessAccessibleThan(propertySymbol.GetMethod, second)) + if (IsLessAccessibleThan(propertySymbol.GetMethod, second)) { return true; } - if (propertySymbol.SetMethod is not null && - IsLessAccessibleThan(propertySymbol.SetMethod, second)) + if (IsLessAccessibleThan(propertySymbol.SetMethod, second)) { return true; } @@ -57,6 +60,14 @@ public static bool IsLessAccessibleThan(ISymbol first, INamedTypeSymbol second) } } + foreach (var typeArg in methodSymbol.TypeArguments) + { + if (IsTypeLessAccessibleThanOtherType(typeArg, second)) + { + return true; + } + } + return false; case IEventSymbol eventSymbol: @@ -67,8 +78,24 @@ public static bool IsLessAccessibleThan(ISymbol first, INamedTypeSymbol second) } } - private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol first, INamedTypeSymbol second) + private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol? first, INamedTypeSymbol second) { + if (first is null) + { + return false; + } + + if (first is ITypeParameterSymbol typeParameter) + { + foreach (var constraint in typeParameter.ConstraintTypes) + { + if (IsTypeLessAccessibleThanOtherType(constraint, second)) + { + return true; + } + } + } + if (first.DeclaredAccessibility <= Accessibility.NotApplicable || second.DeclaredAccessibility <= Accessibility.NotApplicable) { @@ -91,8 +118,7 @@ private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol first, INamedT } } - if (first.ContainingType is not null && - IsTypeLessAccessibleThanOtherType(first.ContainingType, second)) + if (IsTypeLessAccessibleThanOtherType(first.ContainingType, second)) { return true; } From f56bf04e745fd1f209eb17c71283b496503dc160 Mon Sep 17 00:00:00 2001 From: DoctorKrolic Date: Sun, 27 Mar 2022 20:09:23 +0300 Subject: [PATCH 038/131] Do not recommend async if such modifier is already present --- .../AsyncKeywordRecommenderTests.cs | 35 ++++++++++++++++++- .../AsyncKeywordRecommender.cs | 3 +- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/src/EditorFeatures/CSharpTest2/Recommendations/AsyncKeywordRecommenderTests.cs b/src/EditorFeatures/CSharpTest2/Recommendations/AsyncKeywordRecommenderTests.cs index 087ed6b5f5ebb..5263fa23ec4f1 100644 --- a/src/EditorFeatures/CSharpTest2/Recommendations/AsyncKeywordRecommenderTests.cs +++ b/src/EditorFeatures/CSharpTest2/Recommendations/AsyncKeywordRecommenderTests.cs @@ -40,6 +40,15 @@ await VerifyKeywordAsync(@"class C }"); } + [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] + public async Task TestMethodDeclarationAsyncAfterCursor() + { + await VerifyKeywordAsync(@"class C +{ + public $$ async void goo() { } +}"); + } + [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestInsideInterface() { @@ -219,7 +228,7 @@ static void Main(string[] args) } [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] - public async Task TestNotIfAlreadyAsync2() + public async Task TestNotIfAlreadyAsyncInLambda() { await VerifyAbsenceAsync(@" class Program @@ -231,6 +240,30 @@ static void Main(string[] args) }"); } + [WorkItem(60340, "https://github.com/dotnet/roslyn/issues/60340")] + [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] + public async Task TestNotIfAlreadyAsyncBeforeOtherMember() + { + await VerifyAbsenceAsync(@" +class Program +{ + async $$ + + public void M() {} +}"); + } + + [WorkItem(60340, "https://github.com/dotnet/roslyn/issues/60340")] + [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] + public async Task TestNotIfAlreadyAsyncAsLastMember() + { + await VerifyAbsenceAsync(@" +class Program +{ + async $$ +}"); + } + [WorkItem(578061, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/578061")] [Fact, Trait(Traits.Feature, Traits.Features.KeywordRecommending)] public async Task TestNotInNamespace() diff --git a/src/Features/CSharp/Portable/Completion/KeywordRecommenders/AsyncKeywordRecommender.cs b/src/Features/CSharp/Portable/Completion/KeywordRecommenders/AsyncKeywordRecommender.cs index 352a3008eb108..f4f7c4fd92320 100644 --- a/src/Features/CSharp/Portable/Completion/KeywordRecommenders/AsyncKeywordRecommender.cs +++ b/src/Features/CSharp/Portable/Completion/KeywordRecommenders/AsyncKeywordRecommender.cs @@ -27,7 +27,8 @@ public AsyncKeywordRecommender() protected override bool IsValidContext(int position, CSharpSyntaxContext context, CancellationToken cancellationToken) { - if (context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword)) + if (context.TargetToken.IsKindOrHasMatchingText(SyntaxKind.PartialKeyword) || + context.PrecedingModifiers.Contains(SyntaxKind.AsyncKeyword)) { return false; } From 2aed89bfee5d5318cb62108be76365befb656c38 Mon Sep 17 00:00:00 2001 From: DoctorKrolic <70431552+DoctorKrolic@users.noreply.github.com> Date: Mon, 28 Mar 2022 09:53:32 +0300 Subject: [PATCH 039/131] Highlight `await` and `return` in top-level statements (#60401) --- .../KeywordHighlighting/AwaitHighlighterTests.cs | 9 +++++++++ .../ReturnStatementHighlighterTests.cs | 8 ++++++++ .../KeywordHighlighters/AsyncAwaitHighlighter.cs | 2 +- .../KeywordHighlighters/ReturnStatementHighlighter.cs | 2 +- .../Highlighting/Keywords/AbstractKeywordHighlighter.cs | 2 -- .../Compiler/CSharp/Extensions/SyntaxNodeExtensions.cs | 3 +++ 6 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/KeywordHighlighting/AwaitHighlighterTests.cs b/src/EditorFeatures/CSharpTest/KeywordHighlighting/AwaitHighlighterTests.cs index 300f1103c6e8e..2f97ca1e1ce4d 100644 --- a/src/EditorFeatures/CSharpTest/KeywordHighlighting/AwaitHighlighterTests.cs +++ b/src/EditorFeatures/CSharpTest/KeywordHighlighting/AwaitHighlighterTests.cs @@ -323,5 +323,14 @@ class C } }"); } + + [WorkItem(60400, "https://github.com/dotnet/roslyn/issues/60400")] + [Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)] + public async Task TestTopLevelStatements() + { + await TestAsync( +@"[|await|] Task.Delay(1000); +{|Cursor:[|await|]|} Task.Run(() => { })"); + } } } diff --git a/src/EditorFeatures/CSharpTest/KeywordHighlighting/ReturnStatementHighlighterTests.cs b/src/EditorFeatures/CSharpTest/KeywordHighlighting/ReturnStatementHighlighterTests.cs index cf65cd3e02634..2c98a44fd523a 100644 --- a/src/EditorFeatures/CSharpTest/KeywordHighlighting/ReturnStatementHighlighterTests.cs +++ b/src/EditorFeatures/CSharpTest/KeywordHighlighting/ReturnStatementHighlighterTests.cs @@ -462,5 +462,13 @@ void M() } }"); } + + [Fact, Trait(Traits.Feature, Traits.Features.KeywordHighlighting)] + public async Task TestInTopLevelStatements() + { + await TestAsync( +@"if (args.Length > 0) [|return|] 0; +{|Cursor:[|return|]|} 1;"); + } } } diff --git a/src/Features/CSharp/Portable/Highlighting/KeywordHighlighters/AsyncAwaitHighlighter.cs b/src/Features/CSharp/Portable/Highlighting/KeywordHighlighters/AsyncAwaitHighlighter.cs index 0ab3840d6ee87..ceeda438aa24a 100644 --- a/src/Features/CSharp/Portable/Highlighting/KeywordHighlighters/AsyncAwaitHighlighter.cs +++ b/src/Features/CSharp/Portable/Highlighting/KeywordHighlighters/AsyncAwaitHighlighter.cs @@ -31,7 +31,7 @@ public AsyncAwaitHighlighter() } protected override bool IsHighlightableNode(SyntaxNode node) - => node.IsReturnableConstruct(); + => node.IsReturnableConstructOrTopLevelCompilationUnit(); protected override void AddHighlightsForNode(SyntaxNode node, List highlights, CancellationToken cancellationToken) { diff --git a/src/Features/CSharp/Portable/Highlighting/KeywordHighlighters/ReturnStatementHighlighter.cs b/src/Features/CSharp/Portable/Highlighting/KeywordHighlighters/ReturnStatementHighlighter.cs index 53f181f0c3a32..343aebba09a6f 100644 --- a/src/Features/CSharp/Portable/Highlighting/KeywordHighlighters/ReturnStatementHighlighter.cs +++ b/src/Features/CSharp/Portable/Highlighting/KeywordHighlighters/ReturnStatementHighlighter.cs @@ -32,7 +32,7 @@ protected override void AddHighlights( { var parent = returnStatement .GetAncestorsOrThis() - .FirstOrDefault(n => n.IsReturnableConstruct()); + .FirstOrDefault(n => n.IsReturnableConstructOrTopLevelCompilationUnit()); if (parent == null) { diff --git a/src/Features/Core/Portable/Highlighting/Keywords/AbstractKeywordHighlighter.cs b/src/Features/Core/Portable/Highlighting/Keywords/AbstractKeywordHighlighter.cs index aa1183be975bb..b5bc18acf5efb 100644 --- a/src/Features/Core/Portable/Highlighting/Keywords/AbstractKeywordHighlighter.cs +++ b/src/Features/Core/Portable/Highlighting/Keywords/AbstractKeywordHighlighter.cs @@ -5,11 +5,9 @@ #nullable disable using System.Collections.Generic; -using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Text; -using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Highlighting { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxNodeExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxNodeExtensions.cs index 01d10b131eafe..f871109bd3457 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxNodeExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxNodeExtensions.cs @@ -626,6 +626,9 @@ public static bool IsReturnableConstruct(this SyntaxNode node) return false; } + public static bool IsReturnableConstructOrTopLevelCompilationUnit(this SyntaxNode node) + => node.IsReturnableConstruct() || (node is CompilationUnitSyntax compilationUnit && compilationUnit.Members.Any(SyntaxKind.GlobalStatement)); + public static bool SpansPreprocessorDirective(this IEnumerable list) where TSyntaxNode : SyntaxNode => CSharpSyntaxFacts.Instance.SpansPreprocessorDirective(list); From 43c4b1b101156f2766707914eed898857992c28f Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 28 Mar 2022 13:39:03 -0700 Subject: [PATCH 040/131] Support adding new assembly level attributes with SyntaxGenerator when some already exist in the document Fixes #60399 --- .../CodeGeneration/CSharpSyntaxGenerator.cs | 14 +++++++++++-- .../CodeGeneration/SyntaxGeneratorTests.cs | 8 ++++++++ .../VisualBasicSyntaxGenerator.vb | 20 +++++++++++++++++-- .../CodeGeneration/SyntaxGeneratorTests.vb | 12 +++++++++++ 4 files changed, 50 insertions(+), 4 deletions(-) diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs index 662815b7b6333..66876defa2e0d 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs @@ -998,11 +998,11 @@ private SyntaxNode InsertAttributesInternal(SyntaxNode declaration, int index, I var existingAttributes = this.GetAttributes(declaration); if (index >= 0 && index < existingAttributes.Count) { - return this.InsertNodesBefore(declaration, existingAttributes[index], newAttributes); + return this.InsertNodesBefore(declaration, existingAttributes[index], WithRequiredTargetSpecifier(newAttributes, declaration)); } else if (existingAttributes.Count > 0) { - return this.InsertNodesAfter(declaration, existingAttributes[existingAttributes.Count - 1], newAttributes); + return this.InsertNodesAfter(declaration, existingAttributes[existingAttributes.Count - 1], WithRequiredTargetSpecifier(newAttributes, declaration)); } else { @@ -1059,6 +1059,16 @@ private static SyntaxList AsAssemblyAttributes(IEnumerable< attributes.Select(list => list.WithTarget(SyntaxFactory.AttributeTargetSpecifier(SyntaxFactory.Token(SyntaxKind.AssemblyKeyword))))); } + private static SyntaxList WithRequiredTargetSpecifier(SyntaxList attributes, SyntaxNode declaration) + { + if (!declaration.IsKind(SyntaxKind.CompilationUnit)) + { + return attributes; + } + + return AsAssemblyAttributes(attributes); + } + public override IReadOnlyList GetAttributeArguments(SyntaxNode attributeDeclaration) { switch (attributeDeclaration.Kind()) diff --git a/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs b/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs index c3d3e7912249a..5b60a15647e83 100644 --- a/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs +++ b/src/Workspaces/CSharpTest/CodeGeneration/SyntaxGeneratorTests.cs @@ -1588,6 +1588,14 @@ public void TestAddAttributes() Generator.CompilationUnit(Generator.NamespaceDeclaration("n")), Generator.Attribute("a")), "[assembly: a]\r\nnamespace n\r\n{\r\n}"); + + VerifySyntax( + Generator.AddAttributes( + Generator.AddAttributes( + Generator.CompilationUnit(Generator.NamespaceDeclaration("n")), + Generator.Attribute("a")), + Generator.Attribute("b")), + "[assembly: a]\r\n[assembly: b]\r\nnamespace n\r\n{\r\n}"); } [Fact] diff --git a/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb b/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb index c168e150cb122..4420d40bbad44 100644 --- a/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb +++ b/src/Workspaces/VisualBasic/Portable/CodeGeneration/VisualBasicSyntaxGenerator.vb @@ -1637,6 +1637,15 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration End Function Public Overrides Function GetAttributes(declaration As SyntaxNode) As IReadOnlyList(Of SyntaxNode) + If declaration.IsKind(SyntaxKind.CompilationUnit) Then + ' CompilationUnit syntaxes represent attribute lists in a way that we can't get a single AttributeList for all of the attributes in all cases. + ' However, some consumers of this API assume that all returned values are children of "declaration", so if there's one attribute list, we'll use + ' that value directly if possible. + Dim compilationUnit = DirectCast(declaration, CompilationUnitSyntax) + If compilationUnit.Attributes.Count = 1 Then + Return compilationUnit.Attributes(0).AttributeLists + End If + End If Return Me.Flatten(declaration.GetAttributeLists()) End Function @@ -1649,9 +1658,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration Dim existingAttributes = Me.GetAttributes(declaration) If index >= 0 AndAlso index < existingAttributes.Count Then - Return Me.InsertNodesBefore(declaration, existingAttributes(index), newAttributes) + Return Me.InsertNodesBefore(declaration, existingAttributes(index), WithRequiredTargetSpecifier(newAttributes, declaration)) ElseIf existingAttributes.Count > 0 Then - Return Me.InsertNodesAfter(declaration, existingAttributes(existingAttributes.Count - 1), newAttributes) + Return Me.InsertNodesAfter(declaration, existingAttributes(existingAttributes.Count - 1), WithRequiredTargetSpecifier(newAttributes, declaration)) Else Dim lists = GetAttributeLists(declaration) Return Me.WithAttributeLists(declaration, lists.AddRange(AsAttributeLists(attributes))) @@ -1678,6 +1687,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeGeneration End If End Function + Private Function WithRequiredTargetSpecifier(attributes As SyntaxList(Of AttributeListSyntax), declaration As SyntaxNode) As SyntaxList(Of AttributeListSyntax) + If Not declaration.IsKind(SyntaxKind.CompilationUnit) Then + Return attributes + End If + Return SyntaxFactory.List(attributes.Select(AddressOf WithAssemblyTargets)) + End Function + Public Overrides Function GetReturnAttributes(declaration As SyntaxNode) As IReadOnlyList(Of SyntaxNode) Return Me.Flatten(GetReturnAttributeLists(declaration)) End Function diff --git a/src/Workspaces/VisualBasicTest/CodeGeneration/SyntaxGeneratorTests.vb b/src/Workspaces/VisualBasicTest/CodeGeneration/SyntaxGeneratorTests.vb index 4c2f1c33d4d64..36328d79373d0 100644 --- a/src/Workspaces/VisualBasicTest/CodeGeneration/SyntaxGeneratorTests.vb +++ b/src/Workspaces/VisualBasicTest/CodeGeneration/SyntaxGeneratorTests.vb @@ -2181,6 +2181,18 @@ End Class") " Namespace n End Namespace +") + + VerifySyntax(Of CompilationUnitSyntax)( + Generator.AddAttributes( + Generator.AddAttributes( + Generator.CompilationUnit(Generator.NamespaceDeclaration("n")), + Generator.Attribute("a")), + Generator.Attribute("b")), +" + +Namespace n +End Namespace ") VerifySyntax(Of DelegateStatementSyntax)( From a838dcfc37a7f22018fddcf7d36b241254f14d58 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 29 Mar 2022 09:05:22 +1100 Subject: [PATCH 041/131] Don't complete quotes if they complete a valid string (#60227) --- .../AutomaticLiteralCompletionTests.cs | 65 +++++++++++++++++++ .../StringLiteralBraceCompletionService.cs | 38 +++++++++++ 2 files changed, 103 insertions(+) diff --git a/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLiteralCompletionTests.cs b/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLiteralCompletionTests.cs index cb7076a293295..da05f60f93d59 100644 --- a/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLiteralCompletionTests.cs +++ b/src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLiteralCompletionTests.cs @@ -429,6 +429,71 @@ void Method() CheckStart(session.Session, expectValidSession: false); } + [WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] + [WorkItem(59178, "https://github.com/dotnet/roslyn/issues/59178")] + public void String_CompleteLiteral() + { + var code = @"class C +{ + void Method() + { + var s = ""this"" + $$that""; + } +}"; + using var session = CreateSessionDoubleQuote(code); + Assert.NotNull(session); + CheckStart(session.Session, expectValidSession: false); + } + + [WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] + [WorkItem(59178, "https://github.com/dotnet/roslyn/issues/59178")] + public void String_BeforeOtherString1() + { + var code = @"class C +{ + void Method() + { + var s = $$ + "" + bar""; + } +}"; + using var session = CreateSessionDoubleQuote(code); + Assert.NotNull(session); + CheckStart(session.Session); + } + + [WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] + [WorkItem(59178, "https://github.com/dotnet/roslyn/issues/59178")] + public void String_BeforeOtherString2() + { + var code = @"class C +{ + void Method() + { + var s = $$ + ""; } ""; + } +}"; + using var session = CreateSessionDoubleQuote(code); + Assert.NotNull(session); + CheckStart(session.Session); + } + + [WpfFact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] + [WorkItem(59178, "https://github.com/dotnet/roslyn/issues/59178")] + public void String_DontCompleteVerbatim() + { + var code = @"class C +{ + void Method() + { + var s = ""this"" + @$$that + and this""; + } +}"; + using var session = CreateSessionDoubleQuote(code); + Assert.NotNull(session); + CheckStart(session.Session); + } + internal static Holder CreateSessionSingleQuote(string code) { return CreateSession( diff --git a/src/Features/CSharp/Portable/BraceCompletion/StringLiteralBraceCompletionService.cs b/src/Features/CSharp/Portable/BraceCompletion/StringLiteralBraceCompletionService.cs index 0ae0c5025aea4..106fa4d11fdd4 100644 --- a/src/Features/CSharp/Portable/BraceCompletion/StringLiteralBraceCompletionService.cs +++ b/src/Features/CSharp/Portable/BraceCompletion/StringLiteralBraceCompletionService.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.BraceCompletion; +using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; @@ -53,6 +54,27 @@ protected override Task IsValidOpenBraceTokenAtPositionAsync(SyntaxToken t return SpecializedTasks.False; } + // If the single token that the user typed is a string literal that is more than just + // the one double quote character they typed, and the line doesn't have errors, then + // it means it is completing an existing token, from the start. For example given: + // + // var s = "te$$st"; + // + // When the user types `" + "` to split the string into two literals, the first + // quote won't be completed (because its in a string literal), and with this check + // the second quote won't either. + // + // We don't do this optimization for verbatim strings because they are multi-line so + // the flow on effects from us getting it wrong are much greater, and it can really change + // the tree. + if (token.IsKind(SyntaxKind.StringLiteralToken) && + !token.IsVerbatimStringLiteral() && + token.Span.Length > 1 && + !RestOfLineContainsDiagnostics(token)) + { + return SpecializedTasks.False; + } + if (token.SpanStart == position) { return SpecializedTasks.True; @@ -63,5 +85,21 @@ protected override Task IsValidOpenBraceTokenAtPositionAsync(SyntaxToken t // is the @ character and the " is one past the token start. return Task.FromResult(token.SpanStart + 1 == position && token.IsVerbatimStringLiteral()); } + + private static bool RestOfLineContainsDiagnostics(SyntaxToken token) + { + while (!token.TrailingTrivia.Contains(t => t.IsEndOfLine())) + { + if (token.ContainsDiagnostics) + return true; + + token = token.GetNextToken(); + } + + if (token.ContainsDiagnostics) + return true; + + return false; + } } } From dc763481eec978fa4f6d024ac0e508ba3ab14422 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 29 Mar 2022 09:41:02 +1100 Subject: [PATCH 042/131] Don't offer to use patterns when they won't work (#60370) Co-authored-by: Youssef1313 --- .../UsePatternCombinators/AnalyzedPattern.cs | 49 +++++- .../CSharpUsePatternCombinatorsAnalyzer.cs | 4 +- ...tternCombinatorsDiagnosticAnalyzerTests.cs | 147 ++++++++++++++++++ 3 files changed, 197 insertions(+), 3 deletions(-) diff --git a/src/Analyzers/CSharp/Analyzers/UsePatternCombinators/AnalyzedPattern.cs b/src/Analyzers/CSharp/Analyzers/UsePatternCombinators/AnalyzedPattern.cs index 31b610a0b1e66..5c001fbb29c90 100644 --- a/src/Analyzers/CSharp/Analyzers/UsePatternCombinators/AnalyzedPattern.cs +++ b/src/Analyzers/CSharp/Analyzers/UsePatternCombinators/AnalyzedPattern.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Linq; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Operations; using Roslyn.Utilities; @@ -23,9 +24,55 @@ private AnalyzedPattern(IOperation target) /// internal sealed class Type : AnalyzedPattern { + private static readonly SyntaxAnnotation s_annotation = new(); + + public static Type? TryCreate(BinaryExpressionSyntax binaryExpression, IIsTypeOperation operation) + { + Contract.ThrowIfNull(operation.SemanticModel); + if (binaryExpression.Right is not TypeSyntax typeSyntax) + { + return null; + } + + // We are coming from a type pattern, which likes to bind to types, but converting to + // patters which like to bind to expressions. For example, given: + // + // if (T is C.X || T is Y) { } + // + // we would want to convert to: + // + // if (T is C.X or Y) + // + // In the first case the compiler will bind to types named C or Y that are in scope + // but in the second it will also bind to a fields, methods etc. which for 'Y' changes + // semantics, and for 'C.X' could be a compile error. + // + // So lets create a pattern syntax and make sure the result is the same + var dummyStatement = SyntaxFactory.ExpressionStatement(SyntaxFactory.AssignmentExpression( + SyntaxKind.SimpleAssignmentExpression, + SyntaxFactory.IdentifierName("_"), + SyntaxFactory.IsPatternExpression( + binaryExpression.Left, + SyntaxFactory.ConstantPattern(SyntaxFactory.ParenthesizedExpression(binaryExpression.Right.WithAdditionalAnnotations(s_annotation))) + ) + )); + + if (operation.SemanticModel.TryGetSpeculativeSemanticModel(typeSyntax.SpanStart, dummyStatement, out var speculativeModel)) + { + var originalInfo = operation.SemanticModel.GetTypeInfo(binaryExpression.Right); + var newInfo = speculativeModel.GetTypeInfo(dummyStatement.GetAnnotatedNodes(s_annotation).Single()); + if (!originalInfo.Equals(newInfo)) + { + return null; + } + } + + return new Type(typeSyntax, operation.ValueOperand); + } + public readonly TypeSyntax TypeSyntax; - public Type(TypeSyntax type, IOperation target) : base(target) + private Type(TypeSyntax type, IOperation target) : base(target) => TypeSyntax = type; } diff --git a/src/Analyzers/CSharp/Analyzers/UsePatternCombinators/CSharpUsePatternCombinatorsAnalyzer.cs b/src/Analyzers/CSharp/Analyzers/UsePatternCombinators/CSharpUsePatternCombinatorsAnalyzer.cs index d809df97b04b0..f915fa2dd5d4f 100644 --- a/src/Analyzers/CSharp/Analyzers/UsePatternCombinators/CSharpUsePatternCombinatorsAnalyzer.cs +++ b/src/Analyzers/CSharp/Analyzers/UsePatternCombinators/CSharpUsePatternCombinatorsAnalyzer.cs @@ -59,8 +59,8 @@ private enum ConstantResult case IUnaryOperation { OperatorKind: UnaryOperatorKind.Not } op: return Not.TryCreate(ParsePattern(op.Operand)); - case IIsTypeOperation { Syntax: BinaryExpressionSyntax { Right: TypeSyntax type } } op: - return new Type(type, op.ValueOperand); + case IIsTypeOperation { Syntax: BinaryExpressionSyntax binaryExpression } op: + return Type.TryCreate(binaryExpression, op); case IIsPatternOperation { Pattern: { Syntax: PatternSyntax pattern } } op: return new Source(pattern, op.Value); diff --git a/src/EditorFeatures/CSharpTest/UsePatternCombinators/CSharpUsePatternCombinatorsDiagnosticAnalyzerTests.cs b/src/EditorFeatures/CSharpTest/UsePatternCombinators/CSharpUsePatternCombinatorsDiagnosticAnalyzerTests.cs index 6e5ab88b5a2af..a95c7375ac0d4 100644 --- a/src/EditorFeatures/CSharpTest/UsePatternCombinators/CSharpUsePatternCombinatorsDiagnosticAnalyzerTests.cs +++ b/src/EditorFeatures/CSharpTest/UsePatternCombinators/CSharpUsePatternCombinatorsDiagnosticAnalyzerTests.cs @@ -105,6 +105,8 @@ public async Task TestMissingOnExpression(string expression) [InlineData("i == default || i > default(int)", "i is default(int) or > (default(int))")] [InlineData("!(o is C c)", "o is not C c")] [InlineData("o is int ii && o is long jj", "o is int ii and long jj")] + [InlineData("o is string || o is Exception", "o is string or Exception")] + [InlineData("o is System.String || o is System.Exception", "o is System.String or System.Exception")] [InlineData("!(o is C)", "o is not C")] [InlineData("!(o is C _)", "o is not C _")] [InlineData("i == (0x02 | 0x04) || i != 0", "i is (0x02 | 0x04) or not 0")] @@ -477,6 +479,151 @@ void M(char c) } } } +"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUsePatternCombinators)] + [WorkItem(57199, "https://github.com/dotnet/roslyn/issues/57199")] + public async Task TestMissingInNonConvertibleTypePattern1() + { + await TestMissingAsync( +@" +static class C +{ + public struct S1 : I { } + public struct S2 : I { } + public interface I { } +} + +class Test +{ + public readonly T C; + bool P => [|C is C.S1 || C is C.S2|]; +} +"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUsePatternCombinators)] + [WorkItem(57199, "https://github.com/dotnet/roslyn/issues/57199")] + public async Task TestMissingInNonConvertibleTypePattern2() + { + await TestMissingAsync( +@" + class Goo + { + private class X { } + private class Y { } + + private void M(object o) + { + var X = 1; + var Y = 2; + + if [|(o is X || o is Y)|] + { + } + } + } +"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUsePatternCombinators)] + [WorkItem(57199, "https://github.com/dotnet/roslyn/issues/57199")] + public async Task TestMissingInNonConvertibleTypePattern3() + { + await TestMissingAsync( +@" + class Goo + { + private class X { } + private class Y { } + private void M(object o) + { + var X = 1; + var Y = 2; + if [|(o is global::Goo.X || o is Y)|] + { + } + } + } +"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUsePatternCombinators)] + [WorkItem(57199, "https://github.com/dotnet/roslyn/issues/57199")] + public async Task TestInConvertibleTypePattern() + { + await TestInRegularAndScriptAsync( +@" +static class C +{ + public struct S1 : I { } + public struct S2 : I { } + public interface I { } +} + +class Test +{ + bool P => [|C is C.S1 || C is C.S2|]; +} +", + +@" +static class C +{ + public struct S1 : I { } + public struct S2 : I { } + public interface I { } +} + +class Test +{ + bool P => C is C.S1 or C.S2; +} +"); + } + + [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsUsePatternCombinators)] + [WorkItem(57199, "https://github.com/dotnet/roslyn/issues/57199")] + public async Task TestInConvertibleTypePattern2() + { + await TestInRegularAndScriptAsync( +@" +public class Goo +{ + private class X { } + private class Y { } + + private void M(object o) + { + var X = 1; + var Y = 2; + + var @int = 1; + var @long = 2; + if [|(o is int || o is long)|] + { + } + } +} +", @" +public class Goo +{ + private class X { } + private class Y { } + + private void M(object o) + { + var X = 1; + var Y = 2; + + var @int = 1; + var @long = 2; + if (o is int or long) + { + } + } +} "); } } From a1ca907c159b4d546b51fa4f2c8ca994f3b58382 Mon Sep 17 00:00:00 2001 From: AlekseyTs Date: Mon, 28 Mar 2022 17:16:56 -0700 Subject: [PATCH 043/131] Add UnsignedRightShift feature to "Language Feature Status.md" (#60435) --- docs/Language Feature Status.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/Language Feature Status.md b/docs/Language Feature Status.md index 731ff614266a2..cfa43ae675dde 100644 --- a/docs/Language Feature Status.md +++ b/docs/Language Feature Status.md @@ -28,8 +28,10 @@ efforts behind them. | [nameof accessing instance members](https://github.com/dotnet/roslyn/issues/40229) | main | [In Progress](https://github.com/dotnet/roslyn/pull/48754) | [YairHalberstadt ](https://github.com/YairHalberstadt) | [333fred](https://github.com/333fred), [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred) | | [Utf8 String Literals](https://github.com/dotnet/csharplang/issues/184) | [Utf8StringLiterals](https://github.com/dotnet/roslyn/tree/features/Utf8StringLiterals) | [In Progress](https://github.com/dotnet/roslyn/issues/58848) | [AlekseyTs](https://github.com/AlekseyTs) | [cston](https://github.com/cston), [RikkiGibson](https://github.com/RikkiGibson) | [MadsTorgersen](https://github.com/MadsTorgersen) | | [ref fields](https://github.com/dotnet/csharplang/blob/main/proposals/low-level-struct-improvements.md) | [ref-fields](https://github.com/dotnet/roslyn/tree/features/ref-fields) | [In Progress](https://github.com/dotnet/roslyn/issues/59194) | [cston](https://github.com/cston) | [RikkiGibson](https://github.com/RikkiGibson), [AlekseyTs](https://github.com/AlekseyTs) | [jaredpar](https://github.com/jaredpar) | -| [checked operators](https://github.com/dotnet/csharplang/issues/4665) | [CheckedUserDefinedOperators](https://github.com/dotnet/roslyn/tree/features/CheckedUserDefinedOperators) | [In Progress](https://github.com/dotnet/roslyn/issues/59458) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [chsienki](https://github.com/chsienki) | [AlekseyTs](https://github.com/AlekseyTs) | +| [Checked Operators](https://github.com/dotnet/csharplang/issues/4665) | [CheckedUserDefinedOperators](https://github.com/dotnet/roslyn/tree/features/CheckedUserDefinedOperators) | [In Progress](https://github.com/dotnet/roslyn/issues/59458) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [chsienki](https://github.com/chsienki) | [AlekseyTs](https://github.com/AlekseyTs) | | [auto-default structs](https://github.com/dotnet/csharplang/issues/5737) | main | [In Progress](https://github.com/dotnet/roslyn/issues/60167) | [RikkiGibson](https://github.com/RikkiGibson) | [cston](https://github.com/cston), [jcouv](https://github.com/jcouv) | +| [Unsigned Right Shift](https://github.com/dotnet/csharplang/issues/4682) | [UnsignedRightShift](https://github.com/dotnet/roslyn/tree/features/UnsignedRightShift) | [In Progress](https://github.com/dotnet/roslyn/issues/60433) | [AlekseyTs](https://github.com/AlekseyTs) | TBD | [AlekseyTs](https://github.com/AlekseyTs) | + # C# 10.0 From 0ead73d911285c4ff3ec57ab1584c491809d68df Mon Sep 17 00:00:00 2001 From: David Barbet Date: Mon, 28 Mar 2022 17:20:59 -0700 Subject: [PATCH 044/131] [LSP] Remove the majority of usages of client name. (#60357) * Remove the majority of usages of client name. The server should just return results for what it was asked for while the platform is responsible for asking for the correct buffers based on client name. * Remove unneeded extension * fix interface impl * Remove clientname from vsmac logger --- .../Lsp/VSMacLspLoggerFactoryWrapper.cs | 4 +- .../VSTypeScriptInProcLanguageClient.cs | 2 +- .../AbstractInProcLanguageClient.cs | 10 +--- .../AlwaysActivateInProcLanguageClient.cs | 2 +- .../Handlers/Completion/CompletionHandler.cs | 3 +- .../LiveShareInProcLanguageClient.cs | 2 +- .../RazorInProcLanguageClient.cs | 2 +- .../AbstractLanguageServerProtocolTests.cs | 5 +- .../CSharpVisualBasicLanguageServerFactory.cs | 1 - .../Protocol/Extensions/Extensions.cs | 49 +------------------ .../VSMac/API/VSMacLspLoggerFactory.cs | 2 +- .../AbstractPullDiagnosticHandler.cs | 23 ++------- .../DocumentPullDiagnosticHandler.cs | 3 +- ...alDocumentPullDiagnosticHandlerProvider.cs | 2 +- ...erimentalDocumentPullDiagnosticsHandler.cs | 3 +- ...lWorkspacePullDiagnosticHandlerProvider.cs | 2 +- ...rimentalWorkspacePullDiagnosticsHandler.cs | 3 +- .../PullDiagnosticHandlerProvider.cs | 4 +- .../WorkspacePullDiagnosticHandler.cs | 14 ++++-- .../OnAutoInsert/OnAutoInsertHandler.cs | 2 +- .../GetTextDocumentWithContextHandler.cs | 2 +- .../Protocol/Handler/RequestContext.cs | 16 +++--- .../RequestExecutionQueue.QueueItem.cs | 9 ---- .../Protocol/Handler/RequestExecutionQueue.cs | 7 +-- .../SemanticTokensRangeHandler.cs | 1 + .../Protocol/ILspLoggerFactory.cs | 2 +- .../Protocol/LanguageServerTarget.cs | 5 -- .../Protocol/RequestDispatcher.cs | 6 +-- .../Workspaces/LspWorkspaceManager.cs | 18 +++---- .../DocumentChangesTests.LinkedDocuments.cs | 2 +- .../OnAutoInsert/OnAutoInsertTests.cs | 19 ++++--- .../VSTypeScriptHandlerTests.cs | 1 - .../Workspaces/LspWorkspaceManagerTests.cs | 2 +- .../VisualStudioLogHubLoggerFactory.cs | 4 +- .../XamlInProcLanguageClient.cs | 2 +- .../XamlInProcLanguageClientDisableUX.cs | 2 +- .../AbstractPullDiagnosticHandler.cs | 2 +- .../XamlRequestDispatcherFactory.cs | 4 +- 38 files changed, 79 insertions(+), 163 deletions(-) diff --git a/src/EditorFeatures/Core.Cocoa/Lsp/VSMacLspLoggerFactoryWrapper.cs b/src/EditorFeatures/Core.Cocoa/Lsp/VSMacLspLoggerFactoryWrapper.cs index 00a6a4bc30d1a..4f33afef6eae2 100644 --- a/src/EditorFeatures/Core.Cocoa/Lsp/VSMacLspLoggerFactoryWrapper.cs +++ b/src/EditorFeatures/Core.Cocoa/Lsp/VSMacLspLoggerFactoryWrapper.cs @@ -29,9 +29,9 @@ public VSMacLspLoggerFactoryWrapper(IVSMacLspLoggerFactory loggerFactory) _loggerFactory = loggerFactory; } - public async Task CreateLoggerAsync(string serverTypeName, string? clientName, JsonRpc jsonRpc, CancellationToken cancellationToken) + public async Task CreateLoggerAsync(string serverTypeName, JsonRpc jsonRpc, CancellationToken cancellationToken) { - var vsMacLogger = await _loggerFactory.CreateLoggerAsync(serverTypeName, clientName, jsonRpc, cancellationToken).ConfigureAwait(false); + var vsMacLogger = await _loggerFactory.CreateLoggerAsync(serverTypeName, jsonRpc, cancellationToken).ConfigureAwait(false); return new VSMacLspLoggerWrapper(vsMacLogger); } } diff --git a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs index 581a73347d60f..abaab663d4662 100644 --- a/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/ExternalAccess/VSTypeScript/VSTypeScriptInProcLanguageClient.cs @@ -45,7 +45,7 @@ public VSTypeScriptInProcLanguageClient( DefaultCapabilitiesProvider defaultCapabilitiesProvider, ILspLoggerFactory lspLoggerFactory, IThreadingContext threadingContext) - : base(requestDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) + : base(requestDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext) { _typeScriptCapabilitiesProvider = typeScriptCapabilitiesProvider; } diff --git a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs index 4d83d2f9e422b..3d8f6f3083604 100644 --- a/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/AbstractInProcLanguageClient.cs @@ -24,7 +24,6 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.LanguageClient { internal abstract partial class AbstractInProcLanguageClient : ILanguageClient, ILanguageServerFactory, ICapabilitiesProvider { - private readonly string? _diagnosticsClientName; private readonly IThreadingContext _threadingContext; private readonly ILspLoggerFactory _lspLoggerFactory; @@ -86,14 +85,12 @@ public AbstractInProcLanguageClient( IAsynchronousOperationListenerProvider listenerProvider, LspWorkspaceRegistrationService lspWorkspaceRegistrationService, ILspLoggerFactory lspLoggerFactory, - IThreadingContext threadingContext, - string? diagnosticsClientName) + IThreadingContext threadingContext) { _requestDispatcherFactory = requestDispatcherFactory; GlobalOptions = globalOptions; _listenerProvider = listenerProvider; _lspWorkspaceRegistrationService = lspWorkspaceRegistrationService; - _diagnosticsClientName = diagnosticsClientName; _lspLoggerFactory = lspLoggerFactory; _threadingContext = threadingContext; } @@ -146,7 +143,6 @@ public AbstractInProcLanguageClient( serverStream, serverStream, _lspLoggerFactory, - _diagnosticsClientName, cancellationToken).ConfigureAwait(false); return new Connection(clientStream, clientStream); @@ -180,7 +176,6 @@ internal static async Task CreateAsync( Stream inputStream, Stream outputStream, ILspLoggerFactory lspLoggerFactory, - string? clientName, CancellationToken cancellationToken) { var jsonMessageFormatter = new JsonMessageFormatter(); @@ -193,7 +188,7 @@ internal static async Task CreateAsync( var serverTypeName = languageClient.GetType().Name; - var logger = await lspLoggerFactory.CreateLoggerAsync(serverTypeName, clientName, jsonRpc, cancellationToken).ConfigureAwait(false); + var logger = await lspLoggerFactory.CreateLoggerAsync(serverTypeName, jsonRpc, cancellationToken).ConfigureAwait(false); var server = languageClient.Create( jsonRpc, @@ -219,7 +214,6 @@ public ILanguageServerTarget Create( _listenerProvider, logger, SupportedLanguages, - clientName: _diagnosticsClientName, ServerKind); } diff --git a/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs index 00a02e18d5d98..211391339e227 100644 --- a/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/AlwaysActivateInProcLanguageClient.cs @@ -43,7 +43,7 @@ public AlwaysActivateInProcLanguageClient( DefaultCapabilitiesProvider defaultCapabilitiesProvider, ILspLoggerFactory lspLoggerFactory, IThreadingContext threadingContext) - : base(csharpVBRequestDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) + : base(csharpVBRequestDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext) { _defaultCapabilitiesProvider = defaultCapabilitiesProvider; } diff --git a/src/EditorFeatures/Core/LanguageServer/Handlers/Completion/CompletionHandler.cs b/src/EditorFeatures/Core/LanguageServer/Handlers/Completion/CompletionHandler.cs index aa228551b3a21..a8b0632caa5d9 100644 --- a/src/EditorFeatures/Core/LanguageServer/Handlers/Completion/CompletionHandler.cs +++ b/src/EditorFeatures/Core/LanguageServer/Handlers/Completion/CompletionHandler.cs @@ -127,7 +127,7 @@ public CompletionHandler( var completionItemResolveData = supportsCompletionListData ? null : completionResolveData; var lspCompletionItem = await CreateLSPCompletionItemAsync( request, document, item, completionItemResolveData, lspVSClientCapability, commitCharactersRuleCache, - completionService, context.ClientName, returnTextEdits, snippetsSupported, stringBuilder, documentText, + completionService, returnTextEdits, snippetsSupported, stringBuilder, documentText, defaultSpan, defaultRange, cancellationToken).ConfigureAwait(false); lspCompletionItems.Add(lspCompletionItem); } @@ -177,7 +177,6 @@ bool IsValidTriggerCharacterForDocument(Document document, char triggerCharacter bool supportsVSExtensions, Dictionary, string[]> commitCharacterRulesCache, CompletionService completionService, - string? clientName, bool returnTextEdits, bool snippetsSupported, StringBuilder stringBuilder, diff --git a/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs index b7be5bf149e8c..231749f28b82f 100644 --- a/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/LiveShareInProcLanguageClient.cs @@ -37,7 +37,7 @@ public LiveShareInProcLanguageClient( DefaultCapabilitiesProvider defaultCapabilitiesProvider, ILspLoggerFactory lspLoggerFactory, IThreadingContext threadingContext) - : base(csharpVBRequestDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) + : base(csharpVBRequestDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext) { _defaultCapabilitiesProvider = defaultCapabilitiesProvider; } diff --git a/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs b/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs index cc71b2be6f93d..53ee0686aa249 100644 --- a/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs +++ b/src/EditorFeatures/Core/LanguageServer/RazorInProcLanguageClient.cs @@ -55,7 +55,7 @@ public RazorInProcLanguageClient( DefaultCapabilitiesProvider defaultCapabilitiesProvider, IThreadingContext threadingContext, ILspLoggerFactory lspLoggerFactory) - : base(csharpVBRequestDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, ClientName) + : base(csharpVBRequestDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext) { _defaultCapabilitiesProvider = defaultCapabilitiesProvider; } diff --git a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs index b81852b34b06e..29a69e5b506cb 100644 --- a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs +++ b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs @@ -288,8 +288,8 @@ private protected static CodeActionResolveData CreateCodeActionResolveData(strin protected Task CreateTestLspServerAsync(string markup, LSP.ClientCapabilities? clientCapabilities = null) => CreateTestLspServerAsync(new string[] { markup }, Array.Empty(), LanguageNames.CSharp, clientCapabilities); - protected Task CreateVisualBasicTestLspServerAsync(string markup, LSP.ClientCapabilities? clientCapabilities = null) - => CreateTestLspServerAsync(new string[] { markup }, Array.Empty(), LanguageNames.VisualBasic, clientCapabilities); + private protected Task CreateVisualBasicTestLspServerAsync(string markup, LSP.ClientCapabilities? clientCapabilities = null, WellKnownLspServerKinds serverKind = WellKnownLspServerKinds.AlwaysActiveVSLspServer) + => CreateTestLspServerAsync(new string[] { markup }, Array.Empty(), LanguageNames.VisualBasic, clientCapabilities, serverKind); protected Task CreateMultiProjectLspServerAsync(string xmlMarkup, LSP.ClientCapabilities? clientCapabilities = null) => CreateTestLspServerAsync(TestWorkspace.Create(xmlMarkup, composition: Composition), clientCapabilities, WellKnownLspServerKinds.AlwaysActiveVSLspServer); @@ -579,7 +579,6 @@ private static LanguageServerTarget CreateLanguageServer(Stream inputStream, Str listenerProvider, NoOpLspLogger.Instance, ProtocolConstants.RoslynLspLanguages, - clientName: null, serverKind); jsonRpc.StartListening(); diff --git a/src/Features/LanguageServer/Protocol/CSharpVisualBasicLanguageServerFactory.cs b/src/Features/LanguageServer/Protocol/CSharpVisualBasicLanguageServerFactory.cs index 51c7ad4947537..c7acd08270e6b 100644 --- a/src/Features/LanguageServer/Protocol/CSharpVisualBasicLanguageServerFactory.cs +++ b/src/Features/LanguageServer/Protocol/CSharpVisualBasicLanguageServerFactory.cs @@ -51,7 +51,6 @@ public ILanguageServerTarget Create( _listenerProvider, logger, ProtocolConstants.RoslynLspLanguages, - clientName: null, WellKnownLspServerKinds.CSharpVisualBasicLspServer); } } diff --git a/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs b/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs index d5c6eed1c5cde..95772c2492ecf 100644 --- a/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs +++ b/src/Features/LanguageServer/Protocol/Extensions/Extensions.cs @@ -33,18 +33,12 @@ public static Uri GetURI(this TextDocument document) => ProtocolConversions.TryGetUriFromFilePath(document.FilePath, context); public static ImmutableArray GetDocuments(this Solution solution, Uri documentUri) - => GetDocuments(solution, documentUri, clientName: null, logger: null); - - public static ImmutableArray GetDocuments(this Solution solution, Uri documentUri, string? clientName) - => GetDocuments(solution, documentUri, clientName, logger: null); - - public static ImmutableArray GetDocuments(this Solution solution, Uri documentUri, string? clientName, ILspLogger? logger) { var documentIds = GetDocumentIds(solution, documentUri); var documents = documentIds.SelectAsArray(id => solution.GetRequiredDocument(id)); - return FilterDocumentsByClientName(documents, clientName, logger); + return documents; } public static ImmutableArray GetDocumentIds(this Solution solution, Uri documentUri) @@ -62,40 +56,9 @@ public static ImmutableArray GetDocumentIds(this Solution solution, return documentIds; } - private static ImmutableArray FilterDocumentsByClientName(ImmutableArray documents, string? clientName, ILspLogger? logger) - { - // If we don't have a client name, then we're done filtering - if (clientName == null) - { - return documents; - } - - // We have a client name, so we need to filter to only documents that match that name - return documents.WhereAsArray(document => - { - var documentPropertiesService = document.Services.GetService(); - - // When a client name is specified, only return documents that have a matching client name. - // Allows the razor lsp server to return results only for razor documents. - // This workaround should be removed when https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1106064/ - // is fixed (so that the razor language server is only asked about razor buffers). - var documentClientName = documentPropertiesService?.DiagnosticsLspClientName; - var clientNameMatch = Equals(documentClientName, clientName); - if (!clientNameMatch && logger is not null) - { - logger.TraceInformation($"Found matching document but it's client name '{documentClientName}' is not a match."); - } - - return clientNameMatch; - }); - } - public static Document? GetDocument(this Solution solution, TextDocumentIdentifier documentIdentifier) - => solution.GetDocument(documentIdentifier, clientName: null); - - public static Document? GetDocument(this Solution solution, TextDocumentIdentifier documentIdentifier, string? clientName) { - var documents = solution.GetDocuments(documentIdentifier.Uri, clientName, logger: null); + var documents = solution.GetDocuments(documentIdentifier.Uri); if (documents.Length == 0) { return null; @@ -193,14 +156,6 @@ public static string GetMarkdownLanguageName(this Document document) public static ClassifiedTextElement GetClassifiedText(this DefinitionItem definition) => new ClassifiedTextElement(definition.DisplayParts.Select(part => new ClassifiedTextRun(part.Tag.ToClassificationTypeName(), part.Text))); - public static bool IsRazorDocument(this Document document) - { - // Only razor docs have an ISpanMappingService, so we can use the presence of that to determine if this doc - // belongs to them. - var spanMapper = document.Services.GetService(); - return spanMapper != null; - } - private static bool TryGetVSCompletionListSetting(ClientCapabilities clientCapabilities, [NotNullWhen(returnValue: true)] out VSInternalCompletionListSetting? completionListSetting) { if (clientCapabilities is not VSInternalClientCapabilities vsClientCapabilities) diff --git a/src/Features/LanguageServer/Protocol/ExternalAccess/VSMac/API/VSMacLspLoggerFactory.cs b/src/Features/LanguageServer/Protocol/ExternalAccess/VSMac/API/VSMacLspLoggerFactory.cs index eb0db665211a4..d4d94e2f6f238 100644 --- a/src/Features/LanguageServer/Protocol/ExternalAccess/VSMac/API/VSMacLspLoggerFactory.cs +++ b/src/Features/LanguageServer/Protocol/ExternalAccess/VSMac/API/VSMacLspLoggerFactory.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.LanguageServer.ExternalAccess.VSMac.API; internal interface IVSMacLspLoggerFactory { - Task CreateLoggerAsync(string serverTypeName, string? clientName, JsonRpc jsonRpc, CancellationToken cancellationToken); + Task CreateLoggerAsync(string serverTypeName, JsonRpc jsonRpc, CancellationToken cancellationToken); } internal interface IVSMacLspLogger diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs index e732590154ece..00fa23941ee96 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs @@ -45,7 +45,6 @@ internal abstract class AbstractPullDiagnosticHandler true; protected AbstractPullDiagnosticHandler( - WellKnownLspServerKinds serverKind, IDiagnosticService diagnosticService, EditAndContinueDiagnosticUpdateSource editAndContinueDiagnosticUpdateSource) { - _serverKind = serverKind; DiagnosticService = diagnosticService; _editAndContinueDiagnosticUpdateSource = editAndContinueDiagnosticUpdateSource; _versionedCache = new(this.GetType().Name); @@ -135,11 +132,8 @@ protected AbstractPullDiagnosticHandler( { context.TraceInformation($"Processing: {document.FilePath}"); - if (!IncludeDocument(document, context.ClientName)) - { - context.TraceInformation($"Ignoring document '{document.FilePath}' because of razor/client-name mismatch"); - continue; - } + // not be asked for workspace docs in razor. + // not send razor docs in workspace docs for c# var encVersion = _editAndContinueDiagnosticUpdateSource.Version; @@ -173,17 +167,6 @@ protected AbstractPullDiagnosticHandler( return CreateReturn(progress); } - private static bool IncludeDocument(Document document, string? clientName) - { - // Documents either belong to Razor or not. We can determine this by checking if the doc has a span-mapping - // service or not. If we're not in razor, we do not include razor docs. If we are in razor, we only - // include razor docs. - var isRazorDoc = document.IsRazorDocument(); - var wantsRazorDoc = clientName != null; - - return wantsRazorDoc == isRazorDoc; - } - private static Dictionary GetDocumentToPreviousDiagnosticParams( RequestContext context, ImmutableArray previousResults) { @@ -210,7 +193,7 @@ private async Task ComputeAndReportCurrentDiagnosticsAsync( ClientCapabilities clientCapabilities, CancellationToken cancellationToken) { - var diagnosticModeOption = _serverKind switch + var diagnosticModeOption = context.ServerKind switch { WellKnownLspServerKinds.LiveShareLspServer => s_liveShareDiagnosticMode, WellKnownLspServerKinds.RazorLspServer => s_razorDiagnosticMode, diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs index dd0988559aa32..2ddf9d4fddd12 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/DocumentPullDiagnosticHandler.cs @@ -21,11 +21,10 @@ internal class DocumentPullDiagnosticHandler : AbstractPullDiagnosticHandler CreateRequestHandlers(WellKnownLspServerKinds serverKind) { - return ImmutableArray.Create(new ExperimentalDocumentPullDiagnosticsHandler(serverKind, _diagnosticService, _analyzerService, _editAndContinueDiagnosticUpdateSource)); + return ImmutableArray.Create(new ExperimentalDocumentPullDiagnosticsHandler(_diagnosticService, _analyzerService, _editAndContinueDiagnosticUpdateSource)); } } diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalDocumentPullDiagnosticsHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalDocumentPullDiagnosticsHandler.cs index d71b76622a563..313ee433ca8df 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalDocumentPullDiagnosticsHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalDocumentPullDiagnosticsHandler.cs @@ -28,11 +28,10 @@ internal class ExperimentalDocumentPullDiagnosticsHandler : AbstractPullDiagnost private readonly IDiagnosticAnalyzerService _analyzerService; public ExperimentalDocumentPullDiagnosticsHandler( - WellKnownLspServerKinds serverKind, IDiagnosticService diagnosticService, IDiagnosticAnalyzerService analyzerService, EditAndContinueDiagnosticUpdateSource editAndContinueDiagnosticUpdateSource) - : base(serverKind, diagnosticService, editAndContinueDiagnosticUpdateSource) + : base(diagnosticService, editAndContinueDiagnosticUpdateSource) { _analyzerService = analyzerService; } diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalWorkspacePullDiagnosticHandlerProvider.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalWorkspacePullDiagnosticHandlerProvider.cs index 6bbc5487a01a9..e6d254afc8675 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalWorkspacePullDiagnosticHandlerProvider.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalWorkspacePullDiagnosticHandlerProvider.cs @@ -32,6 +32,6 @@ public ExperimentalWorkspacePullDiagnosticHandlerProvider( public ImmutableArray CreateRequestHandlers(WellKnownLspServerKinds serverKind) { - return ImmutableArray.Create(new ExperimentalWorkspacePullDiagnosticsHandler(serverKind, _diagnosticService, _analyzerService, _editAndContinueDiagnosticUpdateSource)); + return ImmutableArray.Create(new ExperimentalWorkspacePullDiagnosticsHandler(_diagnosticService, _analyzerService, _editAndContinueDiagnosticUpdateSource)); } } diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalWorkspacePullDiagnosticsHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalWorkspacePullDiagnosticsHandler.cs index 0bc9d43c5b765..0b3b5a89572df 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalWorkspacePullDiagnosticsHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/Experimental/ExperimentalWorkspacePullDiagnosticsHandler.cs @@ -23,11 +23,10 @@ internal class ExperimentalWorkspacePullDiagnosticsHandler : AbstractPullDiagnos private readonly IDiagnosticAnalyzerService _analyzerService; public ExperimentalWorkspacePullDiagnosticsHandler( - WellKnownLspServerKinds serverKind, IDiagnosticService diagnosticService, IDiagnosticAnalyzerService analyzerService, EditAndContinueDiagnosticUpdateSource editAndContinueDiagnosticUpdateSource) - : base(serverKind, diagnosticService, editAndContinueDiagnosticUpdateSource) + : base(diagnosticService, editAndContinueDiagnosticUpdateSource) { _analyzerService = analyzerService; } diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/PullDiagnosticHandlerProvider.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/PullDiagnosticHandlerProvider.cs index 6e9d442a5d027..5b3841aff441a 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/PullDiagnosticHandlerProvider.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/PullDiagnosticHandlerProvider.cs @@ -34,8 +34,8 @@ public PullDiagnosticHandlerProvider( public ImmutableArray CreateRequestHandlers(WellKnownLspServerKinds serverKind) { return ImmutableArray.Create( - new DocumentPullDiagnosticHandler(serverKind, _diagnosticService, _analyzerService, _editAndContinueDiagnosticUpdateSource), - new WorkspacePullDiagnosticHandler(serverKind, _diagnosticService, _editAndContinueDiagnosticUpdateSource)); + new DocumentPullDiagnosticHandler(_diagnosticService, _analyzerService, _editAndContinueDiagnosticUpdateSource), + new WorkspacePullDiagnosticHandler(_diagnosticService, _editAndContinueDiagnosticUpdateSource)); } } } diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs index 2cb25eeb59550..b87ae043f3d34 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.EditAndContinue; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Api; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.SolutionCrawler; @@ -19,8 +20,8 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler.Diagnostics [Method(VSInternalMethods.WorkspacePullDiagnosticName)] internal class WorkspacePullDiagnosticHandler : AbstractPullDiagnosticHandler { - public WorkspacePullDiagnosticHandler(WellKnownLspServerKinds serverKind, IDiagnosticService diagnosticService, EditAndContinueDiagnosticUpdateSource editAndContinueDiagnosticUpdateSource) - : base(serverKind, diagnosticService, editAndContinueDiagnosticUpdateSource) + public WorkspacePullDiagnosticHandler(IDiagnosticService diagnosticService, EditAndContinueDiagnosticUpdateSource editAndContinueDiagnosticUpdateSource) + : base(diagnosticService, editAndContinueDiagnosticUpdateSource) { } @@ -74,7 +75,7 @@ internal static async ValueTask> GetWorkspacePullDocume // If we're being called from razor, we do not support WorkspaceDiagnostics at all. For razor, workspace // diagnostics will be handled by razor itself, which will operate by calling into Roslyn and asking for // document-diagnostics instead. - if (context.ClientName != null) + if (context.ServerKind == WellKnownLspServerKinds.RazorLspServer) return ImmutableArray.Empty; using var _ = ArrayBuilder.GetInstance(out var result); @@ -145,6 +146,13 @@ async Task AddDocumentsFromProjectAsync(Project? project, ImmutableArray continue; } + // Do not attempt to get workspace diagnostics for Razor files, Razor will directly ask us for document diagnostics + // for any razor file they are interested in. + if (document.IsRazorDocument()) + { + continue; + } + result.Add(document); } } diff --git a/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs b/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs index 3a9b8d4488c5a..05c36bea493b7 100644 --- a/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/OnAutoInsert/OnAutoInsertHandler.cs @@ -77,7 +77,7 @@ public OnAutoInsertHandler( // Only support this for razor as LSP doesn't support overtype yet. // https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1165179/ // Once LSP supports overtype we can move all of brace completion to LSP. - if (request.Character == "\n" && context.ClientName == document.Services.GetService()?.DiagnosticsLspClientName) + if (request.Character == "\n" && context.ServerKind == WellKnownLspServerKinds.RazorLspServer) { var indentationOptions = IndentationOptions.From(documentOptions, document.Project.Solution.Workspace.Services, document.Project.Language); diff --git a/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs b/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs index eb14e29a7de66..b3861712e345f 100644 --- a/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/ProjectContext/GetTextDocumentWithContextHandler.cs @@ -35,7 +35,7 @@ public GetTextDocumentWithContextHandler() Contract.ThrowIfNull(context.Solution); // We specifically don't use context.Document here because we want multiple - var documents = context.Solution.GetDocuments(request.TextDocument.Uri, context.ClientName); + var documents = context.Solution.GetDocuments(request.TextDocument.Uri); if (!documents.Any()) { diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs index 12a03cebb76a5..a62a542f0dccd 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestContext.cs @@ -43,9 +43,9 @@ internal readonly struct RequestContext public readonly ClientCapabilities ClientCapabilities; /// - /// The LSP client making the request + /// The LSP server handling the request. /// - public readonly string? ClientName; + public readonly WellKnownLspServerKinds ServerKind; /// /// The document that the request is for, if applicable. This comes from the returned from the handler itself via a call to . @@ -68,7 +68,7 @@ public RequestContext( Solution? solution, ILspLogger logger, ClientCapabilities clientCapabilities, - string? clientName, + WellKnownLspServerKinds serverKind, Document? document, IDocumentChangeTracker documentChangeTracker, ImmutableDictionary trackedDocuments, @@ -78,7 +78,7 @@ public RequestContext( Document = document; Solution = solution; ClientCapabilities = clientCapabilities; - ClientName = clientName; + ServerKind = serverKind; SupportedLanguages = supportedLanguages; GlobalOptions = globalOptions; _documentChangeTracker = documentChangeTracker; @@ -89,7 +89,7 @@ public RequestContext( public static RequestContext? Create( bool requiresLSPSolution, TextDocumentIdentifier? textDocument, - string? clientName, + WellKnownLspServerKinds serverKind, ILspLogger logger, ClientCapabilities clientCapabilities, LspWorkspaceManager lspWorkspaceManager, @@ -107,7 +107,7 @@ public RequestContext( // so they're not accidentally operating on stale solution state. if (!requiresLSPSolution) { - return new RequestContext(solution: null, logger, clientCapabilities, clientName, document: null, documentChangeTracker, trackedDocuments, supportedLanguages, globalOptions); + return new RequestContext(solution: null, logger, clientCapabilities, serverKind, document: null, documentChangeTracker, trackedDocuments, supportedLanguages, globalOptions); } // Go through each registered workspace, find the solution that contains the document that @@ -120,7 +120,7 @@ public RequestContext( { // we were given a request associated with a document. Find the corresponding roslyn // document for this. If we can't, we cannot proceed. - document = lspWorkspaceManager.GetLspDocument(textDocument, clientName); + document = lspWorkspaceManager.GetLspDocument(textDocument); if (document != null) workspaceSolution = document.Project.Solution; } @@ -135,7 +135,7 @@ public RequestContext( workspaceSolution, logger, clientCapabilities, - clientName, + serverKind, document, documentChangeTracker, trackedDocuments, diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.QueueItem.cs b/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.QueueItem.cs index 2aa44e881a3a3..0ec8109ecb26c 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.QueueItem.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.QueueItem.cs @@ -28,9 +28,6 @@ private interface IQueueItem /// bool MutatesSolutionState { get; } - /// - string? ClientName { get; } - string MethodName { get; } /// @@ -67,8 +64,6 @@ private class QueueItem : IQueueItem public bool MutatesSolutionState { get; } - public string? ClientName { get; } - public string MethodName { get; } public TextDocumentIdentifier? TextDocument { get; } @@ -83,7 +78,6 @@ public QueueItem( bool mutatesSolutionState, bool requiresLSPSolution, ClientCapabilities clientCapabilities, - string? clientName, string methodName, TextDocumentIdentifier? textDocument, TRequestType request, @@ -107,7 +101,6 @@ public QueueItem( MutatesSolutionState = mutatesSolutionState; RequiresLSPSolution = requiresLSPSolution; ClientCapabilities = clientCapabilities; - ClientName = clientName; MethodName = methodName; TextDocument = textDocument; } @@ -116,7 +109,6 @@ public static (IQueueItem, Task) Create( bool mutatesSolutionState, bool requiresLSPSolution, ClientCapabilities clientCapabilities, - string? clientName, string methodName, TextDocumentIdentifier? textDocument, TRequestType request, @@ -130,7 +122,6 @@ public static (IQueueItem, Task) Create( mutatesSolutionState, requiresLSPSolution, clientCapabilities, - clientName, methodName, textDocument, request, diff --git a/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs b/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs index 02c373d8b5aba..1ab2635171c11 100644 --- a/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs +++ b/src/Features/LanguageServer/Protocol/Handler/RequestExecutionQueue.cs @@ -39,7 +39,7 @@ namespace Microsoft.CodeAnalysis.LanguageServer.Handler /// /// /// Regardless of whether a request is mutating or not, or blocking or not, is an implementation detail of this class - /// and any consumers observing the results of the task returned from + /// and any consumers observing the results of the task returned from /// will see the results of the handling of the request, whenever it occurred. /// /// @@ -142,7 +142,6 @@ public void Shutdown() /// The handler that will handle the request. /// The request to handle. /// The client capabilities. - /// The client name. /// The name of the LSP method. /// A cancellation token that will cancel the handing of this request. /// The request could also be cancelled by the queue shutting down. @@ -153,7 +152,6 @@ public void Shutdown() IRequestHandler handler, TRequestType request, ClientCapabilities clientCapabilities, - string? clientName, string methodName, CancellationToken requestCancellationToken) where TRequestType : class @@ -171,7 +169,6 @@ public void Shutdown() mutatesSolutionState, requiresLSPSolution, clientCapabilities, - clientName, methodName, textDocument, request, @@ -275,7 +272,7 @@ private void OnRequestServerShutdown(string message) return RequestContext.Create( queueItem.RequiresLSPSolution, queueItem.TextDocument, - queueItem.ClientName, + _serverKind, _logger, queueItem.ClientCapabilities, _lspWorkspaceManager, diff --git a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs index bdd4c460a84e1..9313334d81b76 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SemanticTokens/SemanticTokensRangeHandler.cs @@ -7,6 +7,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Classification; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Api; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Options; using Microsoft.VisualStudio.LanguageServer.Protocol; diff --git a/src/Features/LanguageServer/Protocol/ILspLoggerFactory.cs b/src/Features/LanguageServer/Protocol/ILspLoggerFactory.cs index b7ad33aef7e3e..56a14a6eeebb5 100644 --- a/src/Features/LanguageServer/Protocol/ILspLoggerFactory.cs +++ b/src/Features/LanguageServer/Protocol/ILspLoggerFactory.cs @@ -10,6 +10,6 @@ namespace Microsoft.CodeAnalysis.LanguageServer { internal interface ILspLoggerFactory { - Task CreateLoggerAsync(string serverTypeName, string? clientName, JsonRpc jsonRpc, CancellationToken cancellationToken); + Task CreateLoggerAsync(string serverTypeName, JsonRpc jsonRpc, CancellationToken cancellationToken); } } diff --git a/src/Features/LanguageServer/Protocol/LanguageServerTarget.cs b/src/Features/LanguageServer/Protocol/LanguageServerTarget.cs index 3b7ae888b05b8..7ba7b416a1e0a 100644 --- a/src/Features/LanguageServer/Protocol/LanguageServerTarget.cs +++ b/src/Features/LanguageServer/Protocol/LanguageServerTarget.cs @@ -28,7 +28,6 @@ internal class LanguageServerTarget : ILanguageServerTarget private readonly RequestExecutionQueue _queue; private readonly IAsynchronousOperationListener _listener; private readonly ILspLogger _logger; - private readonly string? _clientName; // Set on first LSP initialize request. private ClientCapabilities? _clientCapabilities; @@ -49,7 +48,6 @@ internal LanguageServerTarget( IAsynchronousOperationListenerProvider listenerProvider, ILspLogger logger, ImmutableArray supportedLanguages, - string? clientName, WellKnownLspServerKinds serverKind) { _requestDispatcher = requestDispatcherFactory.CreateRequestDispatcher(serverKind); @@ -62,7 +60,6 @@ internal LanguageServerTarget( _jsonRpc.Disconnected += JsonRpc_Disconnected; _listener = listenerProvider.GetListener(FeatureAttribute.LanguageServer); - _clientName = clientName; _queue = new RequestExecutionQueue( logger, @@ -115,7 +112,6 @@ public DelegatingEntryPoint(string method, LanguageServerTarget target) _method, requestType, _target._clientCapabilities, - _target._clientName, _target._queue, cancellationToken).ConfigureAwait(false); return result; @@ -224,7 +220,6 @@ private void ExitImpl() requestMethod, request, _clientCapabilities, - _clientName, _queue, cancellationToken).ConfigureAwait(false); return result; diff --git a/src/Features/LanguageServer/Protocol/RequestDispatcher.cs b/src/Features/LanguageServer/Protocol/RequestDispatcher.cs index a19e9dcabfb9c..9c44acba729ee 100644 --- a/src/Features/LanguageServer/Protocol/RequestDispatcher.cs +++ b/src/Features/LanguageServer/Protocol/RequestDispatcher.cs @@ -91,7 +91,6 @@ private static (Type requestType, Type responseType) ConvertHandlerTypeToRequest string methodName, TRequestType request, LSP.ClientCapabilities clientCapabilities, - string? clientName, RequestExecutionQueue queue, CancellationToken cancellationToken) where TRequestType : class { @@ -106,7 +105,7 @@ private static (Type requestType, Type responseType) ConvertHandlerTypeToRequest var strongHandler = (IRequestHandler?)handler; Contract.ThrowIfNull(strongHandler, string.Format("Request handler not found for method {0}", methodName)); - var result = await ExecuteRequestAsync(queue, mutatesSolutionState, requiresLspSolution, strongHandler, request, clientCapabilities, clientName, methodName, cancellationToken).ConfigureAwait(false); + var result = await ExecuteRequestAsync(queue, mutatesSolutionState, requiresLspSolution, strongHandler, request, clientCapabilities, methodName, cancellationToken).ConfigureAwait(false); return result; } @@ -117,11 +116,10 @@ private static (Type requestType, Type responseType) ConvertHandlerTypeToRequest IRequestHandler handler, TRequestType request, LSP.ClientCapabilities clientCapabilities, - string? clientName, string methodName, CancellationToken cancellationToken) where TRequestType : class { - return queue.ExecuteAsync(mutatesSolutionState, requiresLSPSolution, handler, request, clientCapabilities, clientName, methodName, cancellationToken); + return queue.ExecuteAsync(mutatesSolutionState, requiresLSPSolution, handler, request, clientCapabilities, methodName, cancellationToken); } public ImmutableArray GetRegisteredMethods() diff --git a/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs b/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs index 23aec47610146..d74f3af1b4511 100644 --- a/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs +++ b/src/Features/LanguageServer/Protocol/Workspaces/LspWorkspaceManager.cs @@ -238,7 +238,7 @@ public void UpdateTrackedDocument(Uri uri, SourceText newSourceText) // Get our current solutions and re-fork from the workspace as needed. var updatedSolutions = ComputeIncrementalLspSolutions_CalledUnderLock(); - var findDocumentResult = FindDocuments(uri, updatedSolutions, clientName: null, _requestTelemetryLogger, _logger); + var findDocumentResult = FindDocuments(uri, updatedSolutions, _requestTelemetryLogger, _logger); if (findDocumentResult.IsEmpty) { // We didn't find this document in a registered workspace or in the misc workspace. @@ -303,11 +303,7 @@ public ImmutableDictionary GetTrackedLspText() /// /// Returns a document with the LSP tracked text forked from the appropriate workspace solution. /// - /// - /// Returns documents that have a matching client name. In razor scenarios this is to ensure that the Razor C# server - /// only provides data for generated razor documents (which have a client name). - /// - public Document? GetLspDocument(TextDocumentIdentifier textDocumentIdentifier, string? clientName) + public Document? GetLspDocument(TextDocumentIdentifier textDocumentIdentifier) { lock (_gate) { @@ -315,7 +311,7 @@ public ImmutableDictionary GetTrackedLspText() var currentLspSolutions = ComputeIncrementalLspSolutions_CalledUnderLock(); // Search through the latest lsp solutions to find the document with matching uri and client name. - var findDocumentResult = FindDocuments(textDocumentIdentifier.Uri, currentLspSolutions, clientName, _requestTelemetryLogger, _logger); + var findDocumentResult = FindDocuments(textDocumentIdentifier.Uri, currentLspSolutions, _requestTelemetryLogger, _logger); if (findDocumentResult.IsEmpty) { return null; @@ -382,7 +378,6 @@ private ImmutableArray ComputeIncrementalLspSolutions_CalledUnderLock( private static ImmutableArray FindDocuments( Uri uri, ImmutableArray registeredSolutions, - string? clientName, RequestTelemetryLogger telemetryLogger, ILspLogger logger) { @@ -394,7 +389,7 @@ private static ImmutableArray FindDocuments( .Concat(registeredSolutions.Where(solution => solution.Workspace is LspMiscellaneousFilesWorkspace)).ToImmutableArray(); // First search the registered workspaces for documents with a matching URI. - if (TryGetDocumentsForUri(uri, registeredSolutions, clientName, out var documents, out var solution)) + if (TryGetDocumentsForUri(uri, registeredSolutions, out var documents, out var solution)) { telemetryLogger.UpdateFindDocumentTelemetryData(success: true, solution.Workspace.Kind); logger.TraceInformation($"{documents.Value.First().FilePath} found in workspace {solution.Workspace.Kind}"); @@ -404,20 +399,19 @@ private static ImmutableArray FindDocuments( // We didn't find the document in any workspace, record a telemetry notification that we did not find it. var searchedWorkspaceKinds = string.Join(";", registeredSolutions.SelectAsArray(s => s.Workspace.Kind)); - logger.TraceError($"Could not find '{uri}' with client name '{clientName}'. Searched {searchedWorkspaceKinds}"); + logger.TraceError($"Could not find '{uri}'. Searched {searchedWorkspaceKinds}"); telemetryLogger.UpdateFindDocumentTelemetryData(success: false, workspaceKind: null); return ImmutableArray.Empty; static bool TryGetDocumentsForUri( Uri uri, ImmutableArray registeredSolutions, - string? clientName, [NotNullWhen(true)] out ImmutableArray? documents, [NotNullWhen(true)] out Solution? solution) { foreach (var registeredSolution in registeredSolutions) { - var matchingDocuments = registeredSolution.GetDocuments(uri, clientName); + var matchingDocuments = registeredSolution.GetDocuments(uri); if (matchingDocuments.Any()) { documents = matchingDocuments; diff --git a/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.LinkedDocuments.cs b/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.LinkedDocuments.cs index ca9b74b622a83..f66fb9664be95 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.LinkedDocuments.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/DocumentChanges/DocumentChangesTests.LinkedDocuments.cs @@ -101,7 +101,7 @@ void M() private static Solution GetLSPSolution(TestLspServer testLspServer, Uri uri) { - var lspDocument = testLspServer.GetManager().GetLspDocument(new TextDocumentIdentifier { Uri = uri }, null); + var lspDocument = testLspServer.GetManager().GetLspDocument(new TextDocumentIdentifier { Uri = uri }); Contract.ThrowIfNull(lspDocument); return lspDocument.Project.Solution; } diff --git a/src/Features/LanguageServer/ProtocolUnitTests/OnAutoInsert/OnAutoInsertTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/OnAutoInsert/OnAutoInsertTests.cs index bd7594884af8f..8faf23f9e063b 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/OnAutoInsert/OnAutoInsertTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/OnAutoInsert/OnAutoInsertTests.cs @@ -268,7 +268,7 @@ void M() $0 } }"; - await VerifyMarkupAndExpected("\n", markup, expected); + await VerifyMarkupAndExpected("\n", markup, expected, serverKind: WellKnownLspServerKinds.RazorLspServer); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -290,7 +290,7 @@ void M() $0 } }"; - await VerifyMarkupAndExpected("\n", markup, expected, insertSpaces: false, tabSize: 4); + await VerifyMarkupAndExpected("\n", markup, expected, insertSpaces: false, tabSize: 4, serverKind: WellKnownLspServerKinds.RazorLspServer); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -316,7 +316,7 @@ void M() } } }"; - await VerifyMarkupAndExpected("\n", markup, expected); + await VerifyMarkupAndExpected("\n", markup, expected, serverKind: WellKnownLspServerKinds.RazorLspServer); } [Fact, Trait(Traits.Feature, Traits.Features.AutomaticCompletion)] @@ -373,16 +373,23 @@ void M() await VerifyNoResult("\n", markup); } - private async Task VerifyMarkupAndExpected(string characterTyped, string markup, string expected, bool insertSpaces = true, int tabSize = 4, string languageName = LanguageNames.CSharp) + private async Task VerifyMarkupAndExpected( + string characterTyped, + string markup, + string expected, + bool insertSpaces = true, + int tabSize = 4, + string languageName = LanguageNames.CSharp, + WellKnownLspServerKinds serverKind = WellKnownLspServerKinds.AlwaysActiveVSLspServer) { Task testLspServerTask; if (languageName == LanguageNames.CSharp) { - testLspServerTask = CreateTestLspServerAsync(markup); + testLspServerTask = CreateTestLspServerAsync(markup, CapabilitiesWithVSExtensions, serverKind); } else if (languageName == LanguageNames.VisualBasic) { - testLspServerTask = CreateVisualBasicTestLspServerAsync(markup); + testLspServerTask = CreateVisualBasicTestLspServerAsync(markup, CapabilitiesWithVSExtensions, serverKind); } else { diff --git a/src/Features/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs index df39be93ed241..e4cefb78e85b8 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/VSTypeScriptHandlerTests.cs @@ -103,7 +103,6 @@ private static LanguageServerTarget CreateLanguageServer(Stream inputStream, Str listenerProvider, NoOpLspLogger.Instance, ImmutableArray.Create(InternalLanguageNames.TypeScript), - clientName: null, WellKnownLspServerKinds.RoslynTypeScriptLspServer); jsonRpc.StartListening(); diff --git a/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs b/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs index 9ac86e8d92161..7210807fce5b3 100644 --- a/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs +++ b/src/Features/LanguageServer/ProtocolUnitTests/Workspaces/LspWorkspaceManagerTests.cs @@ -523,7 +523,7 @@ private static async Task OpenDocumentAndVerifyLspTextAsync(Uri docume private static Document? GetLspDocument(Uri uri, TestLspServer testLspServer) { - return testLspServer.GetManager().GetLspDocument(CreateTextDocumentIdentifier(uri), clientName: null); + return testLspServer.GetManager().GetLspDocument(CreateTextDocumentIdentifier(uri)); } private static Solution? GetLspHostSolution(TestLspServer testLspServer) diff --git a/src/VisualStudio/Core/Def/LanguageClient/VisualStudioLogHubLoggerFactory.cs b/src/VisualStudio/Core/Def/LanguageClient/VisualStudioLogHubLoggerFactory.cs index 39b56b26546f8..721b71e1500c4 100644 --- a/src/VisualStudio/Core/Def/LanguageClient/VisualStudioLogHubLoggerFactory.cs +++ b/src/VisualStudio/Core/Def/LanguageClient/VisualStudioLogHubLoggerFactory.cs @@ -42,9 +42,9 @@ public VisualStudioLogHubLoggerFactory( _threadingContext = threadingContext; } - public async Task CreateLoggerAsync(string serverTypeName, string? clientName, JsonRpc jsonRpc, CancellationToken cancellationToken) + public async Task CreateLoggerAsync(string serverTypeName, JsonRpc jsonRpc, CancellationToken cancellationToken) { - var logName = $"Roslyn.{serverTypeName}.{clientName ?? "Default"}.{Interlocked.Increment(ref s_logHubSessionId)}"; + var logName = $"Roslyn.{serverTypeName}.{Interlocked.Increment(ref s_logHubSessionId)}"; var logId = new LogId(logName, new ServiceMoniker(typeof(LanguageServerTarget).FullName)); var serviceContainer = await _asyncServiceProvider.GetServiceAsync(_threadingContext.JoinableTaskFactory).ConfigureAwait(false); diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs index a9361d44b877e..1078566ab1676 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClient.cs @@ -38,7 +38,7 @@ public XamlInProcLanguageClient( LspWorkspaceRegistrationService lspWorkspaceRegistrationService, ILspLoggerFactory lspLoggerFactory, IThreadingContext threadingContext) - : base(xamlDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) + : base(xamlDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext) { } diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs index 74d1feb458e20..bcdba101eca9f 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageClient/XamlInProcLanguageClientDisableUX.cs @@ -41,7 +41,7 @@ public XamlInProcLanguageClientDisableUX( LspWorkspaceRegistrationService lspWorkspaceRegistrationService, ILspLoggerFactory lspLoggerFactory, IThreadingContext threadingContext) - : base(xamlDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext, diagnosticsClientName: null) + : base(xamlDispatcherFactory, globalOptions, listenerProvider, lspWorkspaceRegistrationService, lspLoggerFactory, threadingContext) { } diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs index e51a125c65858..c830018864bbb 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/Handler/Diagnostics/AbstractPullDiagnosticHandler.cs @@ -76,7 +76,7 @@ protected AbstractPullDiagnosticHandler(IXamlPullDiagnosticService xamlDiagnosti { if (previousResult.TextDocument != null) { - var document = context.Solution.GetDocument(previousResult.TextDocument, context.ClientName); + var document = context.Solution.GetDocument(previousResult.TextDocument); if (document == null) { // We can no longer get this document, return null for both diagnostics and resultId diff --git a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/XamlRequestDispatcherFactory.cs b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/XamlRequestDispatcherFactory.cs index 1d3a3b4e67ef6..b9a08c4312801 100644 --- a/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/XamlRequestDispatcherFactory.cs +++ b/src/VisualStudio/Xaml/Impl/Implementation/LanguageServer/XamlRequestDispatcherFactory.cs @@ -61,7 +61,7 @@ public XamlRequestDispatcher( } protected override async Task ExecuteRequestAsync( - RequestExecutionQueue queue, bool mutatesSolutionState, bool requiresLSPSolution, IRequestHandler handler, TRequestType request, ClientCapabilities clientCapabilities, string? clientName, string methodName, CancellationToken cancellationToken) + RequestExecutionQueue queue, bool mutatesSolutionState, bool requiresLSPSolution, IRequestHandler handler, TRequestType request, ClientCapabilities clientCapabilities, string methodName, CancellationToken cancellationToken) where TRequestType : class where TResponseType : default { @@ -77,7 +77,7 @@ public XamlRequestDispatcher( { try { - return await base.ExecuteRequestAsync(queue, mutatesSolutionState, requiresLSPSolution, handler, request, clientCapabilities, clientName, methodName, cancellationToken).ConfigureAwait(false); + return await base.ExecuteRequestAsync(queue, mutatesSolutionState, requiresLSPSolution, handler, request, clientCapabilities, methodName, cancellationToken).ConfigureAwait(false); } catch (Exception e) when (e is not OperationCanceledException) { From f51f1d986b455eac1afaf0190f6819d8ddc7ad40 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 17:22:03 -0700 Subject: [PATCH 045/131] Initial work to move indentation services down to codestyle layer --- ...CSharpRemoveUnusedValuesCodeFixProvider.cs | 4 +- ...lExpressionForAssignmentCodeFixProvider.cs | 4 +- ...ionalExpressionForReturnCodeFixProvider.cs | 4 +- ...stractRemoveUnusedValuesCodeFixProvider.cs | 6 +- ...UseConditionalExpressionCodeFixProvider.cs | 4 +- ...lBasicRemoveUnusedValuesCodeFixProvider.vb | 4 +- ...lExpressionForAssignmentCodeFixProvider.vb | 4 +- ...ionalExpressionForReturnCodeFixProvider.vb | 4 +- .../Analyzers/CSharpFormattingAnalyzer.cs | 6 +- .../CSharpFormattingCodeFixProvider.cs | 7 +-- .../Analyzers/AbstractFormattingAnalyzer.cs | 6 +- .../Analyzers/Formatting/FormatterHelper.cs | 16 +++--- .../Analyzers/FormattingAnalyzerHelper.cs | 2 +- .../Core/CodeFixes/FormattingCodeFixHelper.cs | 2 +- .../CodeFixes/FormattingCodeFixProvider.cs | 8 +-- .../VisualBasicFormattingAnalyzer.vb | 4 +- .../VisualBasicFormattingCodeFixProvider.vb | 4 +- .../Indentation/CSharpFormatterTestsBase.cs | 2 +- .../SmartTokenFormatter_FormatTokenTests.vb | 2 +- .../CSharpFormattingInteractionService.cs | 2 +- .../Indentation/CSharpSmartTokenFormatter.cs | 7 ++- .../AbstractIndentationService.Indenter.cs | 2 +- .../Indentation/ISmartTokenFormatter.cs | 3 +- .../CSharpSyntaxFormattingService.cs | 57 +++++++++---------- .../AbstractSyntaxFormattingService.cs | 4 +- .../Formatting/ISyntaxFormattingService.cs | 11 ++-- .../CSharpRemoveUnnecessaryImportsService.cs | 6 +- .../VisualBasicSyntaxFormattingService.vb | 49 ++++++++-------- .../VisualBasicSmartTokenFormatter.vb | 7 ++- 29 files changed, 120 insertions(+), 121 deletions(-) diff --git a/src/Analyzers/CSharp/CodeFixes/RemoveUnusedParametersAndValues/CSharpRemoveUnusedValuesCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/RemoveUnusedParametersAndValues/CSharpRemoveUnusedValuesCodeFixProvider.cs index 5c7de40348a80..8c4a9d8eb06fd 100644 --- a/src/Analyzers/CSharp/CodeFixes/RemoveUnusedParametersAndValues/CSharpRemoveUnusedValuesCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/RemoveUnusedParametersAndValues/CSharpRemoveUnusedValuesCodeFixProvider.cs @@ -35,8 +35,8 @@ public CSharpRemoveUnusedValuesCodeFixProvider() } #if CODE_STYLE - protected override ISyntaxFormattingService GetSyntaxFormattingService() - => CSharpSyntaxFormattingService.Instance; + protected override ISyntaxFormatting GetSyntaxFormatting() + => CSharpSyntaxFormatting.Instance; #endif protected override BlockSyntax WrapWithBlockIfNecessary(IEnumerable statements) diff --git a/src/Analyzers/CSharp/CodeFixes/UseConditionalExpression/CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseConditionalExpression/CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs index 0c478bdb97205..c1b7f821b23f8 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseConditionalExpression/CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseConditionalExpression/CSharpUseConditionalExpressionForAssignmentCodeFixProvider.cs @@ -66,8 +66,8 @@ protected override ExpressionSyntax ConvertToExpression(IThrowOperation throwOpe => CSharpUseConditionalExpressionHelpers.ConvertToExpression(throwOperation); #if CODE_STYLE - protected override ISyntaxFormattingService GetSyntaxFormattingService() - => CSharpSyntaxFormattingService.Instance; + protected override ISyntaxFormatting GetSyntaxFormatting() + => CSharpSyntaxFormatting.Instance; #endif } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseConditionalExpression/CSharpUseConditionalExpressionForReturnCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseConditionalExpression/CSharpUseConditionalExpressionForReturnCodeFixProvider.cs index 68069c4736e75..ccc2af8af9862 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseConditionalExpression/CSharpUseConditionalExpressionForReturnCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseConditionalExpression/CSharpUseConditionalExpressionForReturnCodeFixProvider.cs @@ -52,8 +52,8 @@ protected override ExpressionSyntax ConvertToExpression(IThrowOperation throwOpe => CSharpUseConditionalExpressionHelpers.ConvertToExpression(throwOperation); #if CODE_STYLE - protected override ISyntaxFormattingService GetSyntaxFormattingService() - => CSharpSyntaxFormattingService.Instance; + protected override ISyntaxFormatting GetSyntaxFormatting() + => CSharpSyntaxFormatting.Instance; #endif } } diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs index adf04d8fc912a..5fb59a2c445c0 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs @@ -67,7 +67,7 @@ public sealed override ImmutableArray FixableDiagnosticIds internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeQuality; #if CODE_STYLE - protected abstract ISyntaxFormattingService GetSyntaxFormattingService(); + protected abstract ISyntaxFormatting GetSyntaxFormatting(); #endif /// /// Method to update the identifier token for the local/parameter declaration or reference @@ -269,7 +269,7 @@ private static async Task PreprocessDocumentAsync(Document document, I protected sealed override async Task FixAllAsync(Document document, ImmutableArray diagnostics, SyntaxEditor editor, CancellationToken cancellationToken) { #if CODE_STYLE - var provider = GetSyntaxFormattingService(); + var provider = GetSyntaxFormatting(); var options = provider.GetFormattingOptions(document.Project.AnalyzerOptions.GetAnalyzerOptionSet(editor.OriginalRoot.SyntaxTree, cancellationToken)); #else var provider = document.Project.Solution.Workspace.Services; @@ -832,7 +832,7 @@ private async Task AdjustLocalDeclarationsAsync( // Run formatter prior to invoking IMoveDeclarationNearReferenceService. #if CODE_STYLE - var provider = GetSyntaxFormattingService(); + var provider = GetSyntaxFormatting(); rootWithTrackedNodes = FormatterHelper.Format(rootWithTrackedNodes, originalDeclStatementsToMoveOrRemove.Select(s => s.Span), provider, options, rules: null, cancellationToken); #else var provider = document.Project.Solution.Workspace.Services; diff --git a/src/Analyzers/Core/CodeFixes/UseConditionalExpression/AbstractUseConditionalExpressionCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseConditionalExpression/AbstractUseConditionalExpressionCodeFixProvider.cs index 30018fd0c3f3d..f986ec870e774 100644 --- a/src/Analyzers/Core/CodeFixes/UseConditionalExpression/AbstractUseConditionalExpressionCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseConditionalExpression/AbstractUseConditionalExpressionCodeFixProvider.cs @@ -41,7 +41,7 @@ internal abstract class AbstractUseConditionalExpressionCodeFixProvider< protected abstract AbstractFormattingRule GetMultiLineFormattingRule(); #if CODE_STYLE - protected abstract ISyntaxFormattingService GetSyntaxFormattingService(); + protected abstract ISyntaxFormatting GetSyntaxFormatting(); #endif protected abstract TExpressionSyntax ConvertToExpression(IThrowOperation throwOperation); @@ -77,7 +77,7 @@ await FixOneAsync( var rules = new List { GetMultiLineFormattingRule() }; #if CODE_STYLE - var provider = GetSyntaxFormattingService(); + var provider = GetSyntaxFormatting(); var options = provider.GetFormattingOptions(document.Project.AnalyzerOptions.GetAnalyzerOptionSet(root.SyntaxTree, cancellationToken)); #else var provider = document.Project.Solution.Workspace.Services; diff --git a/src/Analyzers/VisualBasic/CodeFixes/RemoveUnusedParametersAndValues/VisualBasicRemoveUnusedValuesCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/RemoveUnusedParametersAndValues/VisualBasicRemoveUnusedValuesCodeFixProvider.vb index a751f08efa9a1..e184ec00eb87b 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/RemoveUnusedParametersAndValues/VisualBasicRemoveUnusedValuesCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/RemoveUnusedParametersAndValues/VisualBasicRemoveUnusedValuesCodeFixProvider.vb @@ -26,8 +26,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.RemoveUnusedParametersAndValues End Sub #If CODE_STYLE Then - Protected Overrides Function GetSyntaxFormattingService() As ISyntaxFormattingService - Return VisualBasicSyntaxFormattingService.Instance + Protected Overrides Function GetSyntaxFormatting() As ISyntaxFormatting + Return VisualBasicSyntaxFormatting.Instance End Function #End If diff --git a/src/Analyzers/VisualBasic/CodeFixes/UseConditionalExpression/VisualBasicUseConditionalExpressionForAssignmentCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/UseConditionalExpression/VisualBasicUseConditionalExpressionForAssignmentCodeFixProvider.vb index 978af318745ca..5a92840da3542 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/UseConditionalExpression/VisualBasicUseConditionalExpressionForAssignmentCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/UseConditionalExpression/VisualBasicUseConditionalExpressionForAssignmentCodeFixProvider.vb @@ -60,8 +60,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UseConditionalExpression End Function #If CODE_STYLE Then - Protected Overrides Function GetSyntaxFormattingService() As ISyntaxFormattingService - Return VisualBasicSyntaxFormattingService.Instance + Protected Overrides Function GetSyntaxFormatting() As ISyntaxFormatting + Return VisualBasicSyntaxFormatting.Instance End Function #End If End Class diff --git a/src/Analyzers/VisualBasic/CodeFixes/UseConditionalExpression/VisualBasicUseConditionalExpressionForReturnCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/UseConditionalExpression/VisualBasicUseConditionalExpressionForReturnCodeFixProvider.vb index ead0c5dff0848..a546148b18c7f 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/UseConditionalExpression/VisualBasicUseConditionalExpressionForReturnCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/UseConditionalExpression/VisualBasicUseConditionalExpressionForReturnCodeFixProvider.vb @@ -44,8 +44,8 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UseConditionalExpression End Function #If CODE_STYLE Then - Protected Overrides Function GetSyntaxFormattingService() As ISyntaxFormattingService - Return VisualBasicSyntaxFormattingService.Instance + Protected Overrides Function GetSyntaxFormatting() As ISyntaxFormatting + Return VisualBasicSyntaxFormatting.Instance End Function #End If End Class diff --git a/src/CodeStyle/CSharp/Analyzers/CSharpFormattingAnalyzer.cs b/src/CodeStyle/CSharp/Analyzers/CSharpFormattingAnalyzer.cs index 4951f7e8f2335..3f31dd0f3a08f 100644 --- a/src/CodeStyle/CSharp/Analyzers/CSharpFormattingAnalyzer.cs +++ b/src/CodeStyle/CSharp/Analyzers/CSharpFormattingAnalyzer.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using Microsoft.CodeAnalysis.CSharp.Formatting; using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Formatting; @@ -13,7 +11,7 @@ namespace Microsoft.CodeAnalysis.CodeStyle [DiagnosticAnalyzer(LanguageNames.CSharp)] internal class CSharpFormattingAnalyzer : AbstractFormattingAnalyzer { - protected override ISyntaxFormattingService SyntaxFormattingService - => CSharpSyntaxFormattingService.Instance; + protected override ISyntaxFormatting SyntaxFormatting + => CSharpSyntaxFormatting.Instance; } } diff --git a/src/CodeStyle/CSharp/CodeFixes/CSharpFormattingCodeFixProvider.cs b/src/CodeStyle/CSharp/CodeFixes/CSharpFormattingCodeFixProvider.cs index 482aa5cba637a..9476008efaaa6 100644 --- a/src/CodeStyle/CSharp/CodeFixes/CSharpFormattingCodeFixProvider.cs +++ b/src/CodeStyle/CSharp/CodeFixes/CSharpFormattingCodeFixProvider.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Composition; using Microsoft.CodeAnalysis.CodeFixes; @@ -13,8 +11,7 @@ namespace Microsoft.CodeAnalysis.CodeStyle { - [ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.FixFormatting)] - [Shared] + [ExportCodeFixProvider(LanguageNames.CSharp, Name = PredefinedCodeFixProviderNames.FixFormatting), Shared] internal class CSharpFormattingCodeFixProvider : AbstractFormattingCodeFixProvider { [ImportingConstructor] @@ -23,6 +20,6 @@ public CSharpFormattingCodeFixProvider() { } - protected override ISyntaxFormattingService SyntaxFormattingService => CSharpSyntaxFormattingService.Instance; + protected override ISyntaxFormatting SyntaxFormatting => CSharpSyntaxFormatting.Instance; } } diff --git a/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs b/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs index dbeaf6f74148b..a39030841d90e 100644 --- a/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs +++ b/src/CodeStyle/Core/Analyzers/AbstractFormattingAnalyzer.cs @@ -27,15 +27,15 @@ public sealed override ImmutableArray SupportedDiagnostics public sealed override DiagnosticAnalyzerCategory GetAnalyzerCategory() => DiagnosticAnalyzerCategory.SyntaxTreeWithoutSemanticsAnalysis; - protected abstract ISyntaxFormattingService SyntaxFormattingService { get; } + protected abstract ISyntaxFormatting SyntaxFormatting { get; } protected sealed override void InitializeWorker(AnalysisContext context) => context.RegisterSyntaxTreeAction(AnalyzeSyntaxTree); private void AnalyzeSyntaxTree(SyntaxTreeAnalysisContext context) { - var options = SyntaxFormattingService.GetFormattingOptions(context.Options.AnalyzerConfigOptionsProvider.GetOptions(context.Tree)); - FormattingAnalyzerHelper.AnalyzeSyntaxTree(context, SyntaxFormattingService, Descriptor, options); + var options = SyntaxFormatting.GetFormattingOptions(context.Options.AnalyzerConfigOptionsProvider.GetOptions(context.Tree)); + FormattingAnalyzerHelper.AnalyzeSyntaxTree(context, SyntaxFormatting, Descriptor, options); } } } diff --git a/src/CodeStyle/Core/Analyzers/Formatting/FormatterHelper.cs b/src/CodeStyle/Core/Analyzers/Formatting/FormatterHelper.cs index 54db1c6918b95..eb90f80e93436 100644 --- a/src/CodeStyle/Core/Analyzers/Formatting/FormatterHelper.cs +++ b/src/CodeStyle/Core/Analyzers/Formatting/FormatterHelper.cs @@ -19,7 +19,7 @@ internal static class FormatterHelper /// /// Gets the formatting rules that would be applied if left unspecified. /// - internal static IEnumerable GetDefaultFormattingRules(ISyntaxFormattingService syntaxFormattingService) + internal static IEnumerable GetDefaultFormattingRules(ISyntaxFormatting syntaxFormattingService) => syntaxFormattingService.GetDefaultFormattingRules(); /// @@ -29,10 +29,10 @@ internal static IEnumerable GetDefaultFormattingRules(IS /// An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used. /// An optional cancellation token. /// The formatted tree's root node. - public static SyntaxNode Format(SyntaxNode node, ISyntaxFormattingService syntaxFormattingService, SyntaxFormattingOptions options, CancellationToken cancellationToken) + public static SyntaxNode Format(SyntaxNode node, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, CancellationToken cancellationToken) => Format(node, SpecializedCollections.SingletonEnumerable(node.FullSpan), syntaxFormattingService, options, rules: null, cancellationToken: cancellationToken); - public static SyntaxNode Format(SyntaxNode node, TextSpan spanToFormat, ISyntaxFormattingService syntaxFormattingService, SyntaxFormattingOptions options, CancellationToken cancellationToken) + public static SyntaxNode Format(SyntaxNode node, TextSpan spanToFormat, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, CancellationToken cancellationToken) => Format(node, SpecializedCollections.SingletonEnumerable(spanToFormat), syntaxFormattingService, options, rules: null, cancellationToken: cancellationToken); /// @@ -43,16 +43,16 @@ public static SyntaxNode Format(SyntaxNode node, TextSpan spanToFormat, ISyntaxF /// An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used. /// An optional cancellation token. /// The formatted tree's root node. - public static SyntaxNode Format(SyntaxNode node, SyntaxAnnotation annotation, ISyntaxFormattingService syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable? rules, CancellationToken cancellationToken) + public static SyntaxNode Format(SyntaxNode node, SyntaxAnnotation annotation, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable? rules, CancellationToken cancellationToken) => Format(node, GetAnnotatedSpans(node, annotation), syntaxFormattingService, options, rules, cancellationToken: cancellationToken); - internal static SyntaxNode Format(SyntaxNode node, IEnumerable spans, ISyntaxFormattingService syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable? rules, CancellationToken cancellationToken) + internal static SyntaxNode Format(SyntaxNode node, IEnumerable spans, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable? rules, CancellationToken cancellationToken) => GetFormattingResult(node, spans, syntaxFormattingService, options, rules, cancellationToken).GetFormattedRoot(cancellationToken); - internal static IList GetFormattedTextChanges(SyntaxNode node, IEnumerable spans, ISyntaxFormattingService syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable? rules, CancellationToken cancellationToken) + internal static IList GetFormattedTextChanges(SyntaxNode node, IEnumerable spans, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable? rules, CancellationToken cancellationToken) => GetFormattingResult(node, spans, syntaxFormattingService, options, rules, cancellationToken).GetTextChanges(cancellationToken); - internal static IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable spans, ISyntaxFormattingService syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable? rules, CancellationToken cancellationToken) + internal static IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable spans, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, IEnumerable? rules, CancellationToken cancellationToken) => syntaxFormattingService.GetFormattingResult(node, spans, options, rules, cancellationToken); /// @@ -62,7 +62,7 @@ internal static IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerab /// An optional set of formatting options. If these options are not supplied the current set of options from the workspace will be used. /// An optional cancellation token. /// The changes necessary to format the tree. - public static IList GetFormattedTextChanges(SyntaxNode node, ISyntaxFormattingService syntaxFormattingService, SyntaxFormattingOptions options, CancellationToken cancellationToken) + public static IList GetFormattedTextChanges(SyntaxNode node, ISyntaxFormatting syntaxFormattingService, SyntaxFormattingOptions options, CancellationToken cancellationToken) => GetFormattedTextChanges(node, SpecializedCollections.SingletonEnumerable(node.FullSpan), syntaxFormattingService, options, rules: null, cancellationToken: cancellationToken); } } diff --git a/src/CodeStyle/Core/Analyzers/FormattingAnalyzerHelper.cs b/src/CodeStyle/Core/Analyzers/FormattingAnalyzerHelper.cs index e6a0dd174a082..59dc6e4062dcb 100644 --- a/src/CodeStyle/Core/Analyzers/FormattingAnalyzerHelper.cs +++ b/src/CodeStyle/Core/Analyzers/FormattingAnalyzerHelper.cs @@ -10,7 +10,7 @@ #if CODE_STYLE using Formatter = Microsoft.CodeAnalysis.Formatting.FormatterHelper; -using FormattingProvider = Microsoft.CodeAnalysis.Formatting.ISyntaxFormattingService; +using FormattingProvider = Microsoft.CodeAnalysis.Formatting.ISyntaxFormatting; #else using FormattingProvider = Microsoft.CodeAnalysis.Host.HostWorkspaceServices; #endif diff --git a/src/CodeStyle/Core/CodeFixes/FormattingCodeFixHelper.cs b/src/CodeStyle/Core/CodeFixes/FormattingCodeFixHelper.cs index c6f074a545a51..1b9522d6e249b 100644 --- a/src/CodeStyle/Core/CodeFixes/FormattingCodeFixHelper.cs +++ b/src/CodeStyle/Core/CodeFixes/FormattingCodeFixHelper.cs @@ -9,7 +9,7 @@ #if CODE_STYLE using Formatter = Microsoft.CodeAnalysis.Formatting.FormatterHelper; -using FormattingProvider = Microsoft.CodeAnalysis.Formatting.ISyntaxFormattingService; +using FormattingProvider = Microsoft.CodeAnalysis.Formatting.ISyntaxFormatting; #else using Microsoft.CodeAnalysis.Options; using FormattingProvider = Microsoft.CodeAnalysis.Host.HostWorkspaceServices; diff --git a/src/CodeStyle/Core/CodeFixes/FormattingCodeFixProvider.cs b/src/CodeStyle/Core/CodeFixes/FormattingCodeFixProvider.cs index e7550a1dde299..225866e0482b4 100644 --- a/src/CodeStyle/Core/CodeFixes/FormattingCodeFixProvider.cs +++ b/src/CodeStyle/Core/CodeFixes/FormattingCodeFixProvider.cs @@ -22,7 +22,7 @@ internal abstract class AbstractFormattingCodeFixProvider : CodeFixProvider public sealed override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.FormattingDiagnosticId); - protected abstract ISyntaxFormattingService SyntaxFormattingService { get; } + protected abstract ISyntaxFormatting SyntaxFormatting { get; } public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { @@ -43,7 +43,7 @@ private async Task FixOneAsync(CodeFixContext context, Diagnostic diag { var options = await GetOptionsAsync(context.Document, cancellationToken).ConfigureAwait(false); var tree = await context.Document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); - var updatedTree = await FormattingCodeFixHelper.FixOneAsync(tree, SyntaxFormattingService, options, diagnostic, cancellationToken).ConfigureAwait(false); + var updatedTree = await FormattingCodeFixHelper.FixOneAsync(tree, this.SyntaxFormatting, options, diagnostic, cancellationToken).ConfigureAwait(false); return context.Document.WithText(await updatedTree.GetTextAsync(cancellationToken).ConfigureAwait(false)); } @@ -51,7 +51,7 @@ private async Task GetOptionsAsync(Document document, C { var tree = await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); var analyzerConfigOptions = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(tree); - return SyntaxFormattingService.GetFormattingOptions(analyzerConfigOptions); + return this.SyntaxFormatting.GetFormattingOptions(analyzerConfigOptions); } public sealed override FixAllProvider GetFixAllProvider() @@ -60,7 +60,7 @@ public sealed override FixAllProvider GetFixAllProvider() var cancellationToken = context.CancellationToken; var options = await GetOptionsAsync(document, cancellationToken).ConfigureAwait(false); var syntaxRoot = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); - var updatedSyntaxRoot = Formatter.Format(syntaxRoot, this.SyntaxFormattingService, options, cancellationToken); + var updatedSyntaxRoot = Formatter.Format(syntaxRoot, this.SyntaxFormatting, options, cancellationToken); return document.WithSyntaxRoot(updatedSyntaxRoot); }); } diff --git a/src/CodeStyle/VisualBasic/Analyzers/VisualBasicFormattingAnalyzer.vb b/src/CodeStyle/VisualBasic/Analyzers/VisualBasicFormattingAnalyzer.vb index 6d4e5c6883742..fdd627c81a7f8 100644 --- a/src/CodeStyle/VisualBasic/Analyzers/VisualBasicFormattingAnalyzer.vb +++ b/src/CodeStyle/VisualBasic/Analyzers/VisualBasicFormattingAnalyzer.vb @@ -11,9 +11,9 @@ Namespace Microsoft.CodeAnalysis.CodeStyle Friend Class VisualBasicFormattingAnalyzer Inherits AbstractFormattingAnalyzer - Protected Overrides ReadOnly Property SyntaxFormattingService As ISyntaxFormattingService + Protected Overrides ReadOnly Property SyntaxFormatting As ISyntaxFormatting Get - Return VisualBasicSyntaxFormattingService.Instance + Return VisualBasicSyntaxFormatting.Instance End Get End Property End Class diff --git a/src/CodeStyle/VisualBasic/CodeFixes/VisualBasicFormattingCodeFixProvider.vb b/src/CodeStyle/VisualBasic/CodeFixes/VisualBasicFormattingCodeFixProvider.vb index f46110e6b3c62..f8887597a692c 100644 --- a/src/CodeStyle/VisualBasic/CodeFixes/VisualBasicFormattingCodeFixProvider.vb +++ b/src/CodeStyle/VisualBasic/CodeFixes/VisualBasicFormattingCodeFixProvider.vb @@ -19,9 +19,9 @@ Namespace Microsoft.CodeAnalysis.CodeStyle Public Sub New() End Sub - Protected Overrides ReadOnly Property SyntaxFormattingService As ISyntaxFormattingService + Protected Overrides ReadOnly Property SyntaxFormatting As ISyntaxFormatting Get - Return VisualBasicSyntaxFormattingService.Instance + Return VisualBasicSyntaxFormatting.Instance End Get End Property End Class diff --git a/src/EditorFeatures/CSharpTest/Formatting/Indentation/CSharpFormatterTestsBase.cs b/src/EditorFeatures/CSharpTest/Formatting/Indentation/CSharpFormatterTestsBase.cs index ab19697d14108..8b026400d67c8 100644 --- a/src/EditorFeatures/CSharpTest/Formatting/Indentation/CSharpFormatterTestsBase.cs +++ b/src/EditorFeatures/CSharpTest/Formatting/Indentation/CSharpFormatterTestsBase.cs @@ -84,7 +84,7 @@ private static async Task TokenFormatWorkerAsync(TestWorkspace workspace, ITextB var options = await IndentationOptions.FromDocumentAsync(document, CancellationToken.None); var formatter = new CSharpSmartTokenFormatter(options, rules, root); - var changes = await formatter.FormatTokenAsync(workspace.Services, token, CancellationToken.None); + var changes = await formatter.FormatTokenAsync(token, CancellationToken.None); ApplyChanges(buffer, changes); } diff --git a/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb b/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb index 82ed93b5b91c6..e4810f9d79fe7 100644 --- a/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb @@ -202,7 +202,7 @@ End Class Dim formatOptions = Await SyntaxFormattingOptions.FromDocumentAsync(document, CancellationToken.None) Dim smartFormatter = New VisualBasicSmartTokenFormatter(formatOptions, formattingRules, root) - Dim changes = Await smartFormatter.FormatTokenAsync(workspace.Services, token, Nothing) + Dim changes = Await smartFormatter.FormatTokenAsync(token, Nothing) Using edit = buffer.CreateEdit() For Each change In changes diff --git a/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs b/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs index 5f292e5ad6d07..17d7873e71d20 100644 --- a/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs +++ b/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs @@ -298,7 +298,7 @@ private static async Task> FormatTokenAsync(Document document, { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var formatter = CreateSmartTokenFormatter(options, formattingRules, root); - var changes = await formatter.FormatTokenAsync(document.Project.Solution.Workspace.Services, token, cancellationToken).ConfigureAwait(false); + var changes = await formatter.FormatTokenAsync(token, cancellationToken).ConfigureAwait(false); return changes; } diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs b/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs index d5c16d911287a..931a69c8cb643 100644 --- a/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs +++ b/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs @@ -71,7 +71,7 @@ private static bool CloseBraceOfTryOrDoBlock(SyntaxToken endToken) } public async Task> FormatTokenAsync( - HostWorkspaceServices services, SyntaxToken token, CancellationToken cancellationToken) + SyntaxToken token, CancellationToken cancellationToken) { Contract.ThrowIfTrue(token.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); @@ -113,7 +113,10 @@ public async Task> FormatTokenAsync( } } - return Formatter.GetFormattedTextChanges(_root, new[] { TextSpan.FromBounds(adjustedStartPosition, adjustedEndPosition) }, services, _options.FormattingOptions, smartTokenformattingRules, cancellationToken); + var formatter = CSharpSyntaxFormatting.Instance; + var result = formatter.GetFormattingResult( + _root, new[] { TextSpan.FromBounds(adjustedStartPosition, adjustedEndPosition) }, _options.FormattingOptions, smartTokenformattingRules, cancellationToken); + return result.GetTextChanges(cancellationToken); } private class NoLineChangeFormattingRule : AbstractFormattingRule diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs index 2930aad0f7637..655821f498e6c 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs +++ b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs @@ -167,7 +167,7 @@ public bool TryGetSmartTokenIndentation(out IndentationResult indentationResult) var sourceText = Tree.GetText(CancellationToken); var formatter = _service.CreateSmartTokenFormatter(this); - var changes = formatter.FormatTokenAsync(Document.Project.Solution.Workspace.Services, token, CancellationToken) + var changes = formatter.FormatTokenAsync(token, CancellationToken) .WaitAndGetResult_CanCallOnBackground(CancellationToken); var updatedSourceText = sourceText.WithChanges(changes); diff --git a/src/Workspaces/Core/Portable/Indentation/ISmartTokenFormatter.cs b/src/Workspaces/Core/Portable/Indentation/ISmartTokenFormatter.cs index 2cab6570ce4c6..7b5e1dc398d5c 100644 --- a/src/Workspaces/Core/Portable/Indentation/ISmartTokenFormatter.cs +++ b/src/Workspaces/Core/Portable/Indentation/ISmartTokenFormatter.cs @@ -5,13 +5,12 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Text; namespace Microsoft.CodeAnalysis.Indentation { internal interface ISmartTokenFormatter { - Task> FormatTokenAsync(HostWorkspaceServices services, SyntaxToken token, CancellationToken cancellationToken); + Task> FormatTokenAsync(SyntaxToken token, CancellationToken cancellationToken); } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/CSharpSyntaxFormattingService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/CSharpSyntaxFormattingService.cs index c077466ebb0fc..afb077968485e 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/CSharpSyntaxFormattingService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/CSharpSyntaxFormattingService.cs @@ -19,37 +19,24 @@ namespace Microsoft.CodeAnalysis.CSharp.Formatting { -#if !CODE_STYLE - [ExportLanguageService(typeof(ISyntaxFormattingService), LanguageNames.CSharp), Shared] -#endif - internal class CSharpSyntaxFormattingService : AbstractSyntaxFormattingService + internal class CSharpSyntaxFormatting : AbstractSyntaxFormatting { - private readonly ImmutableList _rules; + public static readonly CSharpSyntaxFormatting Instance = new(); -#if CODE_STYLE - public static readonly CSharpSyntaxFormattingService Instance = new(); - -#else - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] -#endif - public CSharpSyntaxFormattingService() - { - _rules = ImmutableList.Create( - new WrappingFormattingRule(), - new SpacingFormattingRule(), - new NewLineUserSettingFormattingRule(), - new IndentUserSettingsFormattingRule(), - new ElasticTriviaFormattingRule(), - new EndOfFileTokenFormattingRule(), - new StructuredTriviaFormattingRule(), - new IndentBlockFormattingRule(), - new SuppressFormattingRule(), - new AnchorIndentationFormattingRule(), - new QueryExpressionFormattingRule(), - new TokenBasedFormattingRule(), - DefaultOperationProvider.Instance); - } + private readonly ImmutableList _rules = ImmutableList.Create( + new WrappingFormattingRule(), + new SpacingFormattingRule(), + new NewLineUserSettingFormattingRule(), + new IndentUserSettingsFormattingRule(), + new ElasticTriviaFormattingRule(), + new EndOfFileTokenFormattingRule(), + new StructuredTriviaFormattingRule(), + new IndentBlockFormattingRule(), + new SuppressFormattingRule(), + new AnchorIndentationFormattingRule(), + new QueryExpressionFormattingRule(), + new TokenBasedFormattingRule(), + DefaultOperationProvider.Instance); public override IEnumerable GetDefaultFormattingRules() => _rules; @@ -63,4 +50,16 @@ protected override IFormattingResult CreateAggregatedFormattingResult(SyntaxNode protected override AbstractFormattingResult Format(SyntaxNode node, SyntaxFormattingOptions options, IEnumerable formattingRules, SyntaxToken startToken, SyntaxToken endToken, CancellationToken cancellationToken) => new CSharpFormatEngine(node, options, formattingRules, startToken, endToken).Format(cancellationToken); } + +#if !CODE_STYLE + [ExportLanguageService(typeof(ISyntaxFormattingService), LanguageNames.CSharp), Shared] + internal class CSharpSyntaxFormattingService : CSharpSyntaxFormatting, ISyntaxFormattingService + { + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public CSharpSyntaxFormattingService() + { + } + } +#endif } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AbstractSyntaxFormattingService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AbstractSyntaxFormattingService.cs index 58d86aa33cacf..62451754a6573 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AbstractSyntaxFormattingService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AbstractSyntaxFormattingService.cs @@ -16,11 +16,11 @@ namespace Microsoft.CodeAnalysis.Formatting { - internal abstract class AbstractSyntaxFormattingService : ISyntaxFormattingService + internal abstract class AbstractSyntaxFormatting : ISyntaxFormatting { private static readonly Func s_notEmpty = s => !s.IsEmpty; - protected AbstractSyntaxFormattingService() + protected AbstractSyntaxFormatting() { } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/ISyntaxFormattingService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/ISyntaxFormattingService.cs index c83b980861bbe..b74cfa0fe85ee 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/ISyntaxFormattingService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/ISyntaxFormattingService.cs @@ -17,16 +17,19 @@ namespace Microsoft.CodeAnalysis.Formatting { - internal interface ISyntaxFormattingService -#if !CODE_STYLE - : ILanguageService -#endif + internal interface ISyntaxFormatting { SyntaxFormattingOptions GetFormattingOptions(AnalyzerConfigOptions options); IEnumerable GetDefaultFormattingRules(); IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable? spans, SyntaxFormattingOptions options, IEnumerable? rules, CancellationToken cancellationToken); } +#if !CODE_STYLE + internal interface ISyntaxFormattingService : ISyntaxFormatting, ILanguageService + { + } +#endif + internal abstract class SyntaxFormattingOptions { public readonly bool UseTabs; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.cs index 5591f9ac9bb57..b64807c7c73d4 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpRemoveUnnecessaryImportsService.cs @@ -39,8 +39,8 @@ public CSharpRemoveUnnecessaryImportsService() } #if CODE_STYLE - private static ISyntaxFormattingService GetSyntaxFormattingService() - => CSharpSyntaxFormattingService.Instance; + private static ISyntaxFormatting GetSyntaxFormatting() + => CSharpSyntaxFormatting.Instance; #endif protected override IUnnecessaryImportsProvider UnnecessaryImportsProvider @@ -68,7 +68,7 @@ public override async Task RemoveUnnecessaryImportsAsync( cancellationToken.ThrowIfCancellationRequested(); #if CODE_STYLE - var provider = GetSyntaxFormattingService(); + var provider = GetSyntaxFormatting(); var options = provider.GetFormattingOptions(document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(oldRoot.SyntaxTree)); #else var provider = document.Project.Solution.Workspace.Services; diff --git a/src/Workspaces/VisualBasic/Portable/Formatting/VisualBasicSyntaxFormattingService.vb b/src/Workspaces/VisualBasic/Portable/Formatting/VisualBasicSyntaxFormattingService.vb index 250f610fb7f43..4508d31ea1fc5 100644 --- a/src/Workspaces/VisualBasic/Portable/Formatting/VisualBasicSyntaxFormattingService.vb +++ b/src/Workspaces/VisualBasic/Portable/Formatting/VisualBasicSyntaxFormattingService.vb @@ -16,35 +16,19 @@ Imports Microsoft.CodeAnalysis.Host.Mef #End If Namespace Microsoft.CodeAnalysis.VisualBasic.Formatting -#If Not CODE_STYLE Then - - Friend Class VisualBasicSyntaxFormattingService -#Else - Friend Class VisualBasicSyntaxFormattingService -#End If - Inherits AbstractSyntaxFormattingService - Private ReadOnly _rules As ImmutableList(Of AbstractFormattingRule) + Friend Class VisualBasicSyntaxFormatting + Inherits AbstractSyntaxFormatting -#If CODE_STYLE Then - Public Shared ReadOnly Instance As New VisualBasicSyntaxFormattingService -#End If + Public Shared ReadOnly Instance As New VisualBasicSyntaxFormatting -#If Not CODE_STYLE Then - - - Public Sub New() -#Else - Public Sub New() -#End If - _rules = ImmutableList.Create(Of AbstractFormattingRule)( - New StructuredTriviaFormattingRule(), - New ElasticTriviaFormattingRule(), - New AdjustSpaceFormattingRule(), - New AlignTokensFormattingRule(), - New NodeBasedFormattingRule(), - DefaultOperationProvider.Instance) - End Sub + Private ReadOnly _rules As ImmutableList(Of AbstractFormattingRule) = ImmutableList.Create(Of AbstractFormattingRule)( + New StructuredTriviaFormattingRule(), + New ElasticTriviaFormattingRule(), + New AdjustSpaceFormattingRule(), + New AlignTokensFormattingRule(), + New NodeBasedFormattingRule(), + DefaultOperationProvider.Instance) Public Overrides Function GetDefaultFormattingRules() As IEnumerable(Of AbstractFormattingRule) Return _rules @@ -62,4 +46,17 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Formatting Return New VisualBasicFormatEngine(root, options, formattingRules, startToken, endToken).Format(cancellationToken) End Function End Class + +#If Not CODE_STYLE Then + + Friend Class VisualBasicSyntaxFormattingService + Inherits VisualBasicSyntaxFormatting + Implements ISyntaxFormattingService + + + + Public Sub New() + End Sub + End Class +#End If End Namespace diff --git a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicSmartTokenFormatter.vb b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicSmartTokenFormatter.vb index c6df0a006973d..7d4c35cd7666e 100644 --- a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicSmartTokenFormatter.vb +++ b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicSmartTokenFormatter.vb @@ -10,6 +10,7 @@ Imports Microsoft.CodeAnalysis.Options Imports Microsoft.CodeAnalysis.Host Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Syntax +Imports Microsoft.CodeAnalysis.VisualBasic.Formatting Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation Friend Class VisualBasicSmartTokenFormatter @@ -32,14 +33,16 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation Me._root = root End Sub - Public Function FormatTokenAsync(services As HostWorkspaceServices, token As SyntaxToken, cancellationToken As CancellationToken) As Tasks.Task(Of IList(Of TextChange)) Implements ISmartTokenFormatter.FormatTokenAsync + Public Function FormatTokenAsync(token As SyntaxToken, cancellationToken As CancellationToken) As Tasks.Task(Of IList(Of TextChange)) Implements ISmartTokenFormatter.FormatTokenAsync Contract.ThrowIfTrue(token.Kind = SyntaxKind.None OrElse token.Kind = SyntaxKind.EndOfFileToken) ' get previous token Dim previousToken = token.GetPreviousToken() Dim spans = SpecializedCollections.SingletonEnumerable(TextSpan.FromBounds(previousToken.SpanStart, token.Span.End)) - Return Task.FromResult(Formatter.GetFormattedTextChanges(_root, spans, services, _options, _formattingRules, cancellationToken)) + Dim formatter = VisualBasicSyntaxFormatting.Instance + Dim result = formatter.GetFormattingResult(_root, spans, _options, _formattingRules, cancellationToken) + Return Task.FromResult(result.GetTextChanges(cancellationToken)) End Function End Class End Namespace From 43eeb3ffd5e7c6e2bff4c4fcc7f195239f2aa246 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 17:29:23 -0700 Subject: [PATCH 046/131] Move indentation options down to codestyle layer --- .../Compiler/Core/CompilerExtensions.projitems | 3 +++ .../Compiler/Core}/Formatting/AutoFormattingOptions.cs | 7 ++++++- .../Core}/Formatting/FormattingOptions.IndentStyle.cs | 0 .../Compiler/Core}/Indentation/IndentationOptions.cs | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Compiler/Core}/Formatting/AutoFormattingOptions.cs (98%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Compiler/Core}/Formatting/FormattingOptions.IndentStyle.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Compiler/Core}/Indentation/IndentationOptions.cs (98%) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems index 6fb74a6ed131d..b118907d3e215 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems @@ -229,6 +229,9 @@ + + + diff --git a/src/Workspaces/Core/Portable/Formatting/AutoFormattingOptions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AutoFormattingOptions.cs similarity index 98% rename from src/Workspaces/Core/Portable/Formatting/AutoFormattingOptions.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AutoFormattingOptions.cs index edc1df9610d0e..a896ef124e036 100644 --- a/src/Workspaces/Core/Portable/Formatting/AutoFormattingOptions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AutoFormattingOptions.cs @@ -4,10 +4,13 @@ using System; using System.Collections.Immutable; +using Microsoft.CodeAnalysis.Options; + +#if !CODE_STYLE using System.Composition; using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Options.Providers; +#endif namespace Microsoft.CodeAnalysis.Formatting { @@ -21,6 +24,7 @@ internal readonly record struct AutoFormattingOptions( bool FormatOnSemicolon, bool FormatOnCloseBrace) { +#if !CODE_STYLE public static AutoFormattingOptions From(Project project) => From(project.Solution.Options, project.Language); @@ -70,5 +74,6 @@ public Metadata() "BraceCompletionOptions", nameof(AutoFormattingOnCloseBrace), defaultValue: true, storageLocation: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Formatting On Close Brace")); } +#endif } } diff --git a/src/Workspaces/Core/Portable/Formatting/FormattingOptions.IndentStyle.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions.IndentStyle.cs similarity index 100% rename from src/Workspaces/Core/Portable/Formatting/FormattingOptions.IndentStyle.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions.IndentStyle.cs diff --git a/src/Workspaces/Core/Portable/Indentation/IndentationOptions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/IndentationOptions.cs similarity index 98% rename from src/Workspaces/Core/Portable/Indentation/IndentationOptions.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/IndentationOptions.cs index b60fa4f7bc537..a911ac3350747 100644 --- a/src/Workspaces/Core/Portable/Indentation/IndentationOptions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/IndentationOptions.cs @@ -14,6 +14,7 @@ internal readonly record struct IndentationOptions( SyntaxFormattingOptions FormattingOptions, AutoFormattingOptions AutoFormattingOptions) { +#if !CODE_STYLE public static async Task FromDocumentAsync(Document document, CancellationToken cancellationToken) { var documentOptions = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); @@ -24,5 +25,6 @@ public static IndentationOptions From(OptionSet options, HostWorkspaceServices s => new( SyntaxFormattingOptions.Create(options, services, language), AutoFormattingOptions.From(options, language)); +#endif } } From e86cf013d6028d63182c4fa1acfca30c5963560c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 17:42:02 -0700 Subject: [PATCH 047/131] Get C# ISmartTokenFormatter off of HostWorkspaceServices --- .../Portable/Indentation/CSharpSmartTokenFormatter.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs b/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs index 931a69c8cb643..b0e77b2801fb4 100644 --- a/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs +++ b/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs @@ -11,9 +11,7 @@ using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Formatting.Rules; -using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Indentation; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; @@ -42,7 +40,7 @@ public CSharpSmartTokenFormatter( } public IList FormatRange( - HostWorkspaceServices services, SyntaxToken startToken, SyntaxToken endToken, CancellationToken cancellationToken) + SyntaxToken startToken, SyntaxToken endToken, CancellationToken cancellationToken) { Contract.ThrowIfTrue(startToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); Contract.ThrowIfTrue(endToken.Kind() is SyntaxKind.None or SyntaxKind.EndOfFileToken); @@ -60,7 +58,10 @@ public IList FormatRange( smartTokenformattingRules = (new NoLineChangeFormattingRule()).Concat(_formattingRules); } - return Formatter.GetFormattedTextChanges(_root, new[] { TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) }, services, _options.FormattingOptions, smartTokenformattingRules, cancellationToken); + var formatter = CSharpSyntaxFormatting.Instance; + var result = formatter.GetFormattingResult( + _root, new[] { TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) }, _options.FormattingOptions, smartTokenformattingRules, cancellationToken); + return result.GetTextChanges(); } private static bool CloseBraceOfTryOrDoBlock(SyntaxToken endToken) From 00b3391baaa15c532b40e47771b6a659108e6c4b Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 17:43:33 -0700 Subject: [PATCH 048/131] WIP --- .../Compiler/CSharp/CSharpCompilerExtensions.projitems | 1 + .../Compiler/CSharp}/Indentation/CSharpSmartTokenFormatter.cs | 0 .../Compiler/Core/CompilerExtensions.projitems | 1 + .../Compiler/Core}/Indentation/ISmartTokenFormatter.cs | 0 .../VisualBasic}/Indentation/VisualBasicSmartTokenFormatter.vb | 0 .../Compiler/VisualBasic/VisualBasicCompilerExtensions.projitems | 1 + 6 files changed, 3 insertions(+) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Compiler/CSharp}/Indentation/CSharpSmartTokenFormatter.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Compiler/Core}/Indentation/ISmartTokenFormatter.cs (100%) rename src/Workspaces/{VisualBasic/Portable => SharedUtilitiesAndExtensions/Compiler/VisualBasic}/Indentation/VisualBasicSmartTokenFormatter.vb (100%) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/CSharpCompilerExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/CSharpCompilerExtensions.projitems index 9dc3b28f94a90..9425a921eb212 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/CSharpCompilerExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/CSharpCompilerExtensions.projitems @@ -87,6 +87,7 @@ + diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Indentation/CSharpSmartTokenFormatter.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Indentation/CSharpSmartTokenFormatter.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems index b118907d3e215..f3f0cd948e72d 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems @@ -232,6 +232,7 @@ + diff --git a/src/Workspaces/Core/Portable/Indentation/ISmartTokenFormatter.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/ISmartTokenFormatter.cs similarity index 100% rename from src/Workspaces/Core/Portable/Indentation/ISmartTokenFormatter.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/ISmartTokenFormatter.cs diff --git a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicSmartTokenFormatter.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Indentation/VisualBasicSmartTokenFormatter.vb similarity index 100% rename from src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicSmartTokenFormatter.vb rename to src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Indentation/VisualBasicSmartTokenFormatter.vb diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/VisualBasicCompilerExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/VisualBasicCompilerExtensions.projitems index 123c5b5574bde..ce33db593dc13 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/VisualBasicCompilerExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/VisualBasicCompilerExtensions.projitems @@ -27,6 +27,7 @@ + From 649d323c1c9e68c799fca2b682cdb6fd051351e9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 17:46:52 -0700 Subject: [PATCH 049/131] Fixes --- .../Indentation/SmartTokenFormatterFormatRangeTests.cs | 2 +- .../Portable/Formatting/CSharpFormattingInteractionService.cs | 2 +- .../CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/Formatting/Indentation/SmartTokenFormatterFormatRangeTests.cs b/src/EditorFeatures/CSharpTest/Formatting/Indentation/SmartTokenFormatterFormatRangeTests.cs index 3f5ef74ec4eaf..7381ad106a6b1 100644 --- a/src/EditorFeatures/CSharpTest/Formatting/Indentation/SmartTokenFormatterFormatRangeTests.cs +++ b/src/EditorFeatures/CSharpTest/Formatting/Indentation/SmartTokenFormatterFormatRangeTests.cs @@ -3604,7 +3604,7 @@ private static async Task AutoFormatOnMarkerAsync(string initialMarkup, string e return; } - var changes = formatter.FormatRange(workspace.Services, tokenRange.Value.Item1, tokenRange.Value.Item2, CancellationToken.None); + var changes = formatter.FormatRange(tokenRange.Value.Item1, tokenRange.Value.Item2, CancellationToken.None); var actual = GetFormattedText(buffer, changes); Assert.Equal(expected, actual); } diff --git a/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs b/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs index 17d7873e71d20..3d666b519fb2d 100644 --- a/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs +++ b/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs @@ -332,7 +332,7 @@ private static async Task> FormatRangeAsync( var formatter = new CSharpSmartTokenFormatter(options, formattingRules, (CompilationUnitSyntax)root); - var changes = formatter.FormatRange(document.Project.Solution.Workspace.Services, tokenRange.Value.Item1, tokenRange.Value.Item2, cancellationToken); + var changes = formatter.FormatRange(tokenRange.Value.Item1, tokenRange.Value.Item2, cancellationToken); return changes.ToImmutableArray(); } diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs b/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs index b0e77b2801fb4..b2be44573a63f 100644 --- a/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs +++ b/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs @@ -61,7 +61,7 @@ public IList FormatRange( var formatter = CSharpSyntaxFormatting.Instance; var result = formatter.GetFormattingResult( _root, new[] { TextSpan.FromBounds(startToken.SpanStart, endToken.Span.End) }, _options.FormattingOptions, smartTokenformattingRules, cancellationToken); - return result.GetTextChanges(); + return result.GetTextChanges(cancellationToken); } private static bool CloseBraceOfTryOrDoBlock(SyntaxToken endToken) From b65e986a1029eac807e92096c26a6cfde50feb0c Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 18:15:49 -0700 Subject: [PATCH 050/131] Retrieve smart token formatter up front for indenter --- .../Indentation/CSharpIndentationService.Indenter.cs | 9 +++++---- .../Indentation/AbstractIndentationService.Indenter.cs | 10 +++++++--- .../Portable/Indentation/AbstractIndentationService.cs | 8 ++++++-- .../VisualBasicIndentationService.Indenter.vb | 8 ++++---- 4 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs index 34921a5b63d7f..2e04312ba92e2 100644 --- a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs +++ b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs @@ -13,6 +13,7 @@ using Microsoft.CodeAnalysis.Formatting.Rules; using Microsoft.CodeAnalysis.Indentation; using Microsoft.CodeAnalysis.Shared.Extensions; +using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CSharp.Indentation @@ -23,12 +24,12 @@ protected override bool ShouldUseTokenIndenter(Indenter indenter, out SyntaxToke => ShouldUseSmartTokenFormatterInsteadOfIndenter( indenter.Rules, indenter.Root, indenter.LineToBeIndented, indenter.Options, out syntaxToken); - protected override ISmartTokenFormatter CreateSmartTokenFormatter(Indenter indenter) + protected override ISmartTokenFormatter CreateSmartTokenFormatter(Document document, CompilationUnitSyntax root, TextLine lineToBeIndented, IndentationOptions options) { - var services = indenter.Document.Project.Solution.Workspace.Services; + var services = document.Project.Solution.Workspace.Services; var formattingRuleFactory = services.GetRequiredService(); - var rules = formattingRuleFactory.CreateRule(indenter.Document.Document, indenter.LineToBeIndented.Start).Concat(Formatter.GetDefaultFormattingRules(indenter.Document.Document)); - return new CSharpSmartTokenFormatter(indenter.Options, rules, indenter.Root); + var rules = formattingRuleFactory.CreateRule(document, lineToBeIndented.Start).Concat(Formatter.GetDefaultFormattingRules(document)); + return new CSharpSmartTokenFormatter(options, rules, root); } protected override IndentationResult? GetDesiredIndentationWorker(Indenter indenter, SyntaxToken? tokenOpt, SyntaxTrivia? triviaOpt) diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs index 655821f498e6c..bcb536d364d15 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs +++ b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs @@ -36,12 +36,15 @@ protected struct Indenter public readonly SyntaxTree Tree => Document.SyntaxTree; public readonly SourceText Text => Document.Text; + public readonly ISmartTokenFormatter SmartTokenFormatter; + public Indenter( AbstractIndentationService service, SyntacticDocument document, IEnumerable rules, IndentationOptions options, TextLine lineToBeIndented, + ISmartTokenFormatter smartTokenFormatter, CancellationToken cancellationToken) { Document = document; @@ -52,6 +55,7 @@ public Indenter( Root = (TSyntaxRoot)document.Root; LineToBeIndented = lineToBeIndented; _tabSize = options.FormattingOptions.TabSize; + SmartTokenFormatter = smartTokenFormatter; CancellationToken = cancellationToken; Rules = rules; @@ -166,9 +170,9 @@ public bool TryGetSmartTokenIndentation(out IndentationResult indentationResult) // var root = document.GetSyntaxRootSynchronously(cancellationToken); var sourceText = Tree.GetText(CancellationToken); - var formatter = _service.CreateSmartTokenFormatter(this); - var changes = formatter.FormatTokenAsync(token, CancellationToken) - .WaitAndGetResult_CanCallOnBackground(CancellationToken); + var changes = this.SmartTokenFormatter + .FormatTokenAsync(token, CancellationToken) + .WaitAndGetResult_CanCallOnBackground(CancellationToken); var updatedSourceText = sourceText.WithChanges(changes); if (LineToBeIndented.LineNumber < updatedSourceText.Lines.Count) diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs index 3c6655866c34f..b5bad2925ecea 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs +++ b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis.Formatting.Rules; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Indentation @@ -18,6 +19,7 @@ internal abstract partial class AbstractIndentationService : IInden where TSyntaxRoot : SyntaxNode, ICompilationUnitSyntax { protected abstract AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions.IndentStyle indentStyle); + protected abstract ISmartTokenFormatter CreateSmartTokenFormatter(Document document, TSyntaxRoot root, TextLine lineToBeIndented, IndentationOptions options); private IEnumerable GetFormattingRules(Document document, int position, FormattingOptions.IndentStyle indentStyle) { @@ -61,7 +63,10 @@ private Indenter GetIndenter(Document document, int lineNumber, FormattingOption var formattingRules = GetFormattingRules(document, lineToBeIndented.Start, indentStyle); - return new Indenter(this, syntacticDoc, formattingRules, options, lineToBeIndented, cancellationToken); + var smartTokenFormatter = CreateSmartTokenFormatter( + document, (TSyntaxRoot)syntacticDoc.Root, lineToBeIndented, options); + + return new Indenter(this, syntacticDoc, formattingRules, options, lineToBeIndented, smartTokenFormatter, cancellationToken); } /// @@ -71,7 +76,6 @@ private Indenter GetIndenter(Document document, int lineNumber, FormattingOption /// provided by this method. /// protected abstract bool ShouldUseTokenIndenter(Indenter indenter, out SyntaxToken token); - protected abstract ISmartTokenFormatter CreateSmartTokenFormatter(Indenter indenter); protected abstract IndentationResult? GetDesiredIndentationWorker( Indenter indenter, SyntaxToken? token, SyntaxTrivia? trivia); diff --git a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb index 969341de6fa91..417697f6bce57 100644 --- a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb +++ b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb @@ -16,11 +16,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation indenter.Rules, indenter.Root, indenter.LineToBeIndented, indenter.Options.FormattingOptions, token) End Function - Protected Overrides Function CreateSmartTokenFormatter(indenter As Indenter) As ISmartTokenFormatter - Dim services = indenter.Document.Project.Solution.Workspace.Services + Protected Overrides Function CreateSmartTokenFormatter(document As Document, root As CompilationUnitSyntax, lineToBeIndented As TextLine, options As IndentationOptions) As ISmartTokenFormatter + Dim services = document.Project.Solution.Workspace.Services Dim formattingRuleFactory = services.GetService(Of IHostDependentFormattingRuleFactoryService)() - Dim rules = {New SpecialFormattingRule(indenter.Options.AutoFormattingOptions.IndentStyle), formattingRuleFactory.CreateRule(indenter.Document.Document, indenter.LineToBeIndented.Start)}.Concat(Formatter.GetDefaultFormattingRules(indenter.Document.Document)) - Return New VisualBasicSmartTokenFormatter(indenter.Options.FormattingOptions, rules, indenter.Root) + Dim rules = {New SpecialFormattingRule(options.AutoFormattingOptions.IndentStyle), formattingRuleFactory.CreateRule(document, lineToBeIndented.Start)}.Concat(Formatter.GetDefaultFormattingRules(document)) + Return New VisualBasicSmartTokenFormatter(options.FormattingOptions, rules, root) End Function Protected Overrides Function GetDesiredIndentationWorker( From 98360fe33ddd2e6e5cac97c879c09ee4fdc6d875 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 20:46:50 -0700 Subject: [PATCH 051/131] Fix --- ...actCurlyBraceOrBracketCompletionService.cs | 2 +- .../CurlyBraceCompletionService.cs | 16 ++++++++-------- .../CSharpFormattingInteractionService.cs | 2 +- .../Editor/AutoFormattingOptionsWrapper.cs | 2 +- .../Indentation/CSharpIndentationService.cs | 4 ++-- .../Indentation/CSharpSmartTokenFormatter.cs | 2 +- .../Indentation/AbstractIndentationService.cs | 8 ++++---- .../FormattingOptions.IndentStyle.cs | 1 + .../Core/CompilerExtensions.projitems | 2 +- .../Core/Formatting/AutoFormattingOptions.cs | 4 ++-- .../FormattingOptions2.IndentStyle.cs | 19 +++++++++++++++++++ .../Core/Formatting/FormattingOptions2.cs | 2 +- .../Indentation/SpecialFormattingOperation.vb | 4 ++-- .../VisualBasicIndentationService.vb | 2 +- ...CodeAnalysis.VisualBasic.Workspaces.vbproj | 5 ++++- 15 files changed, 49 insertions(+), 26 deletions(-) rename src/Workspaces/{SharedUtilitiesAndExtensions/Compiler/Core/Formatting => Core/Portable/Indentation}/FormattingOptions.IndentStyle.cs (83%) create mode 100644 src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.IndentStyle.cs diff --git a/src/Features/CSharp/Portable/BraceCompletion/AbstractCurlyBraceOrBracketCompletionService.cs b/src/Features/CSharp/Portable/BraceCompletion/AbstractCurlyBraceOrBracketCompletionService.cs index 59f1d7906edb5..3ab21a9a8f0a1 100644 --- a/src/Features/CSharp/Portable/BraceCompletion/AbstractCurlyBraceOrBracketCompletionService.cs +++ b/src/Features/CSharp/Portable/BraceCompletion/AbstractCurlyBraceOrBracketCompletionService.cs @@ -219,7 +219,7 @@ static ImmutableArray GetMergedChanges(TextChange newLineEdit, Immut var startPoint = openingPoint; var endPoint = AdjustFormattingEndPoint(text, root, startPoint, closingPoint); - if (options.AutoFormattingOptions.IndentStyle == FormattingOptions.IndentStyle.Smart) + if (options.AutoFormattingOptions.IndentStyle == FormattingOptions2.IndentStyle.Smart) { // Set the formatting start point to be the beginning of the first word to the left // of the opening brace location. diff --git a/src/Features/CSharp/Portable/BraceCompletion/CurlyBraceCompletionService.cs b/src/Features/CSharp/Portable/BraceCompletion/CurlyBraceCompletionService.cs index 41f463b88acc9..0d8891e785bc6 100644 --- a/src/Features/CSharp/Portable/BraceCompletion/CurlyBraceCompletionService.cs +++ b/src/Features/CSharp/Portable/BraceCompletion/CurlyBraceCompletionService.cs @@ -92,25 +92,25 @@ private sealed class BraceCompletionFormattingRule : BaseFormattingRule private static readonly Predicate s_predicate = o => o == null || o.Option.IsOn(SuppressOption.NoWrapping); private static readonly ImmutableArray s_instances = ImmutableArray.Create( - new BraceCompletionFormattingRule(FormattingOptions.IndentStyle.None), - new BraceCompletionFormattingRule(FormattingOptions.IndentStyle.Block), - new BraceCompletionFormattingRule(FormattingOptions.IndentStyle.Smart)); + new BraceCompletionFormattingRule(FormattingOptions2.IndentStyle.None), + new BraceCompletionFormattingRule(FormattingOptions2.IndentStyle.Block), + new BraceCompletionFormattingRule(FormattingOptions2.IndentStyle.Smart)); - private readonly FormattingOptions.IndentStyle _indentStyle; + private readonly FormattingOptions2.IndentStyle _indentStyle; private readonly CSharpSyntaxFormattingOptions _options; - public BraceCompletionFormattingRule(FormattingOptions.IndentStyle indentStyle) + public BraceCompletionFormattingRule(FormattingOptions2.IndentStyle indentStyle) : this(indentStyle, CSharpSyntaxFormattingOptions.Default) { } - private BraceCompletionFormattingRule(FormattingOptions.IndentStyle indentStyle, CSharpSyntaxFormattingOptions options) + private BraceCompletionFormattingRule(FormattingOptions2.IndentStyle indentStyle, CSharpSyntaxFormattingOptions options) { _indentStyle = indentStyle; _options = options; } - public static AbstractFormattingRule ForIndentStyle(FormattingOptions.IndentStyle indentStyle) + public static AbstractFormattingRule ForIndentStyle(FormattingOptions2.IndentStyle indentStyle) { Debug.Assert(s_instances[(int)indentStyle]._indentStyle == indentStyle); return s_instances[(int)indentStyle]; @@ -250,7 +250,7 @@ private static bool IsControlBlock(SyntaxNode? node) public override void AddAlignTokensOperations(List list, SyntaxNode node, in NextAlignTokensOperationAction nextOperation) { base.AddAlignTokensOperations(list, node, in nextOperation); - if (_indentStyle == FormattingOptions.IndentStyle.Block) + if (_indentStyle == FormattingOptions2.IndentStyle.Block) { var bracePair = node.GetBracePair(); if (bracePair.IsValidBracketOrBracePair()) diff --git a/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs b/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs index 3d666b519fb2d..aff8e89724aea 100644 --- a/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs +++ b/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs @@ -46,7 +46,7 @@ public CSharpFormattingInteractionService() public bool SupportsFormattingOnTypedCharacter(Document document, AutoFormattingOptions options, char ch) { - var smartIndentOn = options.IndentStyle == FormattingOptions.IndentStyle.Smart; + var smartIndentOn = options.IndentStyle == FormattingOptions2.IndentStyle.Smart; // We consider the proper placement of a close curly or open curly when it is typed at // the start of the line to be a smart-indentation operation. As such, even if "format diff --git a/src/Tools/ExternalAccess/FSharp/Editor/AutoFormattingOptionsWrapper.cs b/src/Tools/ExternalAccess/FSharp/Editor/AutoFormattingOptionsWrapper.cs index 9e403a11b9eb1..c3f6af042cfbd 100644 --- a/src/Tools/ExternalAccess/FSharp/Editor/AutoFormattingOptionsWrapper.cs +++ b/src/Tools/ExternalAccess/FSharp/Editor/AutoFormattingOptionsWrapper.cs @@ -14,6 +14,6 @@ public AutoFormattingOptionsWrapper(AutoFormattingOptions underlyingObject) => UnderlyingObject = underlyingObject; public FormattingOptions.IndentStyle IndentStyle - => UnderlyingObject.IndentStyle; + => (FormattingOptions.IndentStyle)UnderlyingObject.IndentStyle; } } diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.cs b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.cs index 0352f8b050d7c..b7aaf99b66337 100644 --- a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.cs +++ b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.cs @@ -32,7 +32,7 @@ public CSharpIndentationService() { } - protected override AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions.IndentStyle indentStyle) + protected override AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions2.IndentStyle indentStyle) => s_instance; public static bool ShouldUseSmartTokenFormatterInsteadOfIndenter( @@ -51,7 +51,7 @@ public static bool ShouldUseSmartTokenFormatterInsteadOfIndenter( return false; } - if (options.AutoFormattingOptions.IndentStyle != FormattingOptions.IndentStyle.Smart) + if (options.AutoFormattingOptions.IndentStyle != FormattingOptions2.IndentStyle.Smart) { return false; } diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs b/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs index b2be44573a63f..d17774e9850aa 100644 --- a/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs +++ b/src/Workspaces/CSharp/Portable/Indentation/CSharpSmartTokenFormatter.cs @@ -104,7 +104,7 @@ public async Task> FormatTokenAsync( var smartTokenformattingRules = new SmartTokenFormattingRule().Concat(_formattingRules); var adjustedStartPosition = previousToken.SpanStart; if (token.IsKind(SyntaxKind.OpenBraceToken) && - _options.AutoFormattingOptions.IndentStyle != FormattingOptions.IndentStyle.Smart) + _options.AutoFormattingOptions.IndentStyle != FormattingOptions2.IndentStyle.Smart) { RoslynDebug.AssertNotNull(token.SyntaxTree); var text = await token.SyntaxTree.GetTextAsync(cancellationToken).ConfigureAwait(false); diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs index 3c6655866c34f..2911daa34a3e5 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs +++ b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs @@ -17,9 +17,9 @@ namespace Microsoft.CodeAnalysis.Indentation internal abstract partial class AbstractIndentationService : IIndentationService where TSyntaxRoot : SyntaxNode, ICompilationUnitSyntax { - protected abstract AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions.IndentStyle indentStyle); + protected abstract AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions2.IndentStyle indentStyle); - private IEnumerable GetFormattingRules(Document document, int position, FormattingOptions.IndentStyle indentStyle) + private IEnumerable GetFormattingRules(Document document, int position, FormattingOptions2.IndentStyle indentStyle) { var workspace = document.Project.Solution.Workspace; var formattingRuleFactory = workspace.Services.GetRequiredService(); @@ -33,7 +33,7 @@ public IndentationResult GetIndentation( Document document, int lineNumber, FormattingOptions.IndentStyle indentStyle, CancellationToken cancellationToken) { - var indenter = GetIndenter(document, lineNumber, indentStyle, cancellationToken); + var indenter = GetIndenter(document, lineNumber, (FormattingOptions2.IndentStyle)indentStyle, cancellationToken); if (indentStyle == FormattingOptions.IndentStyle.None) { @@ -51,7 +51,7 @@ public IndentationResult GetIndentation( return indenter.GetDesiredIndentation(indentStyle) ?? default; } - private Indenter GetIndenter(Document document, int lineNumber, FormattingOptions.IndentStyle indentStyle, CancellationToken cancellationToken) + private Indenter GetIndenter(Document document, int lineNumber, FormattingOptions2.IndentStyle indentStyle, CancellationToken cancellationToken) { var options = IndentationOptions.FromDocumentAsync(document, cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); var syntacticDoc = SyntacticDocument.CreateAsync(document, cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions.IndentStyle.cs b/src/Workspaces/Core/Portable/Indentation/FormattingOptions.IndentStyle.cs similarity index 83% rename from src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions.IndentStyle.cs rename to src/Workspaces/Core/Portable/Indentation/FormattingOptions.IndentStyle.cs index 110cf8f24dcf8..868176e161dd6 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions.IndentStyle.cs +++ b/src/Workspaces/Core/Portable/Indentation/FormattingOptions.IndentStyle.cs @@ -6,6 +6,7 @@ namespace Microsoft.CodeAnalysis.Formatting { public static partial class FormattingOptions { + // Publicly exposed. Keep in sync with IndentStyle2 in the CodeStyle layer. public enum IndentStyle { None = 0, diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems index b118907d3e215..1b7c019b64a1f 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems @@ -230,7 +230,7 @@ - + diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AutoFormattingOptions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AutoFormattingOptions.cs index a896ef124e036..03680232391b4 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AutoFormattingOptions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AutoFormattingOptions.cs @@ -18,7 +18,7 @@ namespace Microsoft.CodeAnalysis.Formatting /// Solution-wide formatting options. /// internal readonly record struct AutoFormattingOptions( - FormattingOptions.IndentStyle IndentStyle, + FormattingOptions2.IndentStyle IndentStyle, bool FormatOnReturn, bool FormatOnTyping, bool FormatOnSemicolon, @@ -30,7 +30,7 @@ public static AutoFormattingOptions From(Project project) public static AutoFormattingOptions From(OptionSet options, string language) => new( - IndentStyle: options.GetOption(Metadata.SmartIndent, language), + IndentStyle: (FormattingOptions2.IndentStyle)options.GetOption(Metadata.SmartIndent, language), FormatOnReturn: options.GetOption(Metadata.AutoFormattingOnReturn, language), FormatOnTyping: options.GetOption(Metadata.AutoFormattingOnTyping, language), FormatOnSemicolon: options.GetOption(Metadata.AutoFormattingOnSemicolon, language), diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.IndentStyle.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.IndentStyle.cs new file mode 100644 index 0000000000000..510a60679a166 --- /dev/null +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.IndentStyle.cs @@ -0,0 +1,19 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.Formatting +{ + internal partial class FormattingOptions2 + { + /// + /// For use in the shared CodeStyle layer. Keep in syntax with IndentStyle. + /// + internal enum IndentStyle + { + None = 0, + Block = 1, + Smart = 2 + } + } +} diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.cs index 13282f2a3e29b..a2e854a0268f7 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.cs @@ -19,7 +19,7 @@ namespace Microsoft.CodeAnalysis.Formatting /// /// Formatting options stored in editorconfig. /// - internal sealed class FormattingOptions2 + internal sealed partial class FormattingOptions2 { #if !CODE_STYLE [ExportSolutionOptionProvider, Shared] diff --git a/src/Workspaces/VisualBasic/Portable/Indentation/SpecialFormattingOperation.vb b/src/Workspaces/VisualBasic/Portable/Indentation/SpecialFormattingOperation.vb index e5274b39d6be0..23b611272d235 100644 --- a/src/Workspaces/VisualBasic/Portable/Indentation/SpecialFormattingOperation.vb +++ b/src/Workspaces/VisualBasic/Portable/Indentation/SpecialFormattingOperation.vb @@ -12,9 +12,9 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation Friend Class SpecialFormattingRule Inherits CompatAbstractFormattingRule - Private ReadOnly _indentStyle As FormattingOptions.IndentStyle + Private ReadOnly _indentStyle As FormattingOptions2.IndentStyle - Public Sub New(indentStyle As FormattingOptions.IndentStyle) + Public Sub New(indentStyle As FormattingOptions2.IndentStyle) _indentStyle = indentStyle End Sub diff --git a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.vb b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.vb index 99d57b198ddf9..a34c8cba6f539 100644 --- a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.vb +++ b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.vb @@ -32,7 +32,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation _specializedIndentationRule = specializedIndentationRule End Sub - Protected Overrides Function GetSpecializedIndentationFormattingRule(indentStyle As FormattingOptions.IndentStyle) As AbstractFormattingRule + Protected Overrides Function GetSpecializedIndentationFormattingRule(indentStyle As FormattingOptions2.IndentStyle) As AbstractFormattingRule Return If(_specializedIndentationRule, New SpecialFormattingRule(indentStyle)) End Function diff --git a/src/Workspaces/VisualBasic/Portable/Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj b/src/Workspaces/VisualBasic/Portable/Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj index de4b677c26798..74e8a9851cabc 100644 --- a/src/Workspaces/VisualBasic/Portable/Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj +++ b/src/Workspaces/VisualBasic/Portable/Microsoft.CodeAnalysis.VisualBasic.Workspaces.vbproj @@ -13,6 +13,10 @@ .NET Compiler Platform ("Roslyn") support for analyzing Visual Basic projects and solutions. + + + + @@ -50,7 +54,6 @@ - From 06ede8fed4dde08d5e9f87cc4240975835faeabd Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 21:06:39 -0700 Subject: [PATCH 052/131] Remove dependency on Document in indenter --- ...eractiveWindowCommandCompletionProvider.cs | 2 +- .../Indentation/CSharpIndentationService.cs | 16 +++- .../AbstractIndentationService.Indenter.cs | 28 +++--- .../Indentation/AbstractIndentationService.cs | 45 +++++---- .../CSharp/Extensions/SyntaxTreeExtensions.cs | 92 +++++++++++++++++++ .../Services/SyntaxFacts/CSharpSyntaxFacts.cs | 10 ++ .../Core/Services/SyntaxFacts/ISyntaxFacts.cs | 2 + .../SyntaxFacts/VisualBasicSyntaxFacts.vb | 8 ++ .../ContextQuery/SyntaxTreeExtensions.cs | 27 ------ .../CSharp/Extensions/SyntaxTreeExtensions.cs | 63 ------------- .../CSharpSyntaxFactsService.cs | 10 -- .../SyntaxFactsService/ISyntaxFactsService.cs | 2 - .../VisualBasicSyntaxFactsService.vb | 8 -- .../VisualBasicIndentationService.Indenter.vb | 14 +++ 14 files changed, 179 insertions(+), 148 deletions(-) diff --git a/src/VisualStudio/CSharp/Impl/Interactive/CSharpInteractiveWindowCommandCompletionProvider.cs b/src/VisualStudio/CSharp/Impl/Interactive/CSharpInteractiveWindowCommandCompletionProvider.cs index 7aee63e03175c..e0aa34baa6633 100644 --- a/src/VisualStudio/CSharp/Impl/Interactive/CSharpInteractiveWindowCommandCompletionProvider.cs +++ b/src/VisualStudio/CSharp/Impl/Interactive/CSharpInteractiveWindowCommandCompletionProvider.cs @@ -7,7 +7,7 @@ using System.ComponentModel.Composition; using System.Threading; using Microsoft.CodeAnalysis.Completion; -using Microsoft.CodeAnalysis.CSharp.Extensions.ContextQuery; +using Microsoft.CodeAnalysis.CSharp.Extensions; using Microsoft.CodeAnalysis.Editor; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Interactive; diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.cs b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.cs index b7aaf99b66337..c53c96ccf9629 100644 --- a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.cs +++ b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.cs @@ -7,11 +7,13 @@ using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Extensions; +using Microsoft.CodeAnalysis.CSharp.LanguageServices; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Formatting.Rules; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Indentation; +using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; @@ -24,16 +26,20 @@ internal sealed partial class CSharpIndentationService : AbstractIndentationServ { public static readonly CSharpIndentationService Instance = new(); - private static readonly AbstractFormattingRule s_instance = new FormattingRule(); - [ImportingConstructor] [SuppressMessage("RoslynDiagnosticsReliability", "RS0033:Importing constructor should be [Obsolete]", Justification = "Incorrectly used in production code: https://github.com/dotnet/roslyn/issues/42839")] public CSharpIndentationService() { } + protected override ISyntaxFacts SyntaxFacts + => CSharpSyntaxFacts.Instance; + + protected override IHeaderFacts HeaderFacts + => CSharpHeaderFacts.Instance; + protected override AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions2.IndentStyle indentStyle) - => s_instance; + => CSharpIndentationFormattingRule.Instance; public static bool ShouldUseSmartTokenFormatterInsteadOfIndenter( IEnumerable formattingRules, @@ -103,8 +109,10 @@ private static bool IsInvalidToken(SyntaxToken token) token.IsKind(SyntaxKind.EndOfFileToken); } - private class FormattingRule : AbstractFormattingRule + private class CSharpIndentationFormattingRule : AbstractFormattingRule { + public static readonly AbstractFormattingRule Instance = new CSharpIndentationFormattingRule(); + public override void AddIndentBlockOperations(List list, SyntaxNode node, in NextIndentBlockOperationAction nextOperation) { // these nodes should be from syntax tree from ITextSnapshot. diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs index bcb536d364d15..5fa03e8b17e2e 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs +++ b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; using System.Threading; using Microsoft.CodeAnalysis.Formatting; @@ -25,34 +26,33 @@ protected struct Indenter public readonly TextLine LineToBeIndented; public readonly CancellationToken CancellationToken; - public readonly SyntacticDocument Document; - public readonly TSyntaxRoot Root; public readonly IEnumerable Rules; public readonly BottomUpBaseIndentationFinder Finder; - private readonly ISyntaxFactsService _syntaxFacts; + private readonly ISyntaxFacts _syntaxFacts; private readonly int _tabSize; - public readonly SyntaxTree Tree => Document.SyntaxTree; - public readonly SourceText Text => Document.Text; + public readonly SyntaxTree Tree; + public readonly SourceText Text; + public readonly TSyntaxRoot Root; public readonly ISmartTokenFormatter SmartTokenFormatter; public Indenter( AbstractIndentationService service, - SyntacticDocument document, - IEnumerable rules, + SyntaxTree tree, + ImmutableArray rules, IndentationOptions options, TextLine lineToBeIndented, ISmartTokenFormatter smartTokenFormatter, CancellationToken cancellationToken) { - Document = document; - _service = service; - _syntaxFacts = document.Document.GetRequiredLanguageService(); + _syntaxFacts = service.SyntaxFacts; Options = options; - Root = (TSyntaxRoot)document.Root; + Tree = tree; + Text = tree.GetText(cancellationToken); + Root = (TSyntaxRoot)tree.GetRoot(cancellationToken); LineToBeIndented = lineToBeIndented; _tabSize = options.FormattingOptions.TabSize; SmartTokenFormatter = smartTokenFormatter; @@ -64,7 +64,7 @@ public Indenter( _tabSize, options.FormattingOptions.IndentationSize, tokenStream: null, - document.Document.GetRequiredLanguageService()); + service.HeaderFacts); } public IndentationResult? GetDesiredIndentation(FormattingOptions.IndentStyle indentStyle) @@ -76,7 +76,7 @@ public Indenter( // If the user has explicitly set 'block' indentation, or they're in an inactive preprocessor region, // then just do simple block indentation. if (indentStyle == FormattingOptions.IndentStyle.Block || - _syntaxFacts.IsInInactiveRegion(Document.SyntaxTree, LineToBeIndented.Start, this.CancellationToken)) + _syntaxFacts.IsInInactiveRegion(this.Tree, LineToBeIndented.Start, this.CancellationToken)) { return GetDesiredBlockIndentation(); } @@ -150,7 +150,7 @@ public Indenter( // text on it. We then set our indentation to whatever the indentation of that line was. for (var currentLine = this.LineToBeIndented.LineNumber - 1; currentLine >= 0; currentLine--) { - var line = this.Document.Text.Lines[currentLine]; + var line = this.Text.Lines[currentLine]; var offset = line.GetFirstNonWhitespaceOffset(); if (offset == null) continue; diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs index 680c09263a80f..c34b3a073ac38 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs +++ b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs @@ -9,26 +9,45 @@ using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Formatting.Rules; using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; +using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; +using System.Collections.Immutable; namespace Microsoft.CodeAnalysis.Indentation { internal abstract partial class AbstractIndentationService : IIndentationService where TSyntaxRoot : SyntaxNode, ICompilationUnitSyntax { + protected abstract ISyntaxFacts SyntaxFacts { get; } + protected abstract IHeaderFacts HeaderFacts { get; } + protected abstract AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions2.IndentStyle indentStyle); + + /// + /// Returns if the language specific should be deferred to figure out indentation. If so, it + /// will be asked to the resultant + /// provided by this method. + /// + protected abstract bool ShouldUseTokenIndenter(Indenter indenter, out SyntaxToken token); protected abstract ISmartTokenFormatter CreateSmartTokenFormatter(Document document, TSyntaxRoot root, TextLine lineToBeIndented, IndentationOptions options); - private IEnumerable GetFormattingRules(Document document, int position, FormattingOptions2.IndentStyle indentStyle) + protected abstract IndentationResult? GetDesiredIndentationWorker( + Indenter indenter, SyntaxToken? token, SyntaxTrivia? trivia); + + private ImmutableArray GetFormattingRules(Document document, int position, FormattingOptions2.IndentStyle indentStyle) { var workspace = document.Project.Solution.Workspace; var formattingRuleFactory = workspace.Services.GetRequiredService(); var baseIndentationRule = formattingRuleFactory.CreateRule(document, position); - var formattingRules = new[] { baseIndentationRule, this.GetSpecializedIndentationFormattingRule(indentStyle) }.Concat(Formatter.GetDefaultFormattingRules(document)); - return formattingRules; + return ImmutableArray.Create( + baseIndentationRule, + this.GetSpecializedIndentationFormattingRule(indentStyle)).AddRange( + Formatter.GetDefaultFormattingRules(document)); } public IndentationResult GetIndentation( @@ -56,28 +75,16 @@ public IndentationResult GetIndentation( private Indenter GetIndenter(Document document, int lineNumber, FormattingOptions2.IndentStyle indentStyle, CancellationToken cancellationToken) { var options = IndentationOptions.FromDocumentAsync(document, cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); - var syntacticDoc = SyntacticDocument.CreateAsync(document, cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); + var tree = document.GetRequiredSyntaxTreeSynchronously(cancellationToken); - var sourceText = syntacticDoc.Root.SyntaxTree.GetText(cancellationToken); + var sourceText = tree.GetText(cancellationToken); var lineToBeIndented = sourceText.Lines[lineNumber]; var formattingRules = GetFormattingRules(document, lineToBeIndented.Start, indentStyle); var smartTokenFormatter = CreateSmartTokenFormatter( - document, (TSyntaxRoot)syntacticDoc.Root, lineToBeIndented, options); - - return new Indenter(this, syntacticDoc, formattingRules, options, lineToBeIndented, smartTokenFormatter, cancellationToken); + document, (TSyntaxRoot)tree.GetRoot(cancellationToken), lineToBeIndented, options); + return new Indenter(this, tree, formattingRules, options, lineToBeIndented, smartTokenFormatter, cancellationToken); } - - /// - /// Returns if the language specific should be deferred to figure out indentation. If so, it - /// will be asked to the resultant - /// provided by this method. - /// - protected abstract bool ShouldUseTokenIndenter(Indenter indenter, out SyntaxToken token); - - protected abstract IndentationResult? GetDesiredIndentationWorker( - Indenter indenter, SyntaxToken? token, SyntaxTrivia? trivia); } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxTreeExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxTreeExtensions.cs index 7ec246fc8062e..0c1615e89cc9a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxTreeExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Extensions/SyntaxTreeExtensions.cs @@ -469,5 +469,97 @@ public static bool IsEntirelyWithinCharLiteral( return false; } + + public static bool IsInInactiveRegion( + this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) + { + Contract.ThrowIfNull(syntaxTree); + + // cases: + // $ is EOF + + // #if false + // | + + // #if false + // |$ + + // #if false + // | + + // #if false + // |$ + + if (syntaxTree.IsPreProcessorKeywordContext(position, cancellationToken)) + { + return false; + } + + // The latter two are the hard cases we don't actually have an + // DisabledTextTrivia yet. + var trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(position, findInsideTrivia: false); + if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) + { + return true; + } + + var token = syntaxTree.FindTokenOrEndToken(position, cancellationToken); + if (token.Kind() == SyntaxKind.EndOfFileToken) + { + var triviaList = token.LeadingTrivia; + foreach (var triviaTok in triviaList.Reverse()) + { + if (triviaTok.Span.Contains(position)) + { + return false; + } + + if (triviaTok.Span.End < position) + { + if (!triviaTok.HasStructure) + { + return false; + } + + var structure = triviaTok.GetStructure(); + if (structure is BranchingDirectiveTriviaSyntax branch) + { + return !branch.IsActive || !branch.BranchTaken; + } + } + } + } + + return false; + } + + public static bool IsPreProcessorKeywordContext(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) + { + return IsPreProcessorKeywordContext( + syntaxTree, position, + syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken, includeDirectives: true)); + } + +#pragma warning disable IDE0060 // Remove unused parameter + public static bool IsPreProcessorKeywordContext(this SyntaxTree syntaxTree, int position, SyntaxToken preProcessorTokenOnLeftOfPosition) +#pragma warning restore IDE0060 // Remove unused parameter + { + // cases: + // #| + // #d| + // # | + // # d| + + // note: comments are not allowed between the # and item. + var token = preProcessorTokenOnLeftOfPosition; + token = token.GetPreviousTokenIfTouchingWord(position); + + if (token.IsKind(SyntaxKind.HashToken)) + { + return true; + } + + return false; + } } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs index c4932eb2c2e4c..fb05e36cc9259 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Services/SyntaxFacts/CSharpSyntaxFacts.cs @@ -1596,6 +1596,16 @@ public bool IsVerbatimInterpolatedStringExpression(SyntaxNode node) => node is InterpolatedStringExpressionSyntax interpolatedString && interpolatedString.StringStartToken.IsKind(SyntaxKind.InterpolatedVerbatimStringStartToken); + public bool IsInInactiveRegion(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) + { + if (syntaxTree == null) + { + return false; + } + + return syntaxTree.IsInInactiveRegion(position, cancellationToken); + } + #region IsXXX members public bool IsAnonymousFunctionExpression([NotNullWhen(true)] SyntaxNode? node) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/ISyntaxFacts.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/ISyntaxFacts.cs index 5f1470e61148e..6898364da087a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/ISyntaxFacts.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Services/SyntaxFacts/ISyntaxFacts.cs @@ -535,6 +535,8 @@ void GetPartsOfInterpolationExpression(SyntaxNode node, SyntaxList GetContentFromDocumentationCommentTriviaSyntax(SyntaxTrivia trivia); + bool IsInInactiveRegion(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken); + #region IsXXX members bool IsAnonymousFunctionExpression([NotNullWhen(true)] SyntaxNode? node); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxFacts.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxFacts.vb index 3a5f365b83d0c..f229b1dc67032 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxFacts.vb +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Services/SyntaxFacts/VisualBasicSyntaxFacts.vb @@ -1808,6 +1808,14 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.LanguageServices Return False End Function + Public Function IsInInactiveRegion(syntaxTree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFacts.IsInInactiveRegion + If syntaxTree Is Nothing Then + Return False + End If + + Return syntaxTree.IsInInactiveRegion(position, cancellationToken) + End Function + #Region "IsXXX members" Public Function IsAnonymousFunctionExpression(node As SyntaxNode) As Boolean Implements ISyntaxFacts.IsAnonymousFunctionExpression diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ContextQuery/SyntaxTreeExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ContextQuery/SyntaxTreeExtensions.cs index 5094e36e17573..f765d3f284a83 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ContextQuery/SyntaxTreeExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/ContextQuery/SyntaxTreeExtensions.cs @@ -1883,33 +1883,6 @@ public static bool IsPreProcessorDirectiveContext(this SyntaxTree syntaxTree, in return syntaxTree.IsPreProcessorDirectiveContext(position, leftToken, cancellationToken); } - public static bool IsPreProcessorKeywordContext(this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) - { - return IsPreProcessorKeywordContext( - syntaxTree, position, - syntaxTree.FindTokenOnLeftOfPosition(position, cancellationToken, includeDirectives: true)); - } - - public static bool IsPreProcessorKeywordContext(this SyntaxTree syntaxTree, int position, SyntaxToken preProcessorTokenOnLeftOfPosition) - { - // cases: - // #| - // #d| - // # | - // # d| - - // note: comments are not allowed between the # and item. - var token = preProcessorTokenOnLeftOfPosition; - token = token.GetPreviousTokenIfTouchingWord(position); - - if (token.IsKind(SyntaxKind.HashToken)) - { - return true; - } - - return false; - } - public static bool IsStatementContext(this SyntaxTree syntaxTree, int position, SyntaxToken tokenOnLeftOfPosition, CancellationToken cancellationToken) { #if false diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/SyntaxTreeExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/SyntaxTreeExtensions.cs index 535f3f93d8284..5c93146b44baa 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/SyntaxTreeExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Extensions/SyntaxTreeExtensions.cs @@ -29,69 +29,6 @@ public static bool IsInNonUserCode(this SyntaxTree syntaxTree, int position, Can syntaxTree.IsInInactiveRegion(position, cancellationToken); } - public static bool IsInInactiveRegion( - this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) - { - Contract.ThrowIfNull(syntaxTree); - - // cases: - // $ is EOF - - // #if false - // | - - // #if false - // |$ - - // #if false - // | - - // #if false - // |$ - - if (syntaxTree.IsPreProcessorKeywordContext(position, cancellationToken)) - { - return false; - } - - // The latter two are the hard cases we don't actually have an - // DisabledTextTrivia yet. - var trivia = syntaxTree.GetRoot(cancellationToken).FindTrivia(position, findInsideTrivia: false); - if (trivia.Kind() == SyntaxKind.DisabledTextTrivia) - { - return true; - } - - var token = syntaxTree.FindTokenOrEndToken(position, cancellationToken); - if (token.Kind() == SyntaxKind.EndOfFileToken) - { - var triviaList = token.LeadingTrivia; - foreach (var triviaTok in triviaList.Reverse()) - { - if (triviaTok.Span.Contains(position)) - { - return false; - } - - if (triviaTok.Span.End < position) - { - if (!triviaTok.HasStructure) - { - return false; - } - - var structure = triviaTok.GetStructure(); - if (structure is BranchingDirectiveTriviaSyntax branch) - { - return !branch.IsActive || !branch.BranchTaken; - } - } - } - } - - return false; - } - public static bool IsInPartiallyWrittenGeneric( this SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpSyntaxFactsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpSyntaxFactsService.cs index dc5923a01e984..f2bd55d10c9c0 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpSyntaxFactsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpSyntaxFactsService.cs @@ -25,16 +25,6 @@ private sealed class CSharpSyntaxFactsService : CSharpSyntaxFacts, ISyntaxFactsS { internal static new readonly CSharpSyntaxFactsService Instance = new(); - public bool IsInInactiveRegion(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) - { - if (syntaxTree == null) - { - return false; - } - - return syntaxTree.IsInInactiveRegion(position, cancellationToken); - } - public bool IsInNonUserCode(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken) { if (syntaxTree == null) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs index 6c04babf1e2b3..07fa90679c793 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/SyntaxFactsService/ISyntaxFactsService.cs @@ -14,8 +14,6 @@ namespace Microsoft.CodeAnalysis.LanguageServices { internal interface ISyntaxFactsService : ISyntaxFacts, ILanguageService { - bool IsInInactiveRegion(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken); - bool IsInNonUserCode(SyntaxTree syntaxTree, int position, CancellationToken cancellationToken); // Violation. This is feature level code. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicSyntaxFactsService.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicSyntaxFactsService.vb index 870af74af9cf9..b600e5b9d7e1b 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicSyntaxFactsService.vb +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicSyntaxFactsService.vb @@ -20,14 +20,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic Private Sub New() End Sub - Public Function IsInInactiveRegion(syntaxTree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFactsService.IsInInactiveRegion - If syntaxTree Is Nothing Then - Return False - End If - - Return syntaxTree.IsInInactiveRegion(position, cancellationToken) - End Function - Public Function IsInNonUserCode(syntaxTree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As Boolean Implements ISyntaxFactsService.IsInNonUserCode If syntaxTree Is Nothing Then Return False diff --git a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb index 417697f6bce57..d99dffb798d0d 100644 --- a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb +++ b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb @@ -5,12 +5,26 @@ Imports Microsoft.CodeAnalysis.Formatting Imports Microsoft.CodeAnalysis.Formatting.Rules Imports Microsoft.CodeAnalysis.Indentation +Imports Microsoft.CodeAnalysis.LanguageServices Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Formatting +Imports Microsoft.CodeAnalysis.VisualBasic.LanguageServices Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation Partial Friend Class VisualBasicIndentationService + Protected Overrides ReadOnly Property SyntaxFacts As ISyntaxFacts + Get + Return VisualBasicSyntaxFacts.Instance + End Get + End Property + + Protected Overrides ReadOnly Property HeaderFacts As IHeaderFacts + Get + Return VisualBasicHeaderFacts.Instance + End Get + End Property + Protected Overrides Function ShouldUseTokenIndenter(indenter As Indenter, ByRef token As SyntaxToken) As Boolean Return ShouldUseSmartTokenFormatterInsteadOfIndenter( indenter.Rules, indenter.Root, indenter.LineToBeIndented, indenter.Options.FormattingOptions, token) From e87b2e9d624401c8318edc71f8ecf53602fce68a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 21:29:08 -0700 Subject: [PATCH 053/131] INline method --- .../Indentation/AbstractIndentationService.cs | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs index c34b3a073ac38..7ce7fe37b8884 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs +++ b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs @@ -38,18 +38,6 @@ internal abstract partial class AbstractIndentationService : IInden protected abstract IndentationResult? GetDesiredIndentationWorker( Indenter indenter, SyntaxToken? token, SyntaxTrivia? trivia); - private ImmutableArray GetFormattingRules(Document document, int position, FormattingOptions2.IndentStyle indentStyle) - { - var workspace = document.Project.Solution.Workspace; - var formattingRuleFactory = workspace.Services.GetRequiredService(); - var baseIndentationRule = formattingRuleFactory.CreateRule(document, position); - - return ImmutableArray.Create( - baseIndentationRule, - this.GetSpecializedIndentationFormattingRule(indentStyle)).AddRange( - Formatter.GetDefaultFormattingRules(document)); - } - public IndentationResult GetIndentation( Document document, int lineNumber, FormattingOptions.IndentStyle indentStyle, CancellationToken cancellationToken) @@ -80,7 +68,14 @@ private Indenter GetIndenter(Document document, int lineNumber, FormattingOption var sourceText = tree.GetText(cancellationToken); var lineToBeIndented = sourceText.Lines[lineNumber]; - var formattingRules = GetFormattingRules(document, lineToBeIndented.Start, indentStyle); + var workspace = document.Project.Solution.Workspace; + var formattingRuleFactory = workspace.Services.GetRequiredService(); + var baseIndentationRule = formattingRuleFactory.CreateRule(document, lineToBeIndented.Start); + + var formattingRules = ImmutableArray.Create( + baseIndentationRule, + this.GetSpecializedIndentationFormattingRule(indentStyle)).AddRange( + Formatter.GetDefaultFormattingRules(document)); var smartTokenFormatter = CreateSmartTokenFormatter( document, (TSyntaxRoot)tree.GetRoot(cancellationToken), lineToBeIndented, options); From 64ffab41897429af217d84965fe8fb0a9988dcdf Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 21:29:48 -0700 Subject: [PATCH 054/131] Reference type directly --- .../Portable/Indentation/CSharpIndentationService.Indenter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs index 2e04312ba92e2..7368413ac9f4e 100644 --- a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs +++ b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs @@ -28,7 +28,7 @@ protected override ISmartTokenFormatter CreateSmartTokenFormatter(Document docum { var services = document.Project.Solution.Workspace.Services; var formattingRuleFactory = services.GetRequiredService(); - var rules = formattingRuleFactory.CreateRule(document, lineToBeIndented.Start).Concat(Formatter.GetDefaultFormattingRules(document)); + var rules = formattingRuleFactory.CreateRule(document, lineToBeIndented.Start).Concat(CSharpSyntaxFormatting.Instance.GetDefaultFormattingRules()); return new CSharpSmartTokenFormatter(options, rules, root); } From 249d758f0411bad60b3327ab8f86e18ecc33963f Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 21:32:03 -0700 Subject: [PATCH 055/131] Don't use document --- .../Portable/Indentation/CSharpIndentationService.Indenter.cs | 2 +- .../Core/Portable/Indentation/AbstractIndentationService.cs | 3 --- .../Indentation/VisualBasicIndentationService.Indenter.vb | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs index 2e04312ba92e2..7368413ac9f4e 100644 --- a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs +++ b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs @@ -28,7 +28,7 @@ protected override ISmartTokenFormatter CreateSmartTokenFormatter(Document docum { var services = document.Project.Solution.Workspace.Services; var formattingRuleFactory = services.GetRequiredService(); - var rules = formattingRuleFactory.CreateRule(document, lineToBeIndented.Start).Concat(Formatter.GetDefaultFormattingRules(document)); + var rules = formattingRuleFactory.CreateRule(document, lineToBeIndented.Start).Concat(CSharpSyntaxFormatting.Instance.GetDefaultFormattingRules()); return new CSharpSmartTokenFormatter(options, rules, root); } diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs index 680c09263a80f..3dbf3361508b3 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs +++ b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs @@ -5,11 +5,8 @@ using System.Collections.Generic; using System.Linq; using System.Threading; -using System.Threading.Tasks; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Formatting.Rules; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; diff --git a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb index 417697f6bce57..39081b8765f6e 100644 --- a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb +++ b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb @@ -19,7 +19,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation Protected Overrides Function CreateSmartTokenFormatter(document As Document, root As CompilationUnitSyntax, lineToBeIndented As TextLine, options As IndentationOptions) As ISmartTokenFormatter Dim services = document.Project.Solution.Workspace.Services Dim formattingRuleFactory = services.GetService(Of IHostDependentFormattingRuleFactoryService)() - Dim rules = {New SpecialFormattingRule(options.AutoFormattingOptions.IndentStyle), formattingRuleFactory.CreateRule(document, lineToBeIndented.Start)}.Concat(Formatter.GetDefaultFormattingRules(document)) + Dim rules = {New SpecialFormattingRule(options.AutoFormattingOptions.IndentStyle), formattingRuleFactory.CreateRule(document, lineToBeIndented.Start)}.Concat(VisualBasicSyntaxFormatting.Instance.GetDefaultFormattingRules()) Return New VisualBasicSmartTokenFormatter(options.FormattingOptions, rules, root) End Function From e3eedb1719e7652f8db6a52a8966545e32eceb28 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 22:04:53 -0700 Subject: [PATCH 056/131] Use immutable array --- .../Indentation/CSharpFormatterTestsBase.cs | 3 ++- ...EditorNavigationBarItemService_CodeGeneration.vb | 3 ++- .../SmartTokenFormatter_FormatTokenTests.vb | 4 +++- .../CSharpFormattingInteractionService.cs | 13 ++++++++----- .../SignatureHelp/AbstractSignatureHelpProvider.cs | 2 +- .../Core/Impl/CodeModel/AbstractCodeModelService.cs | 3 ++- .../CSharpIndentationService.Indenter.cs | 9 +++++---- .../Core/Portable/Formatting/Formatter.cs | 5 +++-- .../Indentation/AbstractIndentationService.cs | 5 +++-- .../Formatting/CSharpSyntaxFormattingService.cs | 4 ++-- .../CSharp/Indentation/CSharpSmartTokenFormatter.cs | 9 +++++---- .../Formatting/AbstractSyntaxFormattingService.cs | 3 ++- .../Core/Formatting/ISyntaxFormattingService.cs | 3 ++- .../Indentation/VisualBasicSmartTokenFormatter.vb | 6 +++--- .../VisualBasicSyntaxFormattingService.vb | 4 ++-- .../VisualBasicIndentationService.Indenter.vb | 12 ++++++++---- 16 files changed, 53 insertions(+), 35 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/Formatting/Indentation/CSharpFormatterTestsBase.cs b/src/EditorFeatures/CSharpTest/Formatting/Indentation/CSharpFormatterTestsBase.cs index 8b026400d67c8..1ff1d0ead7677 100644 --- a/src/EditorFeatures/CSharpTest/Formatting/Indentation/CSharpFormatterTestsBase.cs +++ b/src/EditorFeatures/CSharpTest/Formatting/Indentation/CSharpFormatterTestsBase.cs @@ -5,6 +5,7 @@ #nullable disable using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -80,7 +81,7 @@ private static async Task TokenFormatWorkerAsync(TestWorkspace workspace, ITextB var formattingRuleProvider = workspace.Services.GetService(); - var rules = formattingRuleProvider.CreateRule(document, position).Concat(Formatter.GetDefaultFormattingRules(document)); + var rules = ImmutableArray.Create(formattingRuleProvider.CreateRule(document, position)).AddRange(Formatter.GetDefaultFormattingRules(document)); var options = await IndentationOptions.FromDocumentAsync(document, CancellationToken.None); var formatter = new CSharpSmartTokenFormatter(options, rules, root); diff --git a/src/EditorFeatures/VisualBasic/NavigationBar/VisualBasicEditorNavigationBarItemService_CodeGeneration.vb b/src/EditorFeatures/VisualBasic/NavigationBar/VisualBasicEditorNavigationBarItemService_CodeGeneration.vb index fc3cc823452f7..c38b116e3da29 100644 --- a/src/EditorFeatures/VisualBasic/NavigationBar/VisualBasicEditorNavigationBarItemService_CodeGeneration.vb +++ b/src/EditorFeatures/VisualBasic/NavigationBar/VisualBasicEditorNavigationBarItemService_CodeGeneration.vb @@ -10,6 +10,7 @@ Imports Microsoft.CodeAnalysis.Editing Imports Microsoft.CodeAnalysis.Editor.Shared.Utilities Imports Microsoft.CodeAnalysis.Editor.VisualBasic.Utilities Imports Microsoft.CodeAnalysis.Formatting +Imports Microsoft.CodeAnalysis.Formatting.Rules Imports Microsoft.CodeAnalysis.NavigationBar Imports Microsoft.CodeAnalysis.NavigationBar.RoslynNavigationBarItem Imports Microsoft.CodeAnalysis.PooledObjects @@ -62,7 +63,7 @@ Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.NavigationBar Dim formatterRules = Formatter.GetDefaultFormattingRules(newDocument) If ShouldApplyLineAdjustmentFormattingRule(generateCodeItem) Then - formatterRules = LineAdjustmentFormattingRule.Instance.Concat(formatterRules) + formatterRules = ImmutableArray.Create(Of AbstractFormattingRule)(LineAdjustmentFormattingRule.Instance).AddRange(formatterRules) End If Dim documentOptions = Await document.GetOptionsAsync(cancellationToken).ConfigureAwait(False) diff --git a/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb b/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb index 963b42b588913..c6d3f8b59e506 100644 --- a/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb @@ -2,10 +2,12 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports System.Threading Imports Microsoft.CodeAnalysis Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces Imports Microsoft.CodeAnalysis.Formatting +Imports Microsoft.CodeAnalysis.Formatting.Rules Imports Microsoft.CodeAnalysis.Options Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.Text.Shared.Extensions @@ -189,7 +191,7 @@ End Class Dim root = DirectCast(Await document.GetSyntaxRootAsync(), CompilationUnitSyntax) Dim options = Await SyntaxFormattingOptions.FromDocumentAsync(document, CancellationToken.None) - Dim formattingRules = New SpecialFormattingRule(indentStyle).Concat(Formatter.GetDefaultFormattingRules(document)) + Dim formattingRules = ImmutableArray.Create(Of AbstractFormattingRule)(New SpecialFormattingRule(indentStyle)).AddRange(Formatter.GetDefaultFormattingRules(document)) ' get token Dim token = root.FindToken(position) diff --git a/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs b/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs index aff8e89724aea..fdfe5a92a7e20 100644 --- a/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs +++ b/src/Features/CSharp/Portable/Formatting/CSharpFormattingInteractionService.cs @@ -133,11 +133,13 @@ public async Task> GetFormattingChangesOnPasteAsync( return result.GetTextChanges(cancellationToken).ToImmutableArray(); } - private static IEnumerable GetFormattingRules(Document document, int position, SyntaxToken tokenBeforeCaret) + private static ImmutableArray GetFormattingRules(Document document, int position, SyntaxToken tokenBeforeCaret) { var workspace = document.Project.Solution.Workspace; var formattingRuleFactory = workspace.Services.GetRequiredService(); - return formattingRuleFactory.CreateRule(document, position).Concat(GetTypingRules(tokenBeforeCaret)).Concat(Formatter.GetDefaultFormattingRules(document)); + return ImmutableArray.Create(formattingRuleFactory.CreateRule(document, position)) + .AddRange(GetTypingRules(tokenBeforeCaret)) + .AddRange(Formatter.GetDefaultFormattingRules(document)); } Task> IFormattingInteractionService.GetFormattingChangesOnReturnAsync( @@ -294,7 +296,8 @@ private static async Task GetTokenBeforeTheCaretAsync(Document docu return token; } - private static async Task> FormatTokenAsync(Document document, IndentationOptions options, SyntaxToken token, IEnumerable formattingRules, CancellationToken cancellationToken) + private static async Task> FormatTokenAsync( + Document document, IndentationOptions options, SyntaxToken token, ImmutableArray formattingRules, CancellationToken cancellationToken) { var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); var formatter = CreateSmartTokenFormatter(options, formattingRules, root); @@ -302,14 +305,14 @@ private static async Task> FormatTokenAsync(Document document, return changes; } - private static ISmartTokenFormatter CreateSmartTokenFormatter(IndentationOptions options, IEnumerable formattingRules, SyntaxNode root) + private static ISmartTokenFormatter CreateSmartTokenFormatter(IndentationOptions options, ImmutableArray formattingRules, SyntaxNode root) => new CSharpSmartTokenFormatter(options, formattingRules, (CompilationUnitSyntax)root); private static async Task> FormatRangeAsync( Document document, IndentationOptions options, SyntaxToken endToken, - IEnumerable formattingRules, + ImmutableArray formattingRules, CancellationToken cancellationToken) { if (!IsEndToken(endToken)) diff --git a/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs b/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs index 36332ab84bad3..0c2d3a8138d30 100644 --- a/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs +++ b/src/Features/Core/Portable/SignatureHelp/AbstractSignatureHelpProvider.cs @@ -286,7 +286,7 @@ private static async Task> FindActiveRelatedDocumentsAs using var _ = ArrayBuilder.GetInstance(out var builder); foreach (var relatedDocument in document.GetLinkedDocuments()) { - var syntaxTree = await relatedDocument.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); + var syntaxTree = await relatedDocument.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); if (!relatedDocument.GetRequiredLanguageService().IsInInactiveRegion(syntaxTree, position, cancellationToken)) { builder.Add(relatedDocument); diff --git a/src/VisualStudio/Core/Impl/CodeModel/AbstractCodeModelService.cs b/src/VisualStudio/Core/Impl/CodeModel/AbstractCodeModelService.cs index 150320fd42f9b..e841628c3c4b9 100644 --- a/src/VisualStudio/Core/Impl/CodeModel/AbstractCodeModelService.cs +++ b/src/VisualStudio/Core/Impl/CodeModel/AbstractCodeModelService.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; @@ -1033,7 +1034,7 @@ private Document FormatAnnotatedNode(Document document, SyntaxAnnotation annotat var formattingRules = Formatter.GetDefaultFormattingRules(document); if (additionalRules != null) { - formattingRules = additionalRules.Concat(formattingRules); + formattingRules = additionalRules.Concat(formattingRules).ToImmutableArray(); } return _threadingContext.JoinableTaskFactory.Run(async () => diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs index 7368413ac9f4e..06bbbfce7e109 100644 --- a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs +++ b/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using Microsoft.CodeAnalysis; @@ -24,11 +25,11 @@ protected override bool ShouldUseTokenIndenter(Indenter indenter, out SyntaxToke => ShouldUseSmartTokenFormatterInsteadOfIndenter( indenter.Rules, indenter.Root, indenter.LineToBeIndented, indenter.Options, out syntaxToken); - protected override ISmartTokenFormatter CreateSmartTokenFormatter(Document document, CompilationUnitSyntax root, TextLine lineToBeIndented, IndentationOptions options) + protected override ISmartTokenFormatter CreateSmartTokenFormatter( + CompilationUnitSyntax root, TextLine lineToBeIndented, + IndentationOptions options, AbstractFormattingRule baseIndentationRule) { - var services = document.Project.Solution.Workspace.Services; - var formattingRuleFactory = services.GetRequiredService(); - var rules = formattingRuleFactory.CreateRule(document, lineToBeIndented.Start).Concat(CSharpSyntaxFormatting.Instance.GetDefaultFormattingRules()); + var rules = ImmutableArray.Create(baseIndentationRule).AddRange(CSharpSyntaxFormatting.Instance.GetDefaultFormattingRules()); return new CSharpSmartTokenFormatter(options, rules, root); } diff --git a/src/Workspaces/Core/Portable/Formatting/Formatter.cs b/src/Workspaces/Core/Portable/Formatting/Formatter.cs index 5574dc9dd9fb9..1d13f8101bc65 100644 --- a/src/Workspaces/Core/Portable/Formatting/Formatter.cs +++ b/src/Workspaces/Core/Portable/Formatting/Formatter.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Diagnostics; @@ -31,7 +32,7 @@ public static class Formatter /// /// Gets the formatting rules that would be applied if left unspecified. /// - internal static IEnumerable GetDefaultFormattingRules(Document document) + internal static ImmutableArray GetDefaultFormattingRules(Document document) { if (document == null) { @@ -45,7 +46,7 @@ internal static IEnumerable GetDefaultFormattingRules(Do } else { - return SpecializedCollections.EmptyEnumerable(); + return ImmutableArray.Empty; } } diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs index 934568a2551d3..d6dcb727dcc39 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs +++ b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs @@ -28,7 +28,8 @@ internal abstract partial class AbstractIndentationService : IInden /// provided by this method. /// protected abstract bool ShouldUseTokenIndenter(Indenter indenter, out SyntaxToken token); - protected abstract ISmartTokenFormatter CreateSmartTokenFormatter(Document document, TSyntaxRoot root, TextLine lineToBeIndented, IndentationOptions options); + protected abstract ISmartTokenFormatter CreateSmartTokenFormatter( + TSyntaxRoot root, TextLine lineToBeIndented, IndentationOptions options, AbstractFormattingRule baseFormattingRule); protected abstract IndentationResult? GetDesiredIndentationWorker( Indenter indenter, SyntaxToken? token, SyntaxTrivia? trivia); @@ -73,7 +74,7 @@ private Indenter GetIndenter(Document document, int lineNumber, FormattingOption Formatter.GetDefaultFormattingRules(document)); var smartTokenFormatter = CreateSmartTokenFormatter( - document, (TSyntaxRoot)tree.GetRoot(cancellationToken), lineToBeIndented, options); + (TSyntaxRoot)tree.GetRoot(cancellationToken), lineToBeIndented, options, baseIndentationRule); return new Indenter(this, tree, formattingRules, options, lineToBeIndented, smartTokenFormatter, cancellationToken); } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/CSharpSyntaxFormattingService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/CSharpSyntaxFormattingService.cs index afb077968485e..8e06f5d654384 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/CSharpSyntaxFormattingService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/CSharpSyntaxFormattingService.cs @@ -23,7 +23,7 @@ internal class CSharpSyntaxFormatting : AbstractSyntaxFormatting { public static readonly CSharpSyntaxFormatting Instance = new(); - private readonly ImmutableList _rules = ImmutableList.Create( + private readonly ImmutableArray _rules = ImmutableArray.Create( new WrappingFormattingRule(), new SpacingFormattingRule(), new NewLineUserSettingFormattingRule(), @@ -38,7 +38,7 @@ internal class CSharpSyntaxFormatting : AbstractSyntaxFormatting new TokenBasedFormattingRule(), DefaultOperationProvider.Instance); - public override IEnumerable GetDefaultFormattingRules() + public override ImmutableArray GetDefaultFormattingRules() => _rules; public override SyntaxFormattingOptions GetFormattingOptions(AnalyzerConfigOptions options) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Indentation/CSharpSmartTokenFormatter.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Indentation/CSharpSmartTokenFormatter.cs index d17774e9850aa..b93c66e2379ad 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Indentation/CSharpSmartTokenFormatter.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Indentation/CSharpSmartTokenFormatter.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis; @@ -21,16 +22,15 @@ namespace Microsoft.CodeAnalysis.CSharp.Indentation internal class CSharpSmartTokenFormatter : ISmartTokenFormatter { private readonly IndentationOptions _options; - private readonly IEnumerable _formattingRules; + private readonly ImmutableArray _formattingRules; private readonly CompilationUnitSyntax _root; public CSharpSmartTokenFormatter( IndentationOptions options, - IEnumerable formattingRules, + ImmutableArray formattingRules, CompilationUnitSyntax root) { - Contract.ThrowIfNull(formattingRules); Contract.ThrowIfNull(root); _options = options; @@ -55,7 +55,8 @@ public IList FormatRange( // Exception 2: Similar behavior for do-while if (common.ContainsDiagnostics && !CloseBraceOfTryOrDoBlock(endToken)) { - smartTokenformattingRules = (new NoLineChangeFormattingRule()).Concat(_formattingRules); + smartTokenformattingRules = ImmutableArray.Empty.Add( + new NoLineChangeFormattingRule()).AddRange(_formattingRules); } var formatter = CSharpSyntaxFormatting.Instance; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AbstractSyntaxFormattingService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AbstractSyntaxFormattingService.cs index 62451754a6573..887b5b23f345e 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AbstractSyntaxFormattingService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AbstractSyntaxFormattingService.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Threading; using Microsoft.CodeAnalysis.Diagnostics; @@ -26,7 +27,7 @@ protected AbstractSyntaxFormatting() public abstract SyntaxFormattingOptions GetFormattingOptions(AnalyzerConfigOptions options); - public abstract IEnumerable GetDefaultFormattingRules(); + public abstract ImmutableArray GetDefaultFormattingRules(); protected abstract IFormattingResult CreateAggregatedFormattingResult(SyntaxNode node, IList results, SimpleIntervalTree? formattingSpans = null); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/ISyntaxFormattingService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/ISyntaxFormattingService.cs index b74cfa0fe85ee..1d00d83ddfa1a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/ISyntaxFormattingService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/ISyntaxFormattingService.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Formatting.Rules; @@ -20,7 +21,7 @@ namespace Microsoft.CodeAnalysis.Formatting internal interface ISyntaxFormatting { SyntaxFormattingOptions GetFormattingOptions(AnalyzerConfigOptions options); - IEnumerable GetDefaultFormattingRules(); + ImmutableArray GetDefaultFormattingRules(); IFormattingResult GetFormattingResult(SyntaxNode node, IEnumerable? spans, SyntaxFormattingOptions options, IEnumerable? rules, CancellationToken cancellationToken); } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Indentation/VisualBasicSmartTokenFormatter.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Indentation/VisualBasicSmartTokenFormatter.vb index 7d4c35cd7666e..79ab32b27a872 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Indentation/VisualBasicSmartTokenFormatter.vb +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/VisualBasic/Indentation/VisualBasicSmartTokenFormatter.vb @@ -11,20 +11,20 @@ Imports Microsoft.CodeAnalysis.Host Imports Microsoft.CodeAnalysis.Text Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Microsoft.CodeAnalysis.VisualBasic.Formatting +Imports System.Collections.Immutable Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation Friend Class VisualBasicSmartTokenFormatter Implements ISmartTokenFormatter Private ReadOnly _options As SyntaxFormattingOptions - Private ReadOnly _formattingRules As IEnumerable(Of AbstractFormattingRule) + Private ReadOnly _formattingRules As ImmutableArray(Of AbstractFormattingRule) Private ReadOnly _root As CompilationUnitSyntax Public Sub New(options As SyntaxFormattingOptions, - formattingRules As IEnumerable(Of AbstractFormattingRule), + formattingRules As ImmutableArray(Of AbstractFormattingRule), root As CompilationUnitSyntax) - Contract.ThrowIfNull(formattingRules) Contract.ThrowIfNull(root) Me._options = options diff --git a/src/Workspaces/VisualBasic/Portable/Formatting/VisualBasicSyntaxFormattingService.vb b/src/Workspaces/VisualBasic/Portable/Formatting/VisualBasicSyntaxFormattingService.vb index 4508d31ea1fc5..ae9db6885960f 100644 --- a/src/Workspaces/VisualBasic/Portable/Formatting/VisualBasicSyntaxFormattingService.vb +++ b/src/Workspaces/VisualBasic/Portable/Formatting/VisualBasicSyntaxFormattingService.vb @@ -22,7 +22,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Formatting Public Shared ReadOnly Instance As New VisualBasicSyntaxFormatting - Private ReadOnly _rules As ImmutableList(Of AbstractFormattingRule) = ImmutableList.Create(Of AbstractFormattingRule)( + Private ReadOnly _rules As ImmutableArray(Of AbstractFormattingRule) = ImmutableArray.Create(Of AbstractFormattingRule)( New StructuredTriviaFormattingRule(), New ElasticTriviaFormattingRule(), New AdjustSpaceFormattingRule(), @@ -30,7 +30,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Formatting New NodeBasedFormattingRule(), DefaultOperationProvider.Instance) - Public Overrides Function GetDefaultFormattingRules() As IEnumerable(Of AbstractFormattingRule) + Public Overrides Function GetDefaultFormattingRules() As ImmutableArray(Of AbstractFormattingRule) Return _rules End Function diff --git a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb index dcddc433dfd57..4257ba8c93957 100644 --- a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb +++ b/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb @@ -2,6 +2,7 @@ ' The .NET Foundation licenses this file to you under the MIT license. ' See the LICENSE file in the project root for more information. +Imports System.Collections.Immutable Imports Microsoft.CodeAnalysis.Formatting Imports Microsoft.CodeAnalysis.Formatting.Rules Imports Microsoft.CodeAnalysis.Indentation @@ -30,10 +31,13 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation indenter.Rules, indenter.Root, indenter.LineToBeIndented, indenter.Options.FormattingOptions, token) End Function - Protected Overrides Function CreateSmartTokenFormatter(document As Document, root As CompilationUnitSyntax, lineToBeIndented As TextLine, options As IndentationOptions) As ISmartTokenFormatter - Dim services = document.Project.Solution.Workspace.Services - Dim formattingRuleFactory = services.GetService(Of IHostDependentFormattingRuleFactoryService)() - Dim rules = {New SpecialFormattingRule(options.AutoFormattingOptions.IndentStyle), formattingRuleFactory.CreateRule(document, lineToBeIndented.Start)}.Concat(VisualBasicSyntaxFormatting.Instance.GetDefaultFormattingRules()) + Protected Overrides Function CreateSmartTokenFormatter( + root As CompilationUnitSyntax, + lineToBeIndented As TextLine, + options As IndentationOptions, + baseIndentationRule As AbstractFormattingRule) As ISmartTokenFormatter + Dim rules = ImmutableArray.Create(New SpecialFormattingRule(options.AutoFormattingOptions.IndentStyle), baseIndentationRule). + AddRange(VisualBasicSyntaxFormatting.Instance.GetDefaultFormattingRules()) Return New VisualBasicSmartTokenFormatter(options.FormattingOptions, rules, root) End Function From fadaa5921071dcccf1322dc71b8eb1e097945948 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 22:12:30 -0700 Subject: [PATCH 057/131] Move indenter logic down to codestyle --- .../Indentation/AbstractIndentationService.cs | 29 ++----- .../Indentation/IIndentationService.cs | 31 -------- .../Core/CompilerExtensions.projitems | 3 + .../AbstractIndentation.Indenter.cs} | 14 ++-- .../Core/Indentation/AbstractIndentation.cs | 79 +++++++++++++++++++ .../Core/Indentation/IndentationResult.cs | 38 +++++++++ 6 files changed, 132 insertions(+), 62 deletions(-) rename src/Workspaces/{Core/Portable/Indentation/AbstractIndentationService.Indenter.cs => SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.Indenter.cs} (95%) create mode 100644 src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.cs create mode 100644 src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/IndentationResult.cs diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs index d6dcb727dcc39..740bb815b1caf 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs +++ b/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs @@ -6,46 +6,27 @@ using System.Threading; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Formatting.Rules; -using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; -using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Indentation { - internal abstract partial class AbstractIndentationService : IIndentationService + internal abstract partial class AbstractIndentationService + : AbstractIndentation, IIndentationService where TSyntaxRoot : SyntaxNode, ICompilationUnitSyntax { - protected abstract ISyntaxFacts SyntaxFacts { get; } - protected abstract IHeaderFacts HeaderFacts { get; } - - protected abstract AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions2.IndentStyle indentStyle); - - /// - /// Returns if the language specific should be deferred to figure out indentation. If so, it - /// will be asked to the resultant - /// provided by this method. - /// - protected abstract bool ShouldUseTokenIndenter(Indenter indenter, out SyntaxToken token); - protected abstract ISmartTokenFormatter CreateSmartTokenFormatter( - TSyntaxRoot root, TextLine lineToBeIndented, IndentationOptions options, AbstractFormattingRule baseFormattingRule); - - protected abstract IndentationResult? GetDesiredIndentationWorker( - Indenter indenter, SyntaxToken? token, SyntaxTrivia? trivia); - public IndentationResult GetIndentation( Document document, int lineNumber, FormattingOptions.IndentStyle indentStyle, CancellationToken cancellationToken) { - var indenter = GetIndenter(document, lineNumber, (FormattingOptions2.IndentStyle)indentStyle, cancellationToken); - if (indentStyle == FormattingOptions.IndentStyle.None) { // If there is no indent style, then do nothing. return new IndentationResult(basePosition: 0, offset: 0); } + var indenter = GetIndenter(document, lineNumber, (FormattingOptions2.IndentStyle)indentStyle, cancellationToken); + if (indentStyle == FormattingOptions.IndentStyle.Smart && indenter.TryGetSmartTokenIndentation(out var indentationResult)) { @@ -53,7 +34,7 @@ public IndentationResult GetIndentation( } // If the indenter can't produce a valid result, just default to 0 as our indentation. - return indenter.GetDesiredIndentation(indentStyle) ?? default; + return indenter.GetDesiredIndentation((FormattingOptions2.IndentStyle)indentStyle) ?? default; } private Indenter GetIndenter(Document document, int lineNumber, FormattingOptions2.IndentStyle indentStyle, CancellationToken cancellationToken) diff --git a/src/Workspaces/Core/Portable/Indentation/IIndentationService.cs b/src/Workspaces/Core/Portable/Indentation/IIndentationService.cs index bded4bc6cc168..ff3801d6313b1 100644 --- a/src/Workspaces/Core/Portable/Indentation/IIndentationService.cs +++ b/src/Workspaces/Core/Portable/Indentation/IIndentationService.cs @@ -13,37 +13,6 @@ namespace Microsoft.CodeAnalysis.Indentation { - /// - /// An indentation result represents where the indent should be placed. It conveys this through - /// a pair of values. A position in the existing document where the indent should be relative, - /// and the number of columns after that the indent should be placed at. - /// - /// This pairing provides flexibility to the implementor to compute the indentation results in - /// a variety of ways. For example, one implementation may wish to express indentation of a - /// newline as being four columns past the start of the first token on a previous line. Another - /// may wish to simply express the indentation as an absolute amount from the start of the - /// current line. With this tuple, both forms can be expressed, and the implementor does not - /// have to convert from one to the other. - /// - internal struct IndentationResult - { - /// - /// The base position in the document that the indent should be relative to. This position - /// can occur on any line (including the current line, or a previous line). - /// - public int BasePosition { get; } - - /// - /// The number of columns the indent should be at relative to the BasePosition's column. - /// - public int Offset { get; } - - public IndentationResult(int basePosition, int offset) : this() - { - this.BasePosition = basePosition; - this.Offset = offset; - } - } internal interface IIndentationService : ILanguageService { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems index 13c6daa12d50a..c607d75c4dfc0 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CompilerExtensions.projitems @@ -231,7 +231,10 @@ + + + diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.Indenter.cs similarity index 95% rename from src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.Indenter.cs index 5fa03e8b17e2e..d6d5b54765976 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.Indenter.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.Indenter.cs @@ -16,11 +16,11 @@ namespace Microsoft.CodeAnalysis.Indentation { - internal abstract partial class AbstractIndentationService + internal abstract partial class AbstractIndentation { protected struct Indenter { - private readonly AbstractIndentationService _service; + private readonly AbstractIndentation _service; public readonly IndentationOptions Options; public readonly TextLine LineToBeIndented; @@ -39,7 +39,7 @@ protected struct Indenter public readonly ISmartTokenFormatter SmartTokenFormatter; public Indenter( - AbstractIndentationService service, + AbstractIndentation service, SyntaxTree tree, ImmutableArray rules, IndentationOptions options, @@ -67,21 +67,21 @@ public Indenter( service.HeaderFacts); } - public IndentationResult? GetDesiredIndentation(FormattingOptions.IndentStyle indentStyle) + public IndentationResult? GetDesiredIndentation(FormattingOptions2.IndentStyle indentStyle) { // If the caller wants no indent, then we'll return an effective '0' indent. - if (indentStyle == FormattingOptions.IndentStyle.None) + if (indentStyle == FormattingOptions2.IndentStyle.None) return null; // If the user has explicitly set 'block' indentation, or they're in an inactive preprocessor region, // then just do simple block indentation. - if (indentStyle == FormattingOptions.IndentStyle.Block || + if (indentStyle == FormattingOptions2.IndentStyle.Block || _syntaxFacts.IsInInactiveRegion(this.Tree, LineToBeIndented.Start, this.CancellationToken)) { return GetDesiredBlockIndentation(); } - Debug.Assert(indentStyle == FormattingOptions.IndentStyle.Smart); + Debug.Assert(indentStyle == FormattingOptions2.IndentStyle.Smart); return GetDesiredSmartIndentation(); } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.cs new file mode 100644 index 0000000000000..9651517c8cfbd --- /dev/null +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.cs @@ -0,0 +1,79 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.CodeAnalysis.Formatting; +using Microsoft.CodeAnalysis.Formatting.Rules; +using Microsoft.CodeAnalysis.LanguageServices; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Indentation +{ + internal abstract partial class AbstractIndentation + where TSyntaxRoot : SyntaxNode, ICompilationUnitSyntax + { + protected abstract ISyntaxFacts SyntaxFacts { get; } + protected abstract IHeaderFacts HeaderFacts { get; } + + protected abstract AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions2.IndentStyle indentStyle); + + /// + /// Returns if the language specific should be deferred to figure out indentation. If so, it + /// will be asked to the resultant + /// provided by this method. + /// + protected abstract bool ShouldUseTokenIndenter(Indenter indenter, out SyntaxToken token); + protected abstract ISmartTokenFormatter CreateSmartTokenFormatter( + TSyntaxRoot root, TextLine lineToBeIndented, IndentationOptions options, AbstractFormattingRule baseFormattingRule); + + protected abstract IndentationResult? GetDesiredIndentationWorker( + Indenter indenter, SyntaxToken? token, SyntaxTrivia? trivia); + +#if false + public IndentationResult GetIndentation( + Document document, int lineNumber, + FormattingOptions.IndentStyle indentStyle, CancellationToken cancellationToken) + { + var indenter = GetIndenter(document, lineNumber, (FormattingOptions2.IndentStyle)indentStyle, cancellationToken); + + if (indentStyle == FormattingOptions.IndentStyle.None) + { + // If there is no indent style, then do nothing. + return new IndentationResult(basePosition: 0, offset: 0); + } + + if (indentStyle == FormattingOptions.IndentStyle.Smart && + indenter.TryGetSmartTokenIndentation(out var indentationResult)) + { + return indentationResult; + } + + // If the indenter can't produce a valid result, just default to 0 as our indentation. + return indenter.GetDesiredIndentation(indentStyle) ?? default; + } + + private Indenter GetIndenter(Document document, int lineNumber, FormattingOptions2.IndentStyle indentStyle, CancellationToken cancellationToken) + { + var options = IndentationOptions.FromDocumentAsync(document, cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); + var tree = document.GetRequiredSyntaxTreeSynchronously(cancellationToken); + + var sourceText = tree.GetText(cancellationToken); + var lineToBeIndented = sourceText.Lines[lineNumber]; + + var workspace = document.Project.Solution.Workspace; + var formattingRuleFactory = workspace.Services.GetRequiredService(); + var baseIndentationRule = formattingRuleFactory.CreateRule(document, lineToBeIndented.Start); + + var formattingRules = ImmutableArray.Create( + baseIndentationRule, + this.GetSpecializedIndentationFormattingRule(indentStyle)).AddRange( + Formatter.GetDefaultFormattingRules(document)); + + var smartTokenFormatter = CreateSmartTokenFormatter( + (TSyntaxRoot)tree.GetRoot(cancellationToken), lineToBeIndented, options, baseIndentationRule); + return new Indenter(this, tree, formattingRules, options, lineToBeIndented, smartTokenFormatter, cancellationToken); + } +#endif + } +} diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/IndentationResult.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/IndentationResult.cs new file mode 100644 index 0000000000000..3f7597824088e --- /dev/null +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/IndentationResult.cs @@ -0,0 +1,38 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +namespace Microsoft.CodeAnalysis.Indentation +{ + /// + /// An indentation result represents where the indent should be placed. It conveys this through + /// a pair of values. A position in the existing document where the indent should be relative, + /// and the number of columns after that the indent should be placed at. + /// + /// This pairing provides flexibility to the implementor to compute the indentation results in + /// a variety of ways. For example, one implementation may wish to express indentation of a + /// newline as being four columns past the start of the first token on a previous line. Another + /// may wish to simply express the indentation as an absolute amount from the start of the + /// current line. With this tuple, both forms can be expressed, and the implementor does not + /// have to convert from one to the other. + /// + internal readonly struct IndentationResult + { + /// + /// The base position in the document that the indent should be relative to. This position + /// can occur on any line (including the current line, or a previous line). + /// + public int BasePosition { get; } + + /// + /// The number of columns the indent should be at relative to the BasePosition's column. + /// + public int Offset { get; } + + public IndentationResult(int basePosition, int offset) : this() + { + this.BasePosition = basePosition; + this.Offset = offset; + } + } +} From 56650f0aad6ea8f41a44a40a6191a840b023686a Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 22:18:39 -0700 Subject: [PATCH 058/131] lint --- .../Indentation/SmartTokenFormatter_FormatTokenTests.vb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb b/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb index e4810f9d79fe7..963b42b588913 100644 --- a/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Formatting/Indentation/SmartTokenFormatter_FormatTokenTests.vb @@ -153,7 +153,7 @@ $$) End Class .Value.Replace(vbLf, vbCrLf) - Await ExpectException_TestAsync(code, 4, FormattingOptions.IndentStyle.Block) + Await ExpectException_TestAsync(code, 4, FormattingOptions2.IndentStyle.Block) End Function @@ -166,14 +166,14 @@ $$) End Class .Value.Replace(vbLf, vbCrLf) - Await ExpectException_TestAsync(code, indentation:=0, indentStyle:=FormattingOptions.IndentStyle.None) + Await ExpectException_TestAsync(code, indentation:=0, indentStyle:=FormattingOptions2.IndentStyle.None) End Function - Private Shared Async Function ExpectException_TestAsync(codeWithMarkup As String, indentation As Integer, Optional indentStyle As FormattingOptions.IndentStyle = FormattingOptions.IndentStyle.Smart) As Task + Private Shared Async Function ExpectException_TestAsync(codeWithMarkup As String, indentation As Integer, Optional indentStyle As FormattingOptions2.IndentStyle = FormattingOptions2.IndentStyle.Smart) As Task Assert.NotNull(Await Record.ExceptionAsync(Function() TestAsync(codeWithMarkup, indentation, indentStyle:=indentStyle))) End Function - Private Shared Async Function TestAsync(codeWithMarkup As String, indentation As Integer, Optional indentStyle As FormattingOptions.IndentStyle = FormattingOptions.IndentStyle.Smart) As Threading.Tasks.Task + Private Shared Async Function TestAsync(codeWithMarkup As String, indentation As Integer, Optional indentStyle As FormattingOptions2.IndentStyle = FormattingOptions2.IndentStyle.Smart) As Threading.Tasks.Task Dim code As String = Nothing Dim position As Integer = 0 MarkupTestFile.GetPosition(codeWithMarkup, code, position) From f44f7eb540f01468908b3201f96dc937e9c53036 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 23:01:44 -0700 Subject: [PATCH 059/131] in progress --- .../CSharpWorkspaceExtensions.projitems | 2 ++ .../CSharpIndentationService.Indenter.cs | 0 .../Indentation/CSharpIndentationService.cs | 21 +++++++++++++------ .../Indentation/AbstractIndentationService.cs | 19 ++++++++++++++++- .../Core}/Indentation/IIndentationService.cs | 21 ++++++++++++++++++- .../Core/WorkspaceExtensions.projitems | 2 ++ .../Indentation/SpecialFormattingOperation.vb | 0 .../VisualBasicIndentationService.Indenter.vb | 0 .../VisualBasicIndentationService.vb | 0 .../VisualBasicWorkspaceExtensions.projitems | 3 +++ 10 files changed, 60 insertions(+), 8 deletions(-) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/Indentation/CSharpIndentationService.Indenter.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/Indentation/CSharpIndentationService.cs (93%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/Indentation/AbstractIndentationService.cs (81%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/Indentation/IIndentationService.cs (88%) rename src/Workspaces/{VisualBasic/Portable => SharedUtilitiesAndExtensions/Workspace/VisualBasic}/Indentation/SpecialFormattingOperation.vb (100%) rename src/Workspaces/{VisualBasic/Portable => SharedUtilitiesAndExtensions/Workspace/VisualBasic}/Indentation/VisualBasicIndentationService.Indenter.vb (100%) rename src/Workspaces/{VisualBasic/Portable => SharedUtilitiesAndExtensions/Workspace/VisualBasic}/Indentation/VisualBasicIndentationService.vb (100%) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems index 731120e62cb66..f4ccbf505feb8 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems @@ -37,6 +37,8 @@ + + diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.Indenter.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.Indenter.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.Indenter.cs diff --git a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.cs similarity index 93% rename from src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.cs index c53c96ccf9629..d28fbe95860bb 100644 --- a/src/Workspaces/CSharp/Portable/Indentation/CSharpIndentationService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.cs @@ -3,10 +3,11 @@ // See the LICENSE file in the project root for more information. using System.Collections.Generic; +using System.Collections.Immutable; using System.Composition; -using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp.Extensions; +using Microsoft.CodeAnalysis.CSharp.Formatting; using Microsoft.CodeAnalysis.CSharp.LanguageServices; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.Formatting; @@ -14,7 +15,6 @@ using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Indentation; using Microsoft.CodeAnalysis.LanguageServices; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; @@ -38,6 +38,19 @@ protected override ISyntaxFacts SyntaxFacts protected override IHeaderFacts HeaderFacts => CSharpHeaderFacts.Instance; + protected override ImmutableArray GetDefaultFormattingRules() + => CSharpSyntaxFormatting.Instance.GetDefaultFormattingRules(); + +#if CODE_STYLE + protected override IndentationOptions GetDefaultIndentationOptions(FormattingOptions2.IndentStyle indentStyle) + { + return new IndentationOptions( + CSharpSyntaxFormattingOptions.Default, + new AutoFormattingOptions( + indentStyle, FormatOnReturn: true, FormatOnTyping: true, FormatOnSemicolon: true, FormatOnCloseBrace: true)); + } +#endif + protected override AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions2.IndentStyle indentStyle) => CSharpIndentationFormattingRule.Instance; @@ -115,10 +128,6 @@ private class CSharpIndentationFormattingRule : AbstractFormattingRule public override void AddIndentBlockOperations(List list, SyntaxNode node, in NextIndentBlockOperationAction nextOperation) { - // these nodes should be from syntax tree from ITextSnapshot. - Debug.Assert(node.SyntaxTree != null); - Debug.Assert(node.SyntaxTree.GetText() != null); - nextOperation.Invoke(); ReplaceCaseIndentationRules(list, node); diff --git a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/AbstractIndentationService.cs similarity index 81% rename from src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/AbstractIndentationService.cs index 740bb815b1caf..ee00d4e5ef67a 100644 --- a/src/Workspaces/Core/Portable/Indentation/AbstractIndentationService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/AbstractIndentationService.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; using Microsoft.CodeAnalysis.Formatting; @@ -15,6 +16,12 @@ internal abstract partial class AbstractIndentationService : AbstractIndentation, IIndentationService where TSyntaxRoot : SyntaxNode, ICompilationUnitSyntax { + protected abstract ImmutableArray GetDefaultFormattingRules(); + +#if CODE_STYLE + protected abstract IndentationOptions GetDefaultIndentationOptions(FormattingOptions2.IndentStyle indentStyle); +#endif + public IndentationResult GetIndentation( Document document, int lineNumber, FormattingOptions.IndentStyle indentStyle, CancellationToken cancellationToken) @@ -39,20 +46,30 @@ public IndentationResult GetIndentation( private Indenter GetIndenter(Document document, int lineNumber, FormattingOptions2.IndentStyle indentStyle, CancellationToken cancellationToken) { +#if CODE_STYLE + var options = this.GetDefaultIndentationOptions(indentStyle); + var tree = document.GetSyntaxTreeAsync(cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); +#else var options = IndentationOptions.FromDocumentAsync(document, cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); var tree = document.GetRequiredSyntaxTreeSynchronously(cancellationToken); +#endif + Contract.ThrowIfNull(tree); var sourceText = tree.GetText(cancellationToken); var lineToBeIndented = sourceText.Lines[lineNumber]; +#if CODE_STYLE + var baseIndentationRule = NoOpFormattingRule.Instance; +#else var workspace = document.Project.Solution.Workspace; var formattingRuleFactory = workspace.Services.GetRequiredService(); var baseIndentationRule = formattingRuleFactory.CreateRule(document, lineToBeIndented.Start); +#endif var formattingRules = ImmutableArray.Create( baseIndentationRule, this.GetSpecializedIndentationFormattingRule(indentStyle)).AddRange( - Formatter.GetDefaultFormattingRules(document)); + this.GetDefaultFormattingRules()); var smartTokenFormatter = CreateSmartTokenFormatter( (TSyntaxRoot)tree.GetRoot(cancellationToken), lineToBeIndented, options, baseIndentationRule); diff --git a/src/Workspaces/Core/Portable/Indentation/IIndentationService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/IIndentationService.cs similarity index 88% rename from src/Workspaces/Core/Portable/Indentation/IIndentationService.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/IIndentationService.cs index ff3801d6313b1..347305ee7ecf2 100644 --- a/src/Workspaces/Core/Portable/Indentation/IIndentationService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/IIndentationService.cs @@ -11,9 +11,14 @@ using Microsoft.CodeAnalysis.Text; using Roslyn.Utilities; +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using Microsoft.CodeAnalysis.Options; +#endif + namespace Microsoft.CodeAnalysis.Indentation { - internal interface IIndentationService : ILanguageService { /// @@ -42,7 +47,11 @@ public static IndentationResult GetIndentation( /// public static string GetPreferredIndentation(this SyntaxToken token, Document document, CancellationToken cancellationToken) { +#if CODE_STYLE + var sourceText = document.GetTextAsync(cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); +#else var sourceText = document.GetTextSynchronously(cancellationToken); +#endif var tokenLine = sourceText.Lines.GetLineFromPosition(token.SpanStart); var firstNonWhitespacePos = tokenLine.GetFirstNonWhitespacePosition(); Contract.ThrowIfNull(firstNonWhitespacePos); @@ -65,10 +74,20 @@ public static string GetPreferredIndentation(this SyntaxToken token, Document do var syntaxGenerator = document.GetRequiredLanguageService(); newToken = newToken.WithLeadingTrivia(newToken.LeadingTrivia.Add(syntaxGenerator.EndOfLine(newLine))); +#if CODE_STYLE + var root = document.GetSyntaxRootAsync(cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); +#else var root = document.GetRequiredSyntaxRootSynchronously(cancellationToken); +#endif + Contract.ThrowIfNull(root); var newRoot = root.ReplaceToken(token, newToken); var newDocument = document.WithSyntaxRoot(newRoot); + +#if CODE_STYLE + var newText = newDocument.GetTextAsync(cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); +#else var newText = newDocument.GetTextSynchronously(cancellationToken); +#endif var newTokenLine = newText.Lines.GetLineFromPosition(newRoot.GetAnnotatedTokens(annotation).Single().SpanStart); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems index dbc41c00a72b1..6d798ec06c87a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems @@ -20,6 +20,8 @@ + + diff --git a/src/Workspaces/VisualBasic/Portable/Indentation/SpecialFormattingOperation.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Indentation/SpecialFormattingOperation.vb similarity index 100% rename from src/Workspaces/VisualBasic/Portable/Indentation/SpecialFormattingOperation.vb rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Indentation/SpecialFormattingOperation.vb diff --git a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Indentation/VisualBasicIndentationService.Indenter.vb similarity index 100% rename from src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.Indenter.vb rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Indentation/VisualBasicIndentationService.Indenter.vb diff --git a/src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Indentation/VisualBasicIndentationService.vb similarity index 100% rename from src/Workspaces/VisualBasic/Portable/Indentation/VisualBasicIndentationService.vb rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Indentation/VisualBasicIndentationService.vb diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/VisualBasicWorkspaceExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/VisualBasicWorkspaceExtensions.projitems index 0258117d7bbd6..c7627b848f56c 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/VisualBasicWorkspaceExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/VisualBasicWorkspaceExtensions.projitems @@ -38,6 +38,9 @@ + + + From 93f43bf7f3b46a3f46a9136b2e687a8b3046e7dc Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 23:14:36 -0700 Subject: [PATCH 060/131] Move indentation service down --- .../Core/Indentation/AbstractIndentation.cs | 1 + .../CSharpIndentationService.Indenter.cs | 2 +- .../Indentation/CSharpIndentationService.cs | 14 ++--------- .../Indentation/AbstractIndentationService.cs | 24 +++++++++---------- .../VisualBasicIndentationService.Indenter.vb | 6 +++++ 5 files changed, 22 insertions(+), 25 deletions(-) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.cs index 9651517c8cfbd..9a4273a31f97a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Indentation/AbstractIndentation.cs @@ -14,6 +14,7 @@ internal abstract partial class AbstractIndentation { protected abstract ISyntaxFacts SyntaxFacts { get; } protected abstract IHeaderFacts HeaderFacts { get; } + protected abstract ISyntaxFormatting SyntaxFormatting { get; } protected abstract AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions2.IndentStyle indentStyle); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.Indenter.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.Indenter.cs index 06bbbfce7e109..3c43d15ef8380 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.Indenter.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.Indenter.cs @@ -158,7 +158,7 @@ private static IndentationResult GetIndentationBasedOnToken(Indenter indenter, S if (token.IsSemicolonOfEmbeddedStatement() || token.IsCloseBraceOfEmbeddedBlock()) { - Debug.Assert( + RoslynDebug.Assert( token.Parent != null && (token.Parent.Parent is StatementSyntax || token.Parent.Parent is ElseClauseSyntax)); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.cs index d28fbe95860bb..8dc8afc782ec1 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/Indentation/CSharpIndentationService.cs @@ -38,18 +38,8 @@ protected override ISyntaxFacts SyntaxFacts protected override IHeaderFacts HeaderFacts => CSharpHeaderFacts.Instance; - protected override ImmutableArray GetDefaultFormattingRules() - => CSharpSyntaxFormatting.Instance.GetDefaultFormattingRules(); - -#if CODE_STYLE - protected override IndentationOptions GetDefaultIndentationOptions(FormattingOptions2.IndentStyle indentStyle) - { - return new IndentationOptions( - CSharpSyntaxFormattingOptions.Default, - new AutoFormattingOptions( - indentStyle, FormatOnReturn: true, FormatOnTyping: true, FormatOnSemicolon: true, FormatOnCloseBrace: true)); - } -#endif + protected override ISyntaxFormatting SyntaxFormatting + => CSharpSyntaxFormatting.Instance; protected override AbstractFormattingRule GetSpecializedIndentationFormattingRule(FormattingOptions2.IndentStyle indentStyle) => CSharpIndentationFormattingRule.Instance; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/AbstractIndentationService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/AbstractIndentationService.cs index ee00d4e5ef67a..56dae78d57bb1 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/AbstractIndentationService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/AbstractIndentationService.cs @@ -16,12 +16,6 @@ internal abstract partial class AbstractIndentationService : AbstractIndentation, IIndentationService where TSyntaxRoot : SyntaxNode, ICompilationUnitSyntax { - protected abstract ImmutableArray GetDefaultFormattingRules(); - -#if CODE_STYLE - protected abstract IndentationOptions GetDefaultIndentationOptions(FormattingOptions2.IndentStyle indentStyle); -#endif - public IndentationResult GetIndentation( Document document, int lineNumber, FormattingOptions.IndentStyle indentStyle, CancellationToken cancellationToken) @@ -46,15 +40,21 @@ public IndentationResult GetIndentation( private Indenter GetIndenter(Document document, int lineNumber, FormattingOptions2.IndentStyle indentStyle, CancellationToken cancellationToken) { + var syntaxFormatting = this.SyntaxFormatting; + #if CODE_STYLE - var options = this.GetDefaultIndentationOptions(indentStyle); var tree = document.GetSyntaxTreeAsync(cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); + Contract.ThrowIfNull(tree); + + var options = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(tree); + var indentationOptions = new IndentationOptions( + syntaxFormatting.GetFormattingOptions(options), + new AutoFormattingOptions(indentStyle, FormatOnReturn: true, FormatOnTyping: true, FormatOnSemicolon: true, FormatOnCloseBrace: true)); #else - var options = IndentationOptions.FromDocumentAsync(document, cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); + var indentationOptions = IndentationOptions.FromDocumentAsync(document, cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); var tree = document.GetRequiredSyntaxTreeSynchronously(cancellationToken); #endif - Contract.ThrowIfNull(tree); var sourceText = tree.GetText(cancellationToken); var lineToBeIndented = sourceText.Lines[lineNumber]; @@ -69,11 +69,11 @@ private Indenter GetIndenter(Document document, int lineNumber, FormattingOption var formattingRules = ImmutableArray.Create( baseIndentationRule, this.GetSpecializedIndentationFormattingRule(indentStyle)).AddRange( - this.GetDefaultFormattingRules()); + syntaxFormatting.GetDefaultFormattingRules()); var smartTokenFormatter = CreateSmartTokenFormatter( - (TSyntaxRoot)tree.GetRoot(cancellationToken), lineToBeIndented, options, baseIndentationRule); - return new Indenter(this, tree, formattingRules, options, lineToBeIndented, smartTokenFormatter, cancellationToken); + (TSyntaxRoot)tree.GetRoot(cancellationToken), lineToBeIndented, indentationOptions, baseIndentationRule); + return new Indenter(this, tree, formattingRules, indentationOptions, lineToBeIndented, smartTokenFormatter, cancellationToken); } } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Indentation/VisualBasicIndentationService.Indenter.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Indentation/VisualBasicIndentationService.Indenter.vb index 4257ba8c93957..2ffbafe520f7d 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Indentation/VisualBasicIndentationService.Indenter.vb +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/Indentation/VisualBasicIndentationService.Indenter.vb @@ -26,6 +26,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.Indentation End Get End Property + Protected Overrides ReadOnly Property SyntaxFormatting As ISyntaxFormatting + Get + Return VisualBasicSyntaxFormatting.Instance + End Get + End Property + Protected Overrides Function ShouldUseTokenIndenter(indenter As Indenter, ByRef token As SyntaxToken) As Boolean Return ShouldUseSmartTokenFormatterInsteadOfIndenter( indenter.Rules, indenter.Root, indenter.LineToBeIndented, indenter.Options.FormattingOptions, token) From d81346539ed21b1adc8e2b030e258413914b6fe5 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 23:18:48 -0700 Subject: [PATCH 061/131] Move ConvertNamespace down to the CodeFixes layer --- src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems | 2 ++ .../ConvertNamespace/ConvertNamespaceCodeFixProvider.cs | 0 .../CodeFixes}/ConvertNamespace/ConvertNamespaceTransform.cs | 0 3 files changed, 2 insertions(+) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs (100%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/ConvertNamespace/ConvertNamespaceTransform.cs (100%) diff --git a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems index 80e167d2963a9..5fd878b776f4c 100644 --- a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems +++ b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems @@ -16,6 +16,8 @@ + + diff --git a/src/Features/CSharp/Portable/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs similarity index 100% rename from src/Features/CSharp/Portable/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs diff --git a/src/Features/CSharp/Portable/ConvertNamespace/ConvertNamespaceTransform.cs b/src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceTransform.cs similarity index 100% rename from src/Features/CSharp/Portable/ConvertNamespace/ConvertNamespaceTransform.cs rename to src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceTransform.cs From e015addaf384bab3053c5b4f37f479bee77ae9ee Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Mon, 28 Mar 2022 23:57:17 -0700 Subject: [PATCH 062/131] lint --- src/Workspaces/CoreTest/FormattingTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Workspaces/CoreTest/FormattingTests.cs b/src/Workspaces/CoreTest/FormattingTests.cs index af95f7954ce33..12239b4f0a759 100644 --- a/src/Workspaces/CoreTest/FormattingTests.cs +++ b/src/Workspaces/CoreTest/FormattingTests.cs @@ -37,7 +37,6 @@ public void TestCSharpDefaultRules() var service = workspace.Services.GetLanguageServices(LanguageNames.CSharp).GetService(); var rules = service.GetDefaultFormattingRules(); - Assert.NotNull(rules); Assert.NotEmpty(rules); } @@ -65,7 +64,6 @@ public void TestVisualBasicDefaultFormattingRules() var service = workspace.Services.GetLanguageServices(LanguageNames.VisualBasic).GetService(); var rules = service.GetDefaultFormattingRules(); - Assert.NotNull(rules); Assert.NotEmpty(rules); } From ab87559687dd17da6840906386fae05c4b90cafb Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Tue, 29 Mar 2022 10:10:59 -0700 Subject: [PATCH 063/131] In progress --- .../Core/Formatting/AutoFormattingOptions.cs | 7 +---- .../Core/Formatting/FormattingOptions2.cs | 8 +++++- .../Core/Indentation/IIndentationService.cs | 26 ++++++++++++++----- 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AutoFormattingOptions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AutoFormattingOptions.cs index 03680232391b4..779685eccf774 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AutoFormattingOptions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/AutoFormattingOptions.cs @@ -30,7 +30,7 @@ public static AutoFormattingOptions From(Project project) public static AutoFormattingOptions From(OptionSet options, string language) => new( - IndentStyle: (FormattingOptions2.IndentStyle)options.GetOption(Metadata.SmartIndent, language), + IndentStyle: options.GetOption(Metadata.SmartIndent, language), FormatOnReturn: options.GetOption(Metadata.AutoFormattingOnReturn, language), FormatOnTyping: options.GetOption(Metadata.AutoFormattingOnTyping, language), FormatOnSemicolon: options.GetOption(Metadata.AutoFormattingOnSemicolon, language), @@ -46,7 +46,6 @@ public Metadata() } public ImmutableArray Options { get; } = ImmutableArray.Create( - SmartIndent, AutoFormattingOnReturn, AutoFormattingOnTyping, AutoFormattingOnSemicolon, @@ -54,10 +53,6 @@ public Metadata() private const string FeatureName = "FormattingOptions"; - // This is also serialized by the Visual Studio-specific LanguageSettingsPersister - public static PerLanguageOption2 SmartIndent { get; } = - new(FeatureName, FormattingOptionGroups.IndentationAndSpacing, nameof(SmartIndent), defaultValue: FormattingOptions.IndentStyle.Smart); - internal static readonly PerLanguageOption2 AutoFormattingOnReturn = new(FeatureName, OptionGroup.Default, nameof(AutoFormattingOnReturn), defaultValue: true, storageLocation: new RoamingProfileStorageLocation("TextEditor.%LANGUAGE%.Specific.Auto Formatting On Return")); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.cs index a2e854a0268f7..636581cb80c73 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Formatting/FormattingOptions2.cs @@ -76,13 +76,19 @@ public Provider() new(FeatureName, FormattingOptionGroups.NewLine, nameof(InsertFinalNewLine), defaultValue: false, storageLocation: EditorConfigStorageLocation.ForBoolOption("insert_final_newline")); + /// + // Suppression due to https://github.com/dotnet/roslyn/issues/42614 + public static PerLanguageOption2 SmartIndent { get; } = + new(FeatureName, FormattingOptionGroups.IndentationAndSpacing, nameof(SmartIndent), defaultValue: IndentStyle.Smart); + #if !CODE_STYLE internal static readonly ImmutableArray Options = ImmutableArray.Create( UseTabs, TabSize, IndentationSize, NewLine, - InsertFinalNewLine); + InsertFinalNewLine, + SmartIndent); #endif } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/IIndentationService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/IIndentationService.cs index 347305ee7ecf2..7fc9ac86ef19a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/IIndentationService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Indentation/IIndentationService.cs @@ -35,10 +35,16 @@ public static IndentationResult GetIndentation( this IIndentationService service, Document document, int lineNumber, CancellationToken cancellationToken) { +#if CODE_STYLE + var tree = document.GetSyntaxTreeAsync(cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); + var options = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(tree!); +#else var options = document.GetOptionsAsync(cancellationToken).WaitAndGetResult_CanCallOnBackground(cancellationToken); - var style = options.GetOption(FormattingOptions.SmartIndent, document.Project.Language); +#endif + + var style = options.GetOption(FormattingOptions2.SmartIndent, document.Project.Language); - return service.GetIndentation(document, lineNumber, style, cancellationToken); + return service.GetIndentation(document, lineNumber, (FormattingOptions.IndentStyle)style, cancellationToken); } /// @@ -64,9 +70,14 @@ public static string GetPreferredIndentation(this SyntaxToken token, Document do // Token was on a line with something else. Determine where we would indent the token if it was on the next // line and use that to determine the indentation of the final line. +#if CODE_STYLE + var options = document.Project.AnalyzerOptions.AnalyzerConfigOptionsProvider.GetOptions(token.SyntaxTree!); +#else var options = document.Project.Solution.Options; +#endif + var languageName = document.Project.Language; - var newLine = options.GetOption(FormattingOptions.NewLine, languageName); + var newLine = options.GetOption(FormattingOptions2.NewLine, languageName); var annotation = new SyntaxAnnotation(); var newToken = token.WithAdditionalAnnotations(annotation); @@ -91,15 +102,16 @@ public static string GetPreferredIndentation(this SyntaxToken token, Document do var newTokenLine = newText.Lines.GetLineFromPosition(newRoot.GetAnnotatedTokens(annotation).Single().SpanStart); - var indentStyle = document.Project.Solution.Options.GetOption(FormattingOptions.SmartIndent, languageName); + var indentStyle = options.GetOption(FormattingOptions2.SmartIndent, languageName); var indenter = document.GetRequiredLanguageService(); - var indentation = indenter.GetIndentation(newDocument, newTokenLine.LineNumber, indentStyle, cancellationToken); + var indentation = indenter.GetIndentation( + newDocument, newTokenLine.LineNumber, (FormattingOptions.IndentStyle)indentStyle, cancellationToken); return indentation.GetIndentationString( newText, - options.GetOption(FormattingOptions.UseTabs, languageName), - options.GetOption(FormattingOptions.TabSize, languageName)); + options.GetOption(FormattingOptions2.UseTabs, languageName), + options.GetOption(FormattingOptions2.TabSize, languageName)); } } From 6027bbfeae814be19c4062c6aea3d2c3fa2fe8b8 Mon Sep 17 00:00:00 2001 From: Allison Chou Date: Tue, 29 Mar 2022 10:19:01 -0700 Subject: [PATCH 064/131] Update Versions.props and PublishData.json for 17.2 P3 snap (#60432) --- eng/Versions.props | 4 ++-- eng/config/PublishData.json | 19 +++---------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 4af90cbc78468..943f5688f65af 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -6,9 +6,9 @@ --> 4 - 2 + 3 0 - 3 + 1 $(MajorVersion).$(MinorVersion).$(PatchVersion) + + + + + + + + From f6044c7b80211ada4ba65d8d9f4e46e597293277 Mon Sep 17 00:00:00 2001 From: Jonathon Marolf Date: Tue, 29 Mar 2022 16:27:25 -0700 Subject: [PATCH 082/131] add new codefix mappings --- src/Tools/BuildActionTelemetryTable/Program.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Tools/BuildActionTelemetryTable/Program.cs b/src/Tools/BuildActionTelemetryTable/Program.cs index 3d53d49fdf2ce..10b84e622670b 100644 --- a/src/Tools/BuildActionTelemetryTable/Program.cs +++ b/src/Tools/BuildActionTelemetryTable/Program.cs @@ -209,7 +209,7 @@ public class Program { "Microsoft.CodeAnalysis.ConvertForToForEach.AbstractConvertForToForEachCodeRefactoringProvider`6+MyCodeAction", "Convert For To ForEach" }, { "Microsoft.CodeAnalysis.ConvertForEachToFor.AbstractConvertForEachToForCodeRefactoringProvider`2+ForEachToForCodeAction", "Convert ForEach To For" }, { "Microsoft.CodeAnalysis.ConvertCast.AbstractConvertCastCodeRefactoringProvider`3+MyCodeAction", "Convert Cast" }, - { "Microsoft.CodeAnalysis.ConvertAutoPropertyToFullProperty.AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider`2+ConvertAutoPropertyToFullPropertyCodeAction", "Convert AutoProperty To Full Property" }, + { "Microsoft.CodeAnalysis.ConvertAutoPropertyToFullProperty.AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider`3+ConvertAutoPropertyToFullPropertyCodeAction", "Convert AutoProperty To Full Property" }, { "Microsoft.CodeAnalysis.ConflictMarkerResolution.AbstractResolveConflictMarkerCodeFixProvider+MyCodeAction", "Resolve Conflict Marker" }, { "Microsoft.CodeAnalysis.CSharp.ConvertAnonymousTypeToClass.AbstractConvertAnonymousTypeToClassCodeRefactoringProvider`6+MyCodeAction", "Convert Anonymous Type To Class" }, { "Microsoft.CodeAnalysis.AddMissingImports.AbstractAddMissingImportsRefactoringProvider+AddMissingImportsCodeAction", "Add Missing Imports (Paste)" }, @@ -282,6 +282,11 @@ public class Program { "Microsoft.CodeAnalysis.VisualBasic.SimplifyObjectCreation.VisualBasicSimplifyObjectCreationCodeFixProvider+MyCodeAction", "Simplify Object Creation" }, { "Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingTaggerProvider+RenameTrackingCodeAction", "Rename Tracking" }, { "Microsoft.CodeAnalysis.CSharp.CodeFixes.AddInheritdoc.AddInheritdocCodeFixProvider+MyCodeAction", "Add Inheritdoc" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.TransposeRecordKeyword.CSharpTransposeRecordKeywordCodeFixProvider+MyCodeAction", "Fix record declaration" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertToRawString.ConvertRegularStringToRawStringCodeRefactoringProvider+MyCodeAction", "Convert to raw string" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryLambdaExpression.CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider+MyCodeAction", "Remove Unnecessary Lambda Expression" }, + { "Microsoft.CodeAnalysis.CSharp.UseParameterNullChecking.CSharpUseParameterNullCheckingCodeFixProvider+MyCodeAction", "Use Parameter Null Checking" }, + { "Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json.LanguageServices.AbstractJsonDetectionCodeFixProvider+MyCodeAction", "Enable all JSON editor features" }, }.ToImmutableDictionary(); public static void Main(string[] args) From 6146f0e9a5435cf0bfb41d3419d665b7f1a68a84 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 30 Mar 2022 10:58:55 +1100 Subject: [PATCH 083/131] Honour .editorconfig files when formatting new projects (#60450) --- .../Implementation/AbstractEditorFactory.cs | 40 +++++++++ .../CSharp/CSharpNewDocumentFormatting.cs | 81 +++++++++++++++++++ .../SolutionExplorer_OutOfProc.cs | 3 + 3 files changed, 124 insertions(+) diff --git a/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs b/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs index bd1c626108500..79b29f4671d77 100644 --- a/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs +++ b/src/VisualStudio/Core/Def/Implementation/AbstractEditorFactory.cs @@ -309,6 +309,10 @@ private async Task FormatDocumentCreatedFromTemplateAsync(IVsHierarchy hierarchy name: nameof(FormatDocumentCreatedFromTemplate), assemblyName: nameof(FormatDocumentCreatedFromTemplate), language: LanguageName); + + // We have to discover .editorconfig files ourselves to ensure that code style rules are followed. + // Normally the project system would tell us about these. + projectToAddTo = AddEditorConfigFiles(projectToAddTo, Path.GetDirectoryName(filePath)); } // We need to ensure that decisions made during new document formatting are based on the right language @@ -361,5 +365,41 @@ private async Task FormatDocumentCreatedFromTemplateAsync(IVsHierarchy hierarchy formattedText.Write(textWriter, cancellationToken: CancellationToken.None); }); } + + private static Project AddEditorConfigFiles(Project projectToAddTo, string projectFolder) + { + do + { + projectToAddTo = AddEditorConfigFile(projectToAddTo, projectFolder, out var foundRoot); + + if (foundRoot) + break; + + projectFolder = Path.GetDirectoryName(projectFolder); + } + while (projectFolder is not null); + + return projectToAddTo; + + static Project AddEditorConfigFile(Project project, string folder, out bool foundRoot) + { + const string EditorConfigFileName = ".editorconfig"; + + foundRoot = false; + + var editorConfigFile = Path.Combine(folder, EditorConfigFileName); + + var text = IOUtilities.PerformIO(() => + { + using var stream = File.OpenRead(editorConfigFile); + return SourceText.From(stream); + }); + + if (text is null) + return project; + + return project.AddAnalyzerConfigDocument(EditorConfigFileName, text, filePath: editorConfigFile).Project; + } + } } } diff --git a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpNewDocumentFormatting.cs b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpNewDocumentFormatting.cs index 91ebe5c608dad..a79917c082a92 100644 --- a/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpNewDocumentFormatting.cs +++ b/src/VisualStudio/IntegrationTest/IntegrationTests/CSharp/CSharpNewDocumentFormatting.cs @@ -4,6 +4,7 @@ #nullable disable +using System.IO; using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.VisualStudio.IntegrationTest.Utilities; @@ -54,5 +55,85 @@ public void CreateSDKProjectWithFileScopedNamespaces() VisualStudio.ErrorList.ShowErrorList(); VisualStudio.ErrorList.Verify.NoErrors(); } + + [WpfFact] + [WorkItem(60449, "https://github.com/dotnet/roslyn/issues/60449")] + public void CreateSDKProjectWithBlockScopedNamespacesFromEditorConfig() + { + var project = new ProjectUtils.Project("TestProj"); + + VisualStudio.Workspace.SetFileScopedNamespaces(true); + + var editorConfigFilePath = Path.Combine(VisualStudio.SolutionExplorer.DirectoryName, ".editorconfig"); + File.WriteAllText(editorConfigFilePath, +@" +root = true + +[*.cs] +csharp_style_namespace_declarations = block_scoped +"); + + VisualStudio.SolutionExplorer.AddProject(project, WellKnownProjectTemplates.CSharpNetCoreClassLibrary, LanguageNames.CSharp); + + VisualStudio.ErrorList.ShowErrorList(); + VisualStudio.ErrorList.Verify.NoErrors(); + + VisualStudio.Editor.Verify.TextContains("namespace TestProj\r\n{"); + } + + [WpfFact] + [WorkItem(60449, "https://github.com/dotnet/roslyn/issues/60449")] + public void CreateSDKProjectWithBlockScopedNamespacesFromIrrelevantEditorConfigH() + { + var project = new ProjectUtils.Project("TestProj"); + + VisualStudio.Workspace.SetFileScopedNamespaces(true); + + var editorConfigFilePath = Path.Combine(VisualStudio.SolutionExplorer.DirectoryName, ".editorconfig"); + File.WriteAllText(editorConfigFilePath, +@" +root = true +"); + + // This editor config file should be ignored + editorConfigFilePath = Path.Combine(VisualStudio.SolutionExplorer.DirectoryName, "..", ".editorconfig"); + File.WriteAllText(editorConfigFilePath, +@" +[*.cs] +csharp_style_namespace_declarations = block_scoped +"); + + VisualStudio.SolutionExplorer.AddProject(project, WellKnownProjectTemplates.CSharpNetCoreClassLibrary, LanguageNames.CSharp); + + VisualStudio.ErrorList.ShowErrorList(); + VisualStudio.ErrorList.Verify.NoErrors(); + + VisualStudio.Editor.Verify.TextContains("namespace TestProj;"); + } + + [WpfFact] + [WorkItem(60449, "https://github.com/dotnet/roslyn/issues/60449")] + public void CreateSDKProjectWithFileScopedNamespacesFromEditorConfig() + { + var project = new ProjectUtils.Project("TestProj"); + + VisualStudio.Workspace.SetFileScopedNamespaces(false); + + var editorConfigFilePath = Path.Combine(VisualStudio.SolutionExplorer.DirectoryName, ".editorconfig"); + File.WriteAllText(editorConfigFilePath, +@" +root = true + +[*.cs] +csharp_style_namespace_declarations = file_scoped +"); + + VisualStudio.SolutionExplorer.AddProject(project, WellKnownProjectTemplates.CSharpNetCoreClassLibrary, LanguageNames.CSharp); + + VisualStudio.ErrorList.ShowErrorList(); + VisualStudio.ErrorList.Verify.NoErrors(); + + VisualStudio.Editor.Verify.TextContains("namespace TestProj;"); + } } } diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs b/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs index a2efc52edb35d..848134059696f 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/OutOfProcess/SolutionExplorer_OutOfProc.cs @@ -21,6 +21,9 @@ public SolutionExplorer_OutOfProc(VisualStudioInstance visualStudioInstance) _inProc = CreateInProcComponent(visualStudioInstance); } + public string DirectoryName + => _inProc.DirectoryName; + public void CloseSolution(bool saveFirst = false) => _inProc.CloseSolution(saveFirst); From 31c68942cdbf5c4e8776002220376812192aab68 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 30 Mar 2022 16:28:20 +1100 Subject: [PATCH 084/131] Don't add spaces when list pattern is inside parentheses (#60475) --- .../CSharpTest/Formatting/FormattingTests.cs | 56 +++++++++++++++++++ .../Formatting/Rules/SpacingFormattingRule.cs | 15 ++++- 2 files changed, 68 insertions(+), 3 deletions(-) diff --git a/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs b/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs index 6477395bd6c3f..e1a6380f4b1dd 100644 --- a/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs +++ b/src/Workspaces/CSharpTest/Formatting/FormattingTests.cs @@ -10351,6 +10351,62 @@ void M() }"); } + [Fact] + [Trait(Traits.Feature, Traits.Features.Formatting)] + public async Task FormatListPattern_Parentheses() + { + var code = @" +class C +{ + void M((int[], int[]) a) { +_ = a is([1,2,>=3],[1,2]); +} +}"; + await AssertFormatAsync(code: code, expected: @" +class C +{ + void M((int[], int[]) a) + { + _ = a is ([1, 2, >= 3], [1, 2]); + } +}"); + + var options = new OptionsCollection(LanguageNames.CSharp) + { + { SpaceBetweenEmptySquareBrackets, false }, + { SpaceWithinSquareBrackets, false }, + { SpaceBeforeComma, false }, + { SpaceAfterComma, false }, + }; + + await AssertFormatAsync(code: code, changedOptionSet: options, expected: @" +class C +{ + void M((int[], int[]) a) + { + _ = a is ([1,2,>= 3],[1,2]); + } +}"); + + options = new OptionsCollection(LanguageNames.CSharp) + { + { SpaceBeforeOpenSquareBracket, false }, // ignored + { SpaceBetweenEmptySquareBrackets, true }, + { SpaceWithinSquareBrackets, true }, + { SpaceBeforeComma, true }, + { SpaceAfterComma, true }, + }; + + await AssertFormatAsync(code: code, changedOptionSet: options, expected: @" +class C +{ + void M((int[ ], int[ ]) a) + { + _ = a is ([ 1 , 2 , >= 3 ], [ 1 , 2 ]); + } +}"); + } + [Fact] [Trait(Traits.Feature, Traits.Features.Formatting)] public async Task FormatListPattern_TrailingComma() diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/SpacingFormattingRule.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/SpacingFormattingRule.cs index a338189998706..3649581db15e0 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/SpacingFormattingRule.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/CSharp/Formatting/Rules/SpacingFormattingRule.cs @@ -206,11 +206,20 @@ public override AbstractFormattingRule WithOptions(SyntaxFormattingOptions optio return AdjustSpacesOperationZeroOrOne(_options.Spacing.HasFlag(SpacePlacement.AfterCast)); } + // List patterns if (currentKind == SyntaxKind.OpenBracketToken && currentToken.Parent.IsKind(SyntaxKind.ListPattern)) { - // is [ - // and [ - return CreateAdjustSpacesOperation(1, AdjustSpacesOption.ForceSpacesIfOnSingleLine); + // For the space after the middle comma in ([1, 2], [1, 2]) + if (previousKind == SyntaxKind.CommaToken) + { + return AdjustSpacesOperationZeroOrOne(_options.Spacing.HasFlag(SpacePlacement.AfterComma)); + } + + // For "is [", "and [", but not "([" + if (previousKind != SyntaxKind.OpenParenToken) + { + return CreateAdjustSpacesOperation(1, AdjustSpacesOption.ForceSpacesIfOnSingleLine); + } } // For spacing Before Square Braces From 41e58863dad8b4056759b06e9d9e646d3b39c3c5 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Wed, 30 Mar 2022 04:22:18 -0700 Subject: [PATCH 085/131] Use provider type name for CodeAction telemetry for code actions created through CodeAction.Create factory methods Fixes #4919 Currently, we always use the CodeAction's full type name to generate the telemetry ID to log for applied code actions. This is reasonable for special CodeActions that sub-type the CodeAction type and have custom logic. However, majority of fixers and refactorings do not need special CodeAction sub-type and can/should use the CodeAction.Create factory methods to create the code actions to register. Until now, these providers were forced to create a dummy nested type (generally named MyCodeAction) and use it to allow telemetry to capture the outer type's full type name. With this change, we now keep track of whether a CodeAction was created with a factory method or not. If it was created with a factory method, then we use the registering fixer/refactoring provider's full type name for telemetry. Otherwise, we use the CodeAction's full type name. Additionally, we also append the EquivalenceKey in the telemetry ID in both the cases, which should allow multiple code actions registered by the same fixer/refactoring to be differentiated. NOTE: I will create a follow-up PRs in both Roslyn and Roslyn-Analyzers repos to delete all the stub MyCodeAction types once this goes in. --- .../CodeFixSuggestedAction.cs | 2 +- .../SuggestedActions/FixAllSuggestedAction.cs | 4 +- .../SuggestedActions/SuggestedAction.cs | 4 +- .../Handlers/CodeActions/CodeActionHelpers.cs | 2 +- ...angeImplementionCodeRefactoringProvider.cs | 2 +- ...etersFromMembersCodeRefactoringProvider.cs | 4 +- .../InstallPackageAndAddImportCodeAction.cs | 2 +- .../AbstractAddParameterCodeFixProvider.cs | 6 +- ...stractAliasAmbiguousTypeCodeFixProvider.cs | 2 +- .../AbstractAddExplicitCastCodeFixProvider.cs | 2 +- ...ConfigureCodeStyleOptionCodeFixProvider.cs | 2 +- .../ConfigureSeverityLevelCodeFixProvider.cs | 4 +- .../AbstractSuppressionBatchFixAllProvider.cs | 2 +- .../CodeRefactoringService.cs | 2 +- ...ymousTypeToTupleCodeRefactoringProvider.cs | 2 +- ...ertTupleToStructCodeRefactoringProvider.cs | 4 +- ...parisonOperatorsCodeRefactoringProvider.cs | 2 +- ...AbstractInlineMethodRefactoringProvider.cs | 2 +- .../AbstractIntroduceParameterService.cs | 4 +- .../AbstractIntroduceVariableService.cs | 2 +- ...AbstractPullMemberUpRefactoringProvider.cs | 2 +- .../Portable/PullMemberUp/MembersPuller.cs | 2 +- .../Wrapping/AbstractCodeActionComputer.cs | 2 +- .../Features/CodeFixes/CodeFixService.cs | 2 +- .../UnifiedSuggestedActionsSource.cs | 2 +- .../BuildActionTelemetryTable.csproj | 2 +- .../BuildActionTelemetryTable/Program.cs | 369 +++++++++--------- .../Panels/TelemetryPanel.xaml.cs | 2 +- .../Core/Portable/CodeActions/CodeAction.cs | 134 ++++++- .../Shared/Extensions/TelemetryExtensions.cs | 11 +- .../TelemetryExtensionTests.cs | 4 +- 31 files changed, 347 insertions(+), 241 deletions(-) rename src/{EditorFeatures/Core => Workspaces/Core/Portable}/Shared/Extensions/TelemetryExtensions.cs (84%) rename src/{EditorFeatures/CSharpTest/Extensions => Workspaces/CoreTest/Shared/Extensions/TelemetryExtensions}/TelemetryExtensionTests.cs (87%) diff --git a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/CodeFixSuggestedAction.cs b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/CodeFixSuggestedAction.cs index 7683ebb3fa7db..1a56faba462d8 100644 --- a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/CodeFixSuggestedAction.cs +++ b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/CodeFixSuggestedAction.cs @@ -7,8 +7,8 @@ using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.Diagnostics; -using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; +using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions; using Microsoft.VisualStudio.Language.Intellisense; using Microsoft.VisualStudio.Text; diff --git a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/FixAllSuggestedAction.cs b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/FixAllSuggestedAction.cs index 4450286298856..93f22d2cdc34d 100644 --- a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/FixAllSuggestedAction.cs +++ b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/FixAllSuggestedAction.cs @@ -9,9 +9,9 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; -using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Internal.Log; +using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.CodeAnalysis.UnifiedSuggestions.UnifiedSuggestedActions; using Microsoft.VisualStudio.Language.Intellisense; @@ -58,7 +58,7 @@ public override bool TryGetTelemetryId(out Guid telemetryId) // We get the telemetry id for the original code action we are fixing, // not the special 'FixAllCodeAction'. that is the .CodeAction this // SuggestedAction is pointing at. - telemetryId = OriginalCodeAction.GetType().GetTelemetryId(FixAllState.Scope.GetScopeIdForTelemetry()); + telemetryId = OriginalCodeAction.GetTelemetryId(FixAllState.Scope); return true; } diff --git a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/SuggestedAction.cs b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/SuggestedAction.cs index 619e455ae9dfb..7db19597ce728 100644 --- a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/SuggestedAction.cs +++ b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/SuggestedAction.cs @@ -11,11 +11,11 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; -using Microsoft.CodeAnalysis.Editor.Shared.Extensions; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.ErrorReporting; using Microsoft.CodeAnalysis.Extensions; using Microsoft.CodeAnalysis.Internal.Log; +using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Shared.Utilities; using Microsoft.CodeAnalysis.Text; @@ -70,7 +70,7 @@ internal bool IsForCodeQualityImprovement public virtual bool TryGetTelemetryId(out Guid telemetryId) { - telemetryId = CodeAction.GetType().GetTelemetryId(); + telemetryId = CodeAction.GetTelemetryId(); return true; } diff --git a/src/EditorFeatures/Core/LanguageServer/Handlers/CodeActions/CodeActionHelpers.cs b/src/EditorFeatures/Core/LanguageServer/Handlers/CodeActions/CodeActionHelpers.cs index fe0d76181d2a5..3b12bbabee444 100644 --- a/src/EditorFeatures/Core/LanguageServer/Handlers/CodeActions/CodeActionHelpers.cs +++ b/src/EditorFeatures/Core/LanguageServer/Handlers/CodeActions/CodeActionHelpers.cs @@ -236,7 +236,7 @@ private static CodeAction GetNestedActionsFromActionSet(IUnifiedSuggestedAction } } - return new CodeActionWithNestedActions( + return CodeActionWithNestedActions.Create( codeAction.Title, nestedActions.ToImmutable(), codeAction.IsInlinable, codeAction.Priority); } diff --git a/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs index b26fefffa18c3..8ec4133700b49 100644 --- a/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/ImplementInterface/AbstractChangeImplementionCodeRefactoringProvider.cs @@ -114,7 +114,7 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex c => ChangeImplementationAsync(project, implementedMembersFromAllInterfaces, c))); } - context.RegisterRefactoring(new CodeAction.CodeActionWithNestedActions( + context.RegisterRefactoring(CodeAction.CodeActionWithNestedActions.Create( Implement, nestedActions.ToImmutableAndFree(), isInlinable: true)); } diff --git a/src/Features/Core/Portable/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersCodeRefactoringProvider.cs b/src/Features/Core/Portable/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersCodeRefactoringProvider.cs index 2490539d53a7e..c31f1a999bcb1 100644 --- a/src/Features/Core/Portable/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/AddConstructorParametersFromMembers/AddConstructorParametersFromMembersCodeRefactoringProvider.cs @@ -83,13 +83,13 @@ private static ImmutableArray GetGroupedActions(AddConstructorParame { if (!result.RequiredParameterActions.IsDefaultOrEmpty) { - actions.Add(new CodeAction.CodeActionWithNestedActions( + actions.Add(CodeAction.CodeActionWithNestedActions.Create( FeaturesResources.Add_parameter_to_constructor, result.RequiredParameterActions.Cast(), isInlinable: false)); } - actions.Add(new CodeAction.CodeActionWithNestedActions( + actions.Add(CodeAction.CodeActionWithNestedActions.Create( FeaturesResources.Add_optional_parameter_to_constructor, result.OptionalParameterActions.Cast(), isInlinable: false)); diff --git a/src/Features/Core/Portable/AddImport/CodeActions/InstallPackageAndAddImportCodeAction.cs b/src/Features/Core/Portable/AddImport/CodeActions/InstallPackageAndAddImportCodeAction.cs index 91c28ecc3ad37..bccad2bf2e91a 100644 --- a/src/Features/Core/Portable/AddImport/CodeActions/InstallPackageAndAddImportCodeAction.cs +++ b/src/Features/Core/Portable/AddImport/CodeActions/InstallPackageAndAddImportCodeAction.cs @@ -50,7 +50,7 @@ protected override async Task> ComputePreviewOp { // Make a SolutionChangeAction. This way we can let it generate the diff // preview appropriately. - var solutionChangeAction = new SolutionChangeAction("", c => GetUpdatedSolutionAsync(c), ""); + var solutionChangeAction = SolutionChangeAction.Create("", c => GetUpdatedSolutionAsync(c), ""); using var _ = ArrayBuilder.GetInstance(out var result); result.AddRange(await solutionChangeAction.GetPreviewOperationsAsync(cancellationToken).ConfigureAwait(false)); diff --git a/src/Features/Core/Portable/AddParameter/AbstractAddParameterCodeFixProvider.cs b/src/Features/Core/Portable/AddParameter/AbstractAddParameterCodeFixProvider.cs index 98207d33b8bbf..f1cb798cc20ef 100644 --- a/src/Features/Core/Portable/AddParameter/AbstractAddParameterCodeFixProvider.cs +++ b/src/Features/Core/Portable/AddParameter/AbstractAddParameterCodeFixProvider.cs @@ -257,7 +257,7 @@ ImmutableArray NestByOverload() var titleForNesting = GetCodeFixTitle(FeaturesResources.Add_parameter_to_0, data.Method, includeParameters: true); var titleCascading = GetCodeFixTitle(FeaturesResources.Add_parameter_to_0_and_overrides_implementations, data.Method, includeParameters: true); - codeAction = new CodeAction.CodeActionWithNestedActions( + codeAction = CodeAction.CodeActionWithNestedActions.Create( title: titleForNesting, ImmutableArray.Create( codeAction, @@ -297,14 +297,14 @@ ImmutableArray NestByCascading() // Create a sub-menu entry with all the non-cascading CodeActions. // We make sure the IDE does not inline. Otherwise the context menu gets flooded with our fixes. - builder.Add(new CodeAction.CodeActionWithNestedActions(nestedNonCascadingTitle, nonCascadingActions, isInlinable: false)); + builder.Add(CodeAction.CodeActionWithNestedActions.Create(nestedNonCascadingTitle, nonCascadingActions, isInlinable: false)); if (cascadingActions.Length > 0) { // if there are cascading CodeActions create a second sub-menu. var nestedCascadingTitle = GetCodeFixTitle(FeaturesResources.Add_parameter_to_0_and_overrides_implementations, aMethod, includeParameters: false); - builder.Add(new CodeAction.CodeActionWithNestedActions(nestedCascadingTitle, cascadingActions, isInlinable: false)); + builder.Add(CodeAction.CodeActionWithNestedActions.Create(nestedCascadingTitle, cascadingActions, isInlinable: false)); } return builder.ToImmutable(); diff --git a/src/Features/Core/Portable/AliasAmbiguousType/AbstractAliasAmbiguousTypeCodeFixProvider.cs b/src/Features/Core/Portable/AliasAmbiguousType/AbstractAliasAmbiguousTypeCodeFixProvider.cs index ece6c991a3617..767965b44485a 100644 --- a/src/Features/Core/Portable/AliasAmbiguousType/AbstractAliasAmbiguousTypeCodeFixProvider.cs +++ b/src/Features/Core/Portable/AliasAmbiguousType/AbstractAliasAmbiguousTypeCodeFixProvider.cs @@ -62,7 +62,7 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) } var groupingTitle = string.Format(FeaturesResources.Alias_ambiguous_type_0, diagnosticNode.ToString()); - var groupingCodeAction = new CodeActionWithNestedActions(groupingTitle, codeActionsBuilder.ToImmutable(), isInlinable: true); + var groupingCodeAction = CodeActionWithNestedActions.Create(groupingTitle, codeActionsBuilder.ToImmutable(), isInlinable: true); context.RegisterCodeFix(groupingCodeAction, context.Diagnostics.First()); } } diff --git a/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs b/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs index 8b32808fe75a2..8b853742331a1 100644 --- a/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs +++ b/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs @@ -102,7 +102,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) ReportTelemetryIfNecessary(potentialConversionTypes); - context.RegisterCodeFix(new CodeAction.CodeActionWithNestedActions( + context.RegisterCodeFix(CodeAction.CodeActionWithNestedActions.Create( FeaturesResources.Add_explicit_cast, actions.ToImmutable(), isInlinable: false), context.Diagnostics); diff --git a/src/Features/Core/Portable/CodeFixes/Configuration/ConfigureCodeStyle/ConfigureCodeStyleOptionCodeFixProvider.cs b/src/Features/Core/Portable/CodeFixes/Configuration/ConfigureCodeStyle/ConfigureCodeStyleOptionCodeFixProvider.cs index 70021dca9b330..593e436ad09f4 100644 --- a/src/Features/Core/Portable/CodeFixes/Configuration/ConfigureCodeStyle/ConfigureCodeStyleOptionCodeFixProvider.cs +++ b/src/Features/Core/Portable/CodeFixes/Configuration/ConfigureCodeStyle/ConfigureCodeStyleOptionCodeFixProvider.cs @@ -162,7 +162,7 @@ void AddCodeActionWithOptionValue(ICodeStyleOption codeStyleOption, object newVa // Add code action to configure the optionValue. nestedActions.Add( - new SolutionChangeAction( + SolutionChangeAction.Create( parts.optionValue, solution => ConfigurationUpdater.ConfigureCodeStyleOptionAsync(parts.optionName, parts.optionValue, diagnostic, isPerLanguage, project, cancellationToken), parts.optionValue)); diff --git a/src/Features/Core/Portable/CodeFixes/Configuration/ConfigureSeverity/ConfigureSeverityLevelCodeFixProvider.cs b/src/Features/Core/Portable/CodeFixes/Configuration/ConfigureSeverity/ConfigureSeverityLevelCodeFixProvider.cs index 59a7fb5cedb59..098add79e1558 100644 --- a/src/Features/Core/Portable/CodeFixes/Configuration/ConfigureSeverity/ConfigureSeverityLevelCodeFixProvider.cs +++ b/src/Features/Core/Portable/CodeFixes/Configuration/ConfigureSeverity/ConfigureSeverityLevelCodeFixProvider.cs @@ -60,7 +60,7 @@ private static ImmutableArray GetConfigurations(Project project, IEnume foreach (var (value, title) in s_editorConfigSeverityStrings) { nestedActions.Add( - new SolutionChangeAction( + SolutionChangeAction.Create( title, solution => ConfigurationUpdater.ConfigureSeverityAsync(value, diagnostic, project, cancellationToken), value)); @@ -101,7 +101,7 @@ void AddBulkConfigurationCodeFixes(ImmutableArray diagnostics, strin foreach (var (value, title) in s_editorConfigSeverityStrings) { nestedActions.Add( - new SolutionChangeAction( + SolutionChangeAction.Create( title, solution => category != null ? ConfigurationUpdater.BulkConfigureSeverityAsync(value, category, project, cancellationToken) diff --git a/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionBatchFixAllProvider.cs b/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionBatchFixAllProvider.cs index 7f1aa3017b8d5..22e76e7b5813f 100644 --- a/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionBatchFixAllProvider.cs +++ b/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionBatchFixAllProvider.cs @@ -242,7 +242,7 @@ protected virtual Task AddProjectFixesAsync( if (newSolution != null && newSolution != solution) { var title = GetFixAllTitle(fixAllState); - return new CodeAction.SolutionChangeAction(title, _ => Task.FromResult(newSolution), title); + return CodeAction.SolutionChangeAction.Create(title, _ => Task.FromResult(newSolution), title); } return null; diff --git a/src/Features/Core/Portable/CodeRefactorings/CodeRefactoringService.cs b/src/Features/Core/Portable/CodeRefactorings/CodeRefactoringService.cs index cfb19127cff22..66211617436c9 100644 --- a/src/Features/Core/Portable/CodeRefactorings/CodeRefactoringService.cs +++ b/src/Features/Core/Portable/CodeRefactorings/CodeRefactoringService.cs @@ -172,7 +172,7 @@ public async Task> GetRefactoringsAsync( // Add the Refactoring Provider Name to the parent CodeAction's CustomTags. // Always add a name even in cases of 3rd party refactorings that do not export // name metadata. - action.AddCustomTag(providerMetadata?.Name ?? provider.GetTypeDisplayName()); + action.AddCustomTagAndTelemetryInfo(providerMetadata, provider); actions.Add((action, applicableToSpan)); } diff --git a/src/Features/Core/Portable/ConvertAnonymousType/AbstractConvertAnonymousTypeToTupleCodeRefactoringProvider.cs b/src/Features/Core/Portable/ConvertAnonymousType/AbstractConvertAnonymousTypeToTupleCodeRefactoringProvider.cs index 6049e6de76f8f..1d8c234f1f29d 100644 --- a/src/Features/Core/Portable/ConvertAnonymousType/AbstractConvertAnonymousTypeToTupleCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/ConvertAnonymousType/AbstractConvertAnonymousTypeToTupleCodeRefactoringProvider.cs @@ -51,7 +51,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte // anonymous type, and one to fixup all anonymous types. if (allAnonymousNodes.Any(t => !anonymousType.Equals(t.symbol, SymbolEqualityComparer.Default))) { - context.RegisterRefactoring(new CodeAction.CodeActionWithNestedActions( + context.RegisterRefactoring(CodeAction.CodeActionWithNestedActions.Create( FeaturesResources.Convert_to_tuple, ImmutableArray.Create( new MyCodeAction(FeaturesResources.just_this_anonymous_type, c => FixInCurrentMemberAsync(document, anonymousNode, anonymousType, allAnonymousTypes: false, c)), diff --git a/src/Features/Core/Portable/ConvertTupleToStruct/AbstractConvertTupleToStructCodeRefactoringProvider.cs b/src/Features/Core/Portable/ConvertTupleToStruct/AbstractConvertTupleToStructCodeRefactoringProvider.cs index eb41179388067..8c13540bb2921 100644 --- a/src/Features/Core/Portable/ConvertTupleToStruct/AbstractConvertTupleToStructCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/ConvertTupleToStruct/AbstractConvertTupleToStructCodeRefactoringProvider.cs @@ -93,7 +93,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte if (recordChildActions.Length > 0) { context.RegisterRefactoring( - new CodeAction.CodeActionWithNestedActions( + CodeAction.CodeActionWithNestedActions.Create( FeaturesResources.Convert_to_record_struct, recordChildActions, isInlinable: false), @@ -105,7 +105,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte if (childActions.Length > 0) { context.RegisterRefactoring( - new CodeAction.CodeActionWithNestedActions( + CodeAction.CodeActionWithNestedActions.Create( FeaturesResources.Convert_to_struct, childActions, isInlinable: false), diff --git a/src/Features/Core/Portable/GenerateComparisonOperators/GenerateComparisonOperatorsCodeRefactoringProvider.cs b/src/Features/Core/Portable/GenerateComparisonOperators/GenerateComparisonOperatorsCodeRefactoringProvider.cs index 9ccad19ba7c4c..90ccc457d8363 100644 --- a/src/Features/Core/Portable/GenerateComparisonOperators/GenerateComparisonOperatorsCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/GenerateComparisonOperators/GenerateComparisonOperatorsCodeRefactoringProvider.cs @@ -113,7 +113,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte nameof(FeaturesResources.Generate_for_0) + "_" + displayString)); } - context.RegisterRefactoring(new CodeAction.CodeActionWithNestedActions( + context.RegisterRefactoring(CodeAction.CodeActionWithNestedActions.Create( FeaturesResources.Generate_comparison_operators, nestedActions.ToImmutable(), isInlinable: false)); diff --git a/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.cs b/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.cs index 63faa8218d45f..fd1cf6cf010ff 100644 --- a/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.cs +++ b/src/Features/Core/Portable/InlineMethod/AbstractInlineMethodRefactoringProvider.cs @@ -235,7 +235,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte callerDeclarationNode, inlineExpression, invocationOperation); - var nestedCodeAction = new CodeAction.CodeActionWithNestedActions( + var nestedCodeAction = CodeAction.CodeActionWithNestedActions.Create( string.Format(FeaturesResources.Inline_0, calleeMethodSymbol.ToNameDisplayString()), codeActions, isInlinable: true); diff --git a/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceParameterService.cs b/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceParameterService.cs index f874b000e3696..d90a39faee03d 100644 --- a/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceParameterService.cs +++ b/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceParameterService.cs @@ -128,13 +128,13 @@ public sealed override async Task ComputeRefactoringsAsync(CodeRefactoringContex if (actions.Value.actions.Length > 0) { - context.RegisterRefactoring(new CodeActionWithNestedActions( + context.RegisterRefactoring(CodeActionWithNestedActions.Create( string.Format(FeaturesResources.Introduce_parameter_for_0, nodeString), actions.Value.actions, isInlinable: false, priority: CodeActionPriority.Low), textSpan); } if (actions.Value.actionsAllOccurrences.Length > 0) { - context.RegisterRefactoring(new CodeActionWithNestedActions( + context.RegisterRefactoring(CodeActionWithNestedActions.Create( string.Format(FeaturesResources.Introduce_parameter_for_all_occurrences_of_0, nodeString), actions.Value.actionsAllOccurrences, isInlinable: false, priority: CodeActionPriority.Low), textSpan); } diff --git a/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.cs b/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.cs index 837c9bba3023d..9a9c1de6a9940 100644 --- a/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.cs +++ b/src/Features/Core/Portable/IntroduceVariable/AbstractIntroduceVariableService.cs @@ -80,7 +80,7 @@ public async Task IntroduceVariableAsync( // the code action as 'inlinable' so that if the lightbulb is not cluttered // then the nested items can just be lifted into it, giving the user fast // access to them. - return new CodeActionWithNestedActions(title, actions, isInlinable: true); + return CodeActionWithNestedActions.Create(title, actions, isInlinable: true); } } diff --git a/src/Features/Core/Portable/PullMemberUp/AbstractPullMemberUpRefactoringProvider.cs b/src/Features/Core/Portable/PullMemberUp/AbstractPullMemberUpRefactoringProvider.cs index df521d1738f46..54d7cd31d9ad3 100644 --- a/src/Features/Core/Portable/PullMemberUp/AbstractPullMemberUpRefactoringProvider.cs +++ b/src/Features/Core/Portable/PullMemberUp/AbstractPullMemberUpRefactoringProvider.cs @@ -69,7 +69,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte .WhereNotNull().Concat(new PullMemberUpWithDialogCodeAction(document, selectedMember, _service)) .ToImmutableArray(); - var nestedCodeAction = new CodeActionWithNestedActions( + var nestedCodeAction = CodeActionWithNestedActions.Create( string.Format(FeaturesResources.Pull_0_up, selectedMember.ToNameDisplayString()), allActions, isInlinable: true); context.RegisterRefactoring(nestedCodeAction, selectedMemberNode.Span); diff --git a/src/Features/Core/Portable/PullMemberUp/MembersPuller.cs b/src/Features/Core/Portable/PullMemberUp/MembersPuller.cs index c1eddfaaf5168..eab6bfb96e139 100644 --- a/src/Features/Core/Portable/PullMemberUp/MembersPuller.cs +++ b/src/Features/Core/Portable/PullMemberUp/MembersPuller.cs @@ -47,7 +47,7 @@ public static CodeAction TryComputeCodeAction( } var title = string.Format(FeaturesResources.Pull_0_up_to_1, selectedMember.Name, result.Destination.Name); - return new SolutionChangeAction( + return SolutionChangeAction.Create( title, cancellationToken => PullMembersUpAsync(document, result, cancellationToken), title); diff --git a/src/Features/Core/Portable/Wrapping/AbstractCodeActionComputer.cs b/src/Features/Core/Portable/Wrapping/AbstractCodeActionComputer.cs index 09f3e7c4a5fe3..b0dc9df8130b8 100644 --- a/src/Features/Core/Portable/Wrapping/AbstractCodeActionComputer.cs +++ b/src/Features/Core/Portable/Wrapping/AbstractCodeActionComputer.cs @@ -286,7 +286,7 @@ public async Task> GetTopLevelCodeActionsAsync() // Make our code action low priority. This option will be offered *a lot*, and // much of the time will not be something the user particularly wants to do. // It should be offered after all other normal refactorings. - result.Add(new CodeActionWithNestedActions( + result.Add(CodeActionWithNestedActions.Create( wrappingActions[0].ParentTitle, sorted, group.IsInlinable, CodeActionPriority.Low)); } diff --git a/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs b/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs index 7ab340d771d69..16d6c029db1a5 100644 --- a/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs +++ b/src/Features/LanguageServer/Protocol/Features/CodeFixes/CodeFixService.cs @@ -524,7 +524,7 @@ private static async Task> GetCodeFixesAsync( // Add the CodeFix Provider Name to the parent CodeAction's CustomTags. // Always add a name even in cases of 3rd party fixers that do not export // name metadata. - action.AddCustomTag(fixerMetadata?.Name ?? fixer.GetTypeDisplayName()); + action.AddCustomTagAndTelemetryInfo(fixerMetadata, fixer); fixes.Add(new CodeFix(document.Project, action, applicableDiagnostics)); } diff --git a/src/Features/LanguageServer/Protocol/Features/UnifiedSuggestions/UnifiedSuggestedActionsSource.cs b/src/Features/LanguageServer/Protocol/Features/UnifiedSuggestions/UnifiedSuggestedActionsSource.cs index e51c1efe4dbd3..97ea2ee348c1d 100644 --- a/src/Features/LanguageServer/Protocol/Features/UnifiedSuggestions/UnifiedSuggestedActionsSource.cs +++ b/src/Features/LanguageServer/Protocol/Features/UnifiedSuggestions/UnifiedSuggestedActionsSource.cs @@ -278,7 +278,7 @@ private static ImmutableArray PrioritizeFixGroups( { // Wrap the suppression/configuration actions within another top level suggested action // to avoid clutter in the light bulb menu. - var suppressOrConfigureCodeAction = new NoChangeAction(CodeFixesResources.Suppress_or_Configure_issues, nameof(CodeFixesResources.Suppress_or_Configure_issues)); + var suppressOrConfigureCodeAction = NoChangeAction.Create(CodeFixesResources.Suppress_or_Configure_issues, nameof(CodeFixesResources.Suppress_or_Configure_issues)); var wrappingSuggestedAction = new UnifiedSuggestedActionWithNestedActions( workspace, codeAction: suppressOrConfigureCodeAction, codeActionPriority: suppressOrConfigureCodeAction.Priority, provider: null, diff --git a/src/Tools/BuildActionTelemetryTable/BuildActionTelemetryTable.csproj b/src/Tools/BuildActionTelemetryTable/BuildActionTelemetryTable.csproj index 3a6ea5dd24aed..2809fab12808d 100644 --- a/src/Tools/BuildActionTelemetryTable/BuildActionTelemetryTable.csproj +++ b/src/Tools/BuildActionTelemetryTable/BuildActionTelemetryTable.csproj @@ -33,7 +33,7 @@ - + diff --git a/src/Tools/BuildActionTelemetryTable/Program.cs b/src/Tools/BuildActionTelemetryTable/Program.cs index 10b84e622670b..bd932351283df 100644 --- a/src/Tools/BuildActionTelemetryTable/Program.cs +++ b/src/Tools/BuildActionTelemetryTable/Program.cs @@ -11,7 +11,9 @@ using System.Reflection; using System.Text; using Microsoft.CodeAnalysis.CodeActions; -using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.CodeFixes; +using Microsoft.CodeAnalysis.CodeRefactorings; +using Microsoft.CodeAnalysis.Shared.Extensions; using TelemetryInfo = System.Tuple; namespace BuildActionTelemetryTable @@ -33,65 +35,65 @@ public class Program private static ImmutableDictionary CodeActionDescriptionMap { get; } = new Dictionary() { - { "Microsoft.CodeAnalysis.CSharp.TypeStyle.UseExplicitTypeCodeFixProvider+MyCodeAction", "Use Explicit Type" }, - { "Microsoft.CodeAnalysis.CSharp.TypeStyle.UseImplicitTypeCodeFixProvider+MyCodeAction", "Use Implicit Type" }, - { "Microsoft.CodeAnalysis.CSharp.UseSimpleUsingStatement.UseSimpleUsingStatementCodeFixProvider+MyCodeAction", "Use Simple Using Statement" }, - { "Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider+MyCodeAction", "Use 'Is Null' Check" }, - { "Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseIndexOperatorCodeFixProvider+MyCodeAction", "Use Index Operator" }, - { "Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseRangeOperatorCodeFixProvider+MyCodeAction", "Use Range Operator" }, - { "Microsoft.CodeAnalysis.CSharp.UseImplicitObjectCreation.CSharpUseImplicitObjectCreationCodeFixProvider+MyCodeAction", "Use Implicit Object Creation" }, - { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryCast.CSharpRemoveUnnecessaryCastCodeFixProvider+MyCodeAction", "Remove Unnecessary Cast" }, - { "Microsoft.CodeAnalysis.CSharp.UseDefaultLiteral.CSharpUseDefaultLiteralCodeFixProvider+MyCodeAction", "Use Default Literal" }, - { "Microsoft.CodeAnalysis.CSharp.UseDeconstruction.CSharpUseDeconstructionCodeFixProvider+MyCodeAction", "Use Deconstruction" }, - { "Microsoft.CodeAnalysis.CSharp.UseCompoundAssignment.CSharpUseCompoundCoalesceAssignmentCodeFixProvider+MyCodeAction", "Use Compound Assignment" }, - { "Microsoft.CodeAnalysis.CSharp.RemoveUnreachableCode.CSharpRemoveUnreachableCodeCodeFixProvider+MyCodeAction", "Remove Unreachable Code" }, + { "Microsoft.CodeAnalysis.CSharp.TypeStyle.UseExplicitTypeCodeFixProvider", "Use Explicit Type" }, + { "Microsoft.CodeAnalysis.CSharp.TypeStyle.UseImplicitTypeCodeFixProvider", "Use Implicit Type" }, + { "Microsoft.CodeAnalysis.CSharp.UseSimpleUsingStatement.UseSimpleUsingStatementCodeFixProvider", "Use Simple Using Statement" }, + { "Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider", "Use 'Is Null' Check" }, + { "Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseIndexOperatorCodeFixProvider", "Use Index Operator" }, + { "Microsoft.CodeAnalysis.CSharp.UseIndexOrRangeOperator.CSharpUseRangeOperatorCodeFixProvider", "Use Range Operator" }, + { "Microsoft.CodeAnalysis.CSharp.UseImplicitObjectCreation.CSharpUseImplicitObjectCreationCodeFixProvider", "Use Implicit Object Creation" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryCast.CSharpRemoveUnnecessaryCastCodeFixProvider", "Remove Unnecessary Cast" }, + { "Microsoft.CodeAnalysis.CSharp.UseDefaultLiteral.CSharpUseDefaultLiteralCodeFixProvider", "Use Default Literal" }, + { "Microsoft.CodeAnalysis.CSharp.UseDeconstruction.CSharpUseDeconstructionCodeFixProvider", "Use Deconstruction" }, + { "Microsoft.CodeAnalysis.CSharp.UseCompoundAssignment.CSharpUseCompoundCoalesceAssignmentCodeFixProvider", "Use Compound Assignment" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnreachableCode.CSharpRemoveUnreachableCodeCodeFixProvider", "Remove Unreachable Code" }, { "Microsoft.CodeAnalysis.CSharp.MisplacedUsingDirectives.MisplacedUsingDirectivesCodeFixProvider+MoveMisplacedUsingsCodeAction", "Misplaced Using Directives" }, - { "Microsoft.CodeAnalysis.CSharp.MakeStructFieldsWritable.CSharpMakeStructFieldsWritableCodeFixProvider+MyCodeAction", "Make Struct Fields Writable" }, - { "Microsoft.CodeAnalysis.CSharp.InvokeDelegateWithConditionalAccess.InvokeDelegateWithConditionalAccessCodeFixProvider+MyCodeAction", "Invoke Delegate With Conditional Access" }, - { "Microsoft.CodeAnalysis.CSharp.InlineDeclaration.CSharpInlineDeclarationCodeFixProvider+MyCodeAction", "Inline Declaration" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertSwitchStatementToExpression.ConvertSwitchStatementToExpressionCodeFixProvider+MyCodeAction", "Convert Switch Statement To Expression" }, - { "Microsoft.CodeAnalysis.CSharp.RemoveConfusingSuppression.CSharpRemoveConfusingSuppressionCodeFixProvider+MyCodeAction", "Remove Confusing Suppressino" }, - { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryDiscardDesignation.CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider+MyCodeAction", "Remove Unneccessary Discard Designation" }, - { "Microsoft.CodeAnalysis.CSharp.NewLines.EmbeddedStatementPlacement.EmbeddedStatementPlacementCodeFixProvider+MyCodeAction", "New Lines: Embedded Statement Placement" }, - { "Microsoft.CodeAnalysis.CSharp.NewLines.ConstructorInitializerPlacement.ConstructorInitializerPlacementCodeFixProvider+MyCodeAction", "New Lines: Constructor Initializer Placement" }, - { "Microsoft.CodeAnalysis.CSharp.NewLines.ConsecutiveBracePlacement.ConsecutiveBracePlacementCodeFixProvider+MyCodeAction", "New Lines: Consecutive Brace Placement" }, - { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckWithoutNameCodeFixProvider+MyCodeAction", "Use Pattern Matching: Is And Cast Check Without Name" }, - { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpUseNotPatternCodeFixProvider+MyCodeAction", "Use Pattern Matching: Use Not Pattern" }, - { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpAsAndNullCheckCodeFixProvider+MyCodeAction", "Use Pattern Matching: As And Null Check" }, - { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckCodeFixProvider+MyCodeAction", "Use Pattern Matching: Is And Cast Check" }, - { "Microsoft.CodeAnalysis.CSharp.UsePatternCombinators.CSharpUsePatternCombinatorsCodeFixProvider+MyCodeAction", "Use Pattern Mathcing: Use Pattern Combinators" }, - { "Microsoft.CodeAnalysis.CSharp.UseLocalFunction.CSharpUseLocalFunctionCodeFixProvider+MyCodeAction", "Use Local Function" }, - { "Microsoft.CodeAnalysis.CSharp.UseExpressionBody.UseExpressionBodyCodeRefactoringProvider+MyCodeAction", "Use Expression Body (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.UseExpressionBody.UseExpressionBodyCodeFixProvider+MyCodeAction", "Use Expression Body (Codefix)" }, - { "Microsoft.CodeAnalysis.CSharp.UseExpressionBodyForLambda.UseExpressionBodyForLambdaCodeStyleProvider+MyCodeAction", "Use Expression Body For Lambda" }, - { "Microsoft.CodeAnalysis.CSharp.UseExplicitTypeForConst.UseExplicitTypeForConstCodeFixProvider+MyCodeAction", "Use Explicit Type For Const" }, - { "Microsoft.CodeAnalysis.CSharp.ReverseForStatement.CSharpReverseForStatementCodeRefactoringProvider+MyCodeAction", "Reverse For Statement" }, - { "Microsoft.CodeAnalysis.CSharp.ReplaceDefaultLiteral.CSharpReplaceDefaultLiteralCodeFixProvider+MyCodeAction", "Replace Default Literal" }, - { "Microsoft.CodeAnalysis.CSharp.RemoveUnusedLocalFunction.CSharpRemoveUnusedLocalFunctionCodeFixProvider+MyCodeAction", "Remove Unused Local Function" }, - { "Microsoft.CodeAnalysis.CSharp.MakeRefStruct.MakeRefStructCodeFixProvider+MyCodeAction", "Make Ref Struct" }, - { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.MakeLocalFunctionStaticCodeFixProvider+MyCodeAction", "Make Local Function Static (CodeFix)" }, - { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.MakeLocalFunctionStaticCodeRefactoringProvider+MyCodeAction", "Make Local Function Static (Refactoring)" }, - { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.PassInCapturedVariablesAsArgumentsCodeFixProvider+MyCodeAction", "Make Local Function Static Pass In Captured Variables As Arguments" }, - { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.AbstractChangeImplementionCodeRefactoringProvider+MyCodeAction", "Implement Interface" }, - { "Microsoft.CodeAnalysis.CSharp.DisambiguateSameVariable.CSharpDisambiguateSameVariableCodeFixProvider+MyCodeAction", "Disambiguate Same Variable" }, - { "Microsoft.CodeAnalysis.CSharp.Diagnostics.AddBraces.CSharpAddBracesCodeFixProvider+MyCodeAction", "Add Braces" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertBetweenRegularAndVerbatimString.AbstractConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider`1+MyCodeAction", "Convert Between Regular And Verbatim String" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseType.AbstractUseTypeCodeRefactoringProvider+MyCodeAction", "Use Type" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.LambdaSimplifier.LambdaSimplifierCodeRefactoringProvider+MyCodeAction", "Lambda Simplifier" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineTemporary.CSharpInlineTemporaryCodeRefactoringProvider+MyCodeAction", "Inline Temporary" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EnableNullable.EnableNullableCodeRefactoringProvider+MyCodeAction", "Enable nullable" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.ConvertLocalFunctionToMethod.CSharpConvertLocalFunctionToMethodCodeRefactoringProvider+MyCodeAction", "Convert Local Function To Method" }, - { "Microsoft.CodeAnalysis.CSharp.UseInterpolatedVerbatimString.CSharpUseInterpolatedVerbatimStringCodeFixProvider+MyCodeAction", "Use Interpolated Verbatim String" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.RemoveNewModifier.RemoveNewModifierCodeFixProvider+MyCodeAction", "Remove New Modifier" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.RemoveInKeyword.RemoveInKeywordCodeFixProvider+MyCodeAction", "Remove In Keyword" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.DeclareAsNullable.CSharpDeclareAsNullableCodeFixProvider+MyCodeAction", "Declare As Nullable" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.MakeStatementAsynchronous.CSharpMakeStatementAsynchronousCodeFixProvider+MyCodeAction", "Make Statement Asynchronous" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.Iterator.CSharpAddYieldCodeFixProvider+MyCodeAction", "Add Yield" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.Iterator.CSharpChangeToIEnumerableCodeFixProvider+MyCodeAction", "Change To IEnumerable" }, + { "Microsoft.CodeAnalysis.CSharp.MakeStructFieldsWritable.CSharpMakeStructFieldsWritableCodeFixProvider", "Make Struct Fields Writable" }, + { "Microsoft.CodeAnalysis.CSharp.InvokeDelegateWithConditionalAccess.InvokeDelegateWithConditionalAccessCodeFixProvider", "Invoke Delegate With Conditional Access" }, + { "Microsoft.CodeAnalysis.CSharp.InlineDeclaration.CSharpInlineDeclarationCodeFixProvider", "Inline Declaration" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertSwitchStatementToExpression.ConvertSwitchStatementToExpressionCodeFixProvider", "Convert Switch Statement To Expression" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveConfusingSuppression.CSharpRemoveConfusingSuppressionCodeFixProvider", "Remove Confusing Suppressino" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryDiscardDesignation.CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider", "Remove Unneccessary Discard Designation" }, + { "Microsoft.CodeAnalysis.CSharp.NewLines.EmbeddedStatementPlacement.EmbeddedStatementPlacementCodeFixProvider", "New Lines: Embedded Statement Placement" }, + { "Microsoft.CodeAnalysis.CSharp.NewLines.ConstructorInitializerPlacement.ConstructorInitializerPlacementCodeFixProvider", "New Lines: Constructor Initializer Placement" }, + { "Microsoft.CodeAnalysis.CSharp.NewLines.ConsecutiveBracePlacement.ConsecutiveBracePlacementCodeFixProvider", "New Lines: Consecutive Brace Placement" }, + { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckWithoutNameCodeFixProvider", "Use Pattern Matching: Is And Cast Check Without Name" }, + { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpUseNotPatternCodeFixProvider", "Use Pattern Matching: Use Not Pattern" }, + { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpAsAndNullCheckCodeFixProvider", "Use Pattern Matching: As And Null Check" }, + { "Microsoft.CodeAnalysis.CSharp.UsePatternMatching.CSharpIsAndCastCheckCodeFixProvider", "Use Pattern Matching: Is And Cast Check" }, + { "Microsoft.CodeAnalysis.CSharp.UsePatternCombinators.CSharpUsePatternCombinatorsCodeFixProvider", "Use Pattern Mathcing: Use Pattern Combinators" }, + { "Microsoft.CodeAnalysis.CSharp.UseLocalFunction.CSharpUseLocalFunctionCodeFixProvider", "Use Local Function" }, + { "Microsoft.CodeAnalysis.CSharp.UseExpressionBody.UseExpressionBodyCodeRefactoringProvider", "Use Expression Body (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.UseExpressionBody.UseExpressionBodyCodeFixProvider", "Use Expression Body (Codefix)" }, + { "Microsoft.CodeAnalysis.CSharp.UseExpressionBodyForLambda.UseExpressionBodyForLambdaCodeStyleProvider", "Use Expression Body For Lambda" }, + { "Microsoft.CodeAnalysis.CSharp.UseExplicitTypeForConst.UseExplicitTypeForConstCodeFixProvider", "Use Explicit Type For Const" }, + { "Microsoft.CodeAnalysis.CSharp.ReverseForStatement.CSharpReverseForStatementCodeRefactoringProvider", "Reverse For Statement" }, + { "Microsoft.CodeAnalysis.CSharp.ReplaceDefaultLiteral.CSharpReplaceDefaultLiteralCodeFixProvider", "Replace Default Literal" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnusedLocalFunction.CSharpRemoveUnusedLocalFunctionCodeFixProvider", "Remove Unused Local Function" }, + { "Microsoft.CodeAnalysis.CSharp.MakeRefStruct.MakeRefStructCodeFixProvider", "Make Ref Struct" }, + { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.MakeLocalFunctionStaticCodeFixProvider", "Make Local Function Static (CodeFix)" }, + { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.MakeLocalFunctionStaticCodeRefactoringProvider", "Make Local Function Static (Refactoring)" }, + { "Microsoft.CodeAnalysis.CSharp.MakeLocalFunctionStatic.PassInCapturedVariablesAsArgumentsCodeFixProvider", "Make Local Function Static Pass In Captured Variables As Arguments" }, + { "Microsoft.CodeAnalysis.CSharp.ImplementInterface.AbstractChangeImplementionCodeRefactoringProvider", "Implement Interface" }, + { "Microsoft.CodeAnalysis.CSharp.DisambiguateSameVariable.CSharpDisambiguateSameVariableCodeFixProvider", "Disambiguate Same Variable" }, + { "Microsoft.CodeAnalysis.CSharp.Diagnostics.AddBraces.CSharpAddBracesCodeFixProvider", "Add Braces" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertBetweenRegularAndVerbatimString.AbstractConvertBetweenRegularAndVerbatimStringCodeRefactoringProvider`1", "Convert Between Regular And Verbatim String" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseType.AbstractUseTypeCodeRefactoringProvider", "Use Type" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.LambdaSimplifier.LambdaSimplifierCodeRefactoringProvider", "Lambda Simplifier" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.InlineTemporary.CSharpInlineTemporaryCodeRefactoringProvider", "Inline Temporary" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.EnableNullable.EnableNullableCodeRefactoringProvider", "Enable nullable" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.ConvertLocalFunctionToMethod.CSharpConvertLocalFunctionToMethodCodeRefactoringProvider", "Convert Local Function To Method" }, + { "Microsoft.CodeAnalysis.CSharp.UseInterpolatedVerbatimString.CSharpUseInterpolatedVerbatimStringCodeFixProvider", "Use Interpolated Verbatim String" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.RemoveNewModifier.RemoveNewModifierCodeFixProvider", "Remove New Modifier" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.RemoveInKeyword.RemoveInKeywordCodeFixProvider", "Remove In Keyword" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.DeclareAsNullable.CSharpDeclareAsNullableCodeFixProvider", "Declare As Nullable" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.MakeStatementAsynchronous.CSharpMakeStatementAsynchronousCodeFixProvider", "Make Statement Asynchronous" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.Iterator.CSharpAddYieldCodeFixProvider", "Add Yield" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.Iterator.CSharpChangeToIEnumerableCodeFixProvider", "Change To IEnumerable" }, { "Microsoft.CodeAnalysis.CSharp.CodeFixes.HideBase.HideBaseCodeFixProvider+AddNewKeywordAction", "Hide Basen" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.FixReturnType.CSharpFixReturnTypeCodeFixProvider+MyCodeAction", "Fix Return Type" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.ConditionalExpressionInStringInterpolation.CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider+MyCodeAction", "Add Parentheses Around Conditional Expression In String Interpolation" }, - { "Microsoft.CodeAnalysis.CSharp.AssignOutParameters.AbstractAssignOutParametersCodeFixProvider+MyCodeAction", "Assign Out Parameters" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.FixReturnType.CSharpFixReturnTypeCodeFixProvider", "Fix Return Type" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.ConditionalExpressionInStringInterpolation.CSharpAddParenthesesAroundConditionalExpressionInInterpolatedStringCodeFixProvider", "Add Parentheses Around Conditional Expression In String Interpolation" }, + { "Microsoft.CodeAnalysis.CSharp.AssignOutParameters.AbstractAssignOutParametersCodeFixProvider", "Assign Out Parameters" }, { "Microsoft.CodeAnalysis.Wrapping.WrapItemsAction", "Wrap Items" }, { "Microsoft.CodeAnalysis.UpgradeProject.ProjectOptionsChangeAction", "Upgrade Project" }, { "Microsoft.CodeAnalysis.ExtractInterface.ExtractInterfaceCodeAction", "Extract Interface" }, @@ -103,125 +105,125 @@ public class Program { "Microsoft.CodeAnalysis.AddPackage.InstallPackageParentCodeAction", "Install Package Parent" }, { "Microsoft.CodeAnalysis.AddPackage.InstallWithPackageManagerCodeAction", "Install With Package Manager" }, { "Microsoft.CodeAnalysis.AddMissingReference.AddMissingReferenceCodeAction", "Add Missing Reference" }, - { "Microsoft.CodeAnalysis.UpdateLegacySuppressions.UpdateLegacySuppressionsCodeFixProvider+MyCodeAction", "Update Legacy Suppressions" }, - { "Microsoft.CodeAnalysis.UseThrowExpression.UseThrowExpressionCodeFixProvider+MyCodeAction", "Use Throw Expression" }, - { "Microsoft.CodeAnalysis.UseSystemHashCode.UseSystemHashCodeCodeFixProvider+MyCodeAction", "Use System.HashCode" }, - { "Microsoft.CodeAnalysis.UseObjectInitializer.AbstractUseObjectInitializerCodeFixProvider`7+MyCodeAction", "Use Object Initializer" }, - { "Microsoft.CodeAnalysis.UseNullPropagation.AbstractUseNullPropagationCodeFixProvider`10+MyCodeAction", "Use Null Propagation" }, - { "Microsoft.CodeAnalysis.UseExplicitTupleName.UseExplicitTupleNameCodeFixProvider+MyCodeAction", "Use Explicit Tuple Name" }, - { "Microsoft.CodeAnalysis.UseIsNullCheck.AbstractUseIsNullCheckForReferenceEqualsCodeFixProvider`1+MyCodeAction", "Use 'Is Null' Check" }, - { "Microsoft.CodeAnalysis.UseInferredMemberName.AbstractUseInferredMemberNameCodeFixProvider+MyCodeAction", "Use Inferred Member Name" }, - { "Microsoft.CodeAnalysis.UseConditionalExpression.AbstractUseConditionalExpressionForAssignmentCodeFixProvider`6+MyCodeAction", "Use Conditional Expression For Assignment" }, - { "Microsoft.CodeAnalysis.UseConditionalExpression.AbstractUseConditionalExpressionForReturnCodeFixProvider`4+MyCodeAction", "Use Conditional Expression For Return" }, - { "Microsoft.CodeAnalysis.UseCompoundAssignment.AbstractUseCompoundAssignmentCodeFixProvider`3+MyCodeAction", "Use Compound Assignment" }, - { "Microsoft.CodeAnalysis.UseCollectionInitializer.AbstractUseCollectionInitializerCodeFixProvider`8+MyCodeAction", "Use Collection Initializer" }, - { "Microsoft.CodeAnalysis.UseCoalesceExpression.UseCoalesceExpressionCodeFixProvider+MyCodeAction", "Use Coalesce Expression" }, - { "Microsoft.CodeAnalysis.UseCoalesceExpression.UseCoalesceExpressionForNullableCodeFixProvider+MyCodeAction", "Use Coalesce Expression For Nullable" }, - { "Microsoft.CodeAnalysis.SimplifyLinqExpression.AbstractSimplifyLinqExpressionCodeFixProvider`3+MyCodeAction", "Simplify Linq Expression" }, - { "Microsoft.CodeAnalysis.SimplifyInterpolation.AbstractSimplifyInterpolationCodeFixProvider`7+MyCodeAction", "Simplify Interpolation" }, - { "Microsoft.CodeAnalysis.SimplifyBooleanExpression.SimplifyConditionalCodeFixProvider+MyCodeAction", "Simplify Boolean Expression" }, - { "Microsoft.CodeAnalysis.RemoveUnusedParametersAndValues.AbstractRemoveUnusedValuesCodeFixProvider`11+MyCodeAction", "Remove Unused Parameters And Values" }, - { "Microsoft.CodeAnalysis.RemoveUnusedMembers.AbstractRemoveUnusedMembersCodeFixProvider`1+MyCodeAction", "Remove Unused Members" }, - { "Microsoft.CodeAnalysis.RemoveUnnecessaryImports.AbstractRemoveUnnecessaryImportsCodeFixProvider+MyCodeAction", "Remove Unnecessary Imports" }, - { "Microsoft.CodeAnalysis.QualifyMemberAccess.AbstractQualifyMemberAccessCodeFixprovider`2+MyCodeAction", "Qualify Member Access" }, - { "Microsoft.CodeAnalysis.PopulateSwitch.AbstractPopulateSwitchCodeFixProvider`4+MyCodeAction", "Populate Switch" }, - { "Microsoft.CodeAnalysis.OrderModifiers.AbstractOrderModifiersCodeFixProvider+MyCodeAction", "Order Modifiers" }, - { "Microsoft.CodeAnalysis.MakeFieldReadonly.AbstractMakeFieldReadonlyCodeFixProvider`2+MyCodeAction", "Make Field Readonly" }, - { "Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions.RemoveUnnecessaryInlineSuppressionsCodeFixProvider+MyCodeAction", "Remove Unnecessary Inline Suppressions" }, - { "Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions.RemoveUnnecessaryAttributeSuppressionsCodeFixProvider+MyCodeAction", "Remove Unnecessary Attribute Suppressions" }, - { "Microsoft.CodeAnalysis.RemoveRedundantEquality.RemoveRedundantEqualityCodeFixProvider+MyCodeAction", "Remove Redundant Equality" }, - { "Microsoft.CodeAnalysis.NewLines.MultipleBlankLines.MultipleBlankLinesCodeFixProvider+MyCodeAction", "New Lines: Multiple Blank Lines" }, - { "Microsoft.CodeAnalysis.NewLines.ConsecutiveStatementPlacement.ConsecutiveStatementPlacementCodeFixProvider+MyCodeAction", "New Lines: Consecutive Statement Placement" }, - { "Microsoft.CodeAnalysis.FileHeaders.AbstractFileHeaderCodeFixProvider+MyCodeAction", "File Headers" }, - { "Microsoft.CodeAnalysis.ConvertTypeOfToNameOf.AbstractConvertTypeOfToNameOfCodeFixProvider+MyCodeAction", "Convert TypeOf To NameOf" }, - { "Microsoft.CodeAnalysis.ConvertAnonymousTypeToTuple.AbstractConvertAnonymousTypeToTupleCodeFixProvider`3+MyCodeAction", "Convert Anonymous Type To Tuple" }, - { "Microsoft.CodeAnalysis.AddRequiredParentheses.AddRequiredParenthesesCodeFixProvider+MyCodeAction", "Add Required Parentheses" }, - { "Microsoft.CodeAnalysis.AddAccessibilityModifiers.AbstractAddAccessibilityModifiersCodeFixProvider+MyCodeAction", "Add Accessibility Modifiers" }, - { "Microsoft.CodeAnalysis.RemoveUnnecessaryParentheses.AbstractRemoveUnnecessaryParenthesesCodeFixProvider`1+MyCodeAction", "Remove Unnecessary Parentheses" }, - { "Microsoft.CodeAnalysis.UseNamedArguments.AbstractUseNamedArgumentsCodeRefactoringProvider+MyCodeAction", "Use Named Arguments" }, + { "Microsoft.CodeAnalysis.UpdateLegacySuppressions.UpdateLegacySuppressionsCodeFixProvider", "Update Legacy Suppressions" }, + { "Microsoft.CodeAnalysis.UseThrowExpression.UseThrowExpressionCodeFixProvider", "Use Throw Expression" }, + { "Microsoft.CodeAnalysis.UseSystemHashCode.UseSystemHashCodeCodeFixProvider", "Use System.HashCode" }, + { "Microsoft.CodeAnalysis.UseObjectInitializer.AbstractUseObjectInitializerCodeFixProvider`7", "Use Object Initializer" }, + { "Microsoft.CodeAnalysis.UseNullPropagation.AbstractUseNullPropagationCodeFixProvider`10", "Use Null Propagation" }, + { "Microsoft.CodeAnalysis.UseExplicitTupleName.UseExplicitTupleNameCodeFixProvider", "Use Explicit Tuple Name" }, + { "Microsoft.CodeAnalysis.UseIsNullCheck.AbstractUseIsNullCheckForReferenceEqualsCodeFixProvider`1", "Use 'Is Null' Check" }, + { "Microsoft.CodeAnalysis.UseInferredMemberName.AbstractUseInferredMemberNameCodeFixProvider", "Use Inferred Member Name" }, + { "Microsoft.CodeAnalysis.UseConditionalExpression.AbstractUseConditionalExpressionForAssignmentCodeFixProvider`6", "Use Conditional Expression For Assignment" }, + { "Microsoft.CodeAnalysis.UseConditionalExpression.AbstractUseConditionalExpressionForReturnCodeFixProvider`4", "Use Conditional Expression For Return" }, + { "Microsoft.CodeAnalysis.UseCompoundAssignment.AbstractUseCompoundAssignmentCodeFixProvider`3", "Use Compound Assignment" }, + { "Microsoft.CodeAnalysis.UseCollectionInitializer.AbstractUseCollectionInitializerCodeFixProvider`8", "Use Collection Initializer" }, + { "Microsoft.CodeAnalysis.UseCoalesceExpression.UseCoalesceExpressionCodeFixProvider", "Use Coalesce Expression" }, + { "Microsoft.CodeAnalysis.UseCoalesceExpression.UseCoalesceExpressionForNullableCodeFixProvider", "Use Coalesce Expression For Nullable" }, + { "Microsoft.CodeAnalysis.SimplifyLinqExpression.AbstractSimplifyLinqExpressionCodeFixProvider`3", "Simplify Linq Expression" }, + { "Microsoft.CodeAnalysis.SimplifyInterpolation.AbstractSimplifyInterpolationCodeFixProvider`7", "Simplify Interpolation" }, + { "Microsoft.CodeAnalysis.SimplifyBooleanExpression.SimplifyConditionalCodeFixProvider", "Simplify Boolean Expression" }, + { "Microsoft.CodeAnalysis.RemoveUnusedParametersAndValues.AbstractRemoveUnusedValuesCodeFixProvider`11", "Remove Unused Parameters And Values" }, + { "Microsoft.CodeAnalysis.RemoveUnusedMembers.AbstractRemoveUnusedMembersCodeFixProvider`1", "Remove Unused Members" }, + { "Microsoft.CodeAnalysis.RemoveUnnecessaryImports.AbstractRemoveUnnecessaryImportsCodeFixProvider", "Remove Unnecessary Imports" }, + { "Microsoft.CodeAnalysis.QualifyMemberAccess.AbstractQualifyMemberAccessCodeFixprovider`2", "Qualify Member Access" }, + { "Microsoft.CodeAnalysis.PopulateSwitch.AbstractPopulateSwitchCodeFixProvider`4", "Populate Switch" }, + { "Microsoft.CodeAnalysis.OrderModifiers.AbstractOrderModifiersCodeFixProvider", "Order Modifiers" }, + { "Microsoft.CodeAnalysis.MakeFieldReadonly.AbstractMakeFieldReadonlyCodeFixProvider`2", "Make Field Readonly" }, + { "Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions.RemoveUnnecessaryInlineSuppressionsCodeFixProvider", "Remove Unnecessary Inline Suppressions" }, + { "Microsoft.CodeAnalysis.RemoveUnnecessarySuppressions.RemoveUnnecessaryAttributeSuppressionsCodeFixProvider", "Remove Unnecessary Attribute Suppressions" }, + { "Microsoft.CodeAnalysis.RemoveRedundantEquality.RemoveRedundantEqualityCodeFixProvider", "Remove Redundant Equality" }, + { "Microsoft.CodeAnalysis.NewLines.MultipleBlankLines.MultipleBlankLinesCodeFixProvider", "New Lines: Multiple Blank Lines" }, + { "Microsoft.CodeAnalysis.NewLines.ConsecutiveStatementPlacement.ConsecutiveStatementPlacementCodeFixProvider", "New Lines: Consecutive Statement Placement" }, + { "Microsoft.CodeAnalysis.FileHeaders.AbstractFileHeaderCodeFixProvider", "File Headers" }, + { "Microsoft.CodeAnalysis.ConvertTypeOfToNameOf.AbstractConvertTypeOfToNameOfCodeFixProvider", "Convert TypeOf To NameOf" }, + { "Microsoft.CodeAnalysis.ConvertAnonymousTypeToTuple.AbstractConvertAnonymousTypeToTupleCodeFixProvider`3", "Convert Anonymous Type To Tuple" }, + { "Microsoft.CodeAnalysis.AddRequiredParentheses.AddRequiredParenthesesCodeFixProvider", "Add Required Parentheses" }, + { "Microsoft.CodeAnalysis.AddAccessibilityModifiers.AbstractAddAccessibilityModifiersCodeFixProvider", "Add Accessibility Modifiers" }, + { "Microsoft.CodeAnalysis.RemoveUnnecessaryParentheses.AbstractRemoveUnnecessaryParenthesesCodeFixProvider`1", "Remove Unnecessary Parentheses" }, + { "Microsoft.CodeAnalysis.UseNamedArguments.AbstractUseNamedArgumentsCodeRefactoringProvider", "Use Named Arguments" }, { "Microsoft.CodeAnalysis.UseAutoProperty.AbstractUseAutoPropertyCodeFixProvider`5+UseAutoPropertyCodeAction", "Use Auto Property" }, - { "Microsoft.CodeAnalysis.UnsealClass.AbstractUnsealClassCodeFixProvider+MyCodeAction", "Unseal Class" }, - { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractMergeConsecutiveIfStatementsCodeRefactoringProvider+MyCodeAction", "Merge Consecutive If Statements" }, - { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractSplitIntoConsecutiveIfStatementsCodeRefactoringProvider+MyCodeAction", "Split Into Consecutive If Statements" }, - { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractMergeNestedIfStatementsCodeRefactoringProvider+MyCodeAction", "Merge Nested If Statements" }, - { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider+MyCodeAction", "Split Into Nested If Statements" }, + { "Microsoft.CodeAnalysis.UnsealClass.AbstractUnsealClassCodeFixProvider", "Unseal Class" }, + { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractMergeConsecutiveIfStatementsCodeRefactoringProvider", "Merge Consecutive If Statements" }, + { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractSplitIntoConsecutiveIfStatementsCodeRefactoringProvider", "Split Into Consecutive If Statements" }, + { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractMergeNestedIfStatementsCodeRefactoringProvider", "Merge Nested If Statements" }, + { "Microsoft.CodeAnalysis.SplitOrMergeIfStatements.AbstractSplitIntoNestedIfStatementsCodeRefactoringProvider", "Split Into Nested If Statements" }, { "Microsoft.CodeAnalysis.SpellCheck.AbstractSpellCheckCodeFixProvider`1+SpellCheckCodeAction", "Spell Check" }, - { "Microsoft.CodeAnalysis.SpellCheck.AbstractSpellCheckCodeFixProvider`1+MyCodeAction", "Spell Check" }, - { "Microsoft.CodeAnalysis.SimplifyTypeNames.AbstractSimplifyTypeNamesCodeFixProvider`1+MyCodeAction", "Simplify Type Names" }, - { "Microsoft.CodeAnalysis.SimplifyThisOrMe.AbstractSimplifyThisOrMeCodeFixProvider`1+MyCodeAction", "Simplify This Or Me" }, + { "Microsoft.CodeAnalysis.SpellCheck.AbstractSpellCheckCodeFixProvider`1", "Spell Check" }, + { "Microsoft.CodeAnalysis.SimplifyTypeNames.AbstractSimplifyTypeNamesCodeFixProvider`1", "Simplify Type Names" }, + { "Microsoft.CodeAnalysis.SimplifyThisOrMe.AbstractSimplifyThisOrMeCodeFixProvider`1", "Simplify This Or Me" }, { "Microsoft.CodeAnalysis.ReplacePropertyWithMethods.ReplacePropertyWithMethodsCodeRefactoringProvider+ReplacePropertyWithMethodsCodeAction", "Replace Property With Methods" }, { "Microsoft.CodeAnalysis.ReplaceMethodWithProperty.ReplaceMethodWithPropertyCodeRefactoringProvider+ReplaceMethodWithPropertyCodeAction", "Replace Method With Property" }, - { "Microsoft.CodeAnalysis.ReplaceDocCommentTextWithTag.AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider+MyCodeAction", "Replace Doc Comment Text With Tag" }, - { "Microsoft.CodeAnalysis.RemoveUnusedVariable.AbstractRemoveUnusedVariableCodeFixProvider`3+MyCodeAction", "Remove Unused Variable" }, - { "Microsoft.CodeAnalysis.RemoveAsyncModifier.AbstractRemoveAsyncModifierCodeFixProvider`2+MyCodeAction", "Remove Async Modifier" }, + { "Microsoft.CodeAnalysis.ReplaceDocCommentTextWithTag.AbstractReplaceDocCommentTextWithTagCodeRefactoringProvider", "Replace Doc Comment Text With Tag" }, + { "Microsoft.CodeAnalysis.RemoveUnusedVariable.AbstractRemoveUnusedVariableCodeFixProvider`3", "Remove Unused Variable" }, + { "Microsoft.CodeAnalysis.RemoveAsyncModifier.AbstractRemoveAsyncModifierCodeFixProvider`2", "Remove Async Modifier" }, { "Microsoft.CodeAnalysis.PreferFrameworkType.PreferFrameworkTypeCodeFixProvider+PreferFrameworkTypeCodeAction", "Prefer Framework Type" }, - { "Microsoft.CodeAnalysis.NameTupleElement.AbstractNameTupleElementCodeRefactoringProvider`2+MyCodeAction", "Name Tuple Element" }, + { "Microsoft.CodeAnalysis.NameTupleElement.AbstractNameTupleElementCodeRefactoringProvider`2", "Name Tuple Element" }, { "Microsoft.CodeAnalysis.MoveToNamespace.AbstractMoveToNamespaceCodeAction+MoveItemsToNamespaceCodeAction", "Move Items To Namespace" }, { "Microsoft.CodeAnalysis.MoveToNamespace.AbstractMoveToNamespaceCodeAction+MoveTypeToNamespaceCodeAction", "Move Type To Namespace" }, - { "Microsoft.CodeAnalysis.MoveDeclarationNearReference.AbstractMoveDeclarationNearReferenceCodeRefactoringProvider`1+MyCodeAction", "Move Declaration Near Reference" }, - { "Microsoft.CodeAnalysis.MakeMethodSynchronous.AbstractMakeMethodSynchronousCodeFixProvider+MyCodeAction", "Make Method Synchronous" }, - { "Microsoft.CodeAnalysis.MakeMethodAsynchronous.AbstractMakeMethodAsynchronousCodeFixProvider+MyCodeAction", "Make Method Asynchronous" }, - { "Microsoft.CodeAnalysis.MakeMemberStatic.AbstractMakeMemberStaticCodeFixProvider+MyCodeAction", "Make Member Static" }, - { "Microsoft.CodeAnalysis.MakeTypeAbstract.AbstractMakeTypeAbstractCodeFixProvider`1+MyCodeAction", "Make Type Abstract" }, - { "Microsoft.CodeAnalysis.InvertLogical.AbstractInvertLogicalCodeRefactoringProvider`3+MyCodeAction", "Invert Logical" }, - { "Microsoft.CodeAnalysis.InvertIf.AbstractInvertIfCodeRefactoringProvider`3+MyCodeAction", "Invert If" }, - { "Microsoft.CodeAnalysis.InvertConditional.AbstractInvertConditionalCodeRefactoringProvider`1+MyCodeAction", "Invert Conditional (Refactoring)" }, + { "Microsoft.CodeAnalysis.MoveDeclarationNearReference.AbstractMoveDeclarationNearReferenceCodeRefactoringProvider`1", "Move Declaration Near Reference" }, + { "Microsoft.CodeAnalysis.MakeMethodSynchronous.AbstractMakeMethodSynchronousCodeFixProvider", "Make Method Synchronous" }, + { "Microsoft.CodeAnalysis.MakeMethodAsynchronous.AbstractMakeMethodAsynchronousCodeFixProvider", "Make Method Asynchronous" }, + { "Microsoft.CodeAnalysis.MakeMemberStatic.AbstractMakeMemberStaticCodeFixProvider", "Make Member Static" }, + { "Microsoft.CodeAnalysis.MakeTypeAbstract.AbstractMakeTypeAbstractCodeFixProvider`1", "Make Type Abstract" }, + { "Microsoft.CodeAnalysis.InvertLogical.AbstractInvertLogicalCodeRefactoringProvider`3", "Invert Logical" }, + { "Microsoft.CodeAnalysis.InvertIf.AbstractInvertIfCodeRefactoringProvider`3", "Invert If" }, + { "Microsoft.CodeAnalysis.InvertConditional.AbstractInvertConditionalCodeRefactoringProvider`1", "Invert Conditional (Refactoring)" }, { "Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceVariableService`6+IntroduceVariableCodeAction", "Introduce Variable" }, { "Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceVariableService`6+IntroduceVariableAllOccurrenceCodeAction", "Introduce Variable All Occurrence" }, - { "Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceLocalForExpressionCodeRefactoringProvider`4+MyCodeAction", "Introduce Variable For Expression" }, - { "Microsoft.CodeAnalysis.IntroduceUsingStatement.AbstractIntroduceUsingStatementCodeRefactoringProvider`2+MyCodeAction", "Introduce Using Statement" }, + { "Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceLocalForExpressionCodeRefactoringProvider`4", "Introduce Variable For Expression" }, + { "Microsoft.CodeAnalysis.IntroduceUsingStatement.AbstractIntroduceUsingStatementCodeRefactoringProvider`2", "Introduce Using Statement" }, { "Microsoft.CodeAnalysis.InlineMethod.AbstractInlineMethodRefactoringProvider`4+MySolutionChangeAction", "Inline Method (Refactoring)" }, - { "Microsoft.CodeAnalysis.InitializeParameter.AbstractInitializeParameterCodeRefactoringProvider`4+MyCodeAction", "Initialize Parameter" }, + { "Microsoft.CodeAnalysis.InitializeParameter.AbstractInitializeParameterCodeRefactoringProvider`4", "Initialize Parameter" }, { "Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceCodeAction", "Implement Interface" }, { "Microsoft.CodeAnalysis.ImplementInterface.AbstractImplementInterfaceService+ImplementInterfaceWithDisposePatternCodeAction", "Implement Interface With Dispose Pattern" }, - { "Microsoft.CodeAnalysis.ImplementAbstractClass.AbstractImplementAbstractClassCodeFixProvider`1+MyCodeAction", "Implement Abstract Class" }, + { "Microsoft.CodeAnalysis.ImplementAbstractClass.AbstractImplementAbstractClassCodeFixProvider`1", "Implement Abstract Class" }, { "Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6+GenerateTypeCodeAction", "Generate Type" }, { "Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6+GenerateTypeCodeActionWithOption", "Generate Type With Option" }, - { "Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6+MyCodeAction", "Generate Type" }, + { "Microsoft.CodeAnalysis.GenerateType.AbstractGenerateTypeService`6", "Generate Type" }, { "Microsoft.CodeAnalysis.GenerateOverrides.GenerateOverridesCodeRefactoringProvider+GenerateOverridesWithDialogCodeAction", "Generate Overrides With Dialog" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3+GenerateVariableCodeAction", "Generate Variable" }, - { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3+MyCodeAction", "Generate Variable" }, + { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3", "Generate Variable" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3+GenerateLocalCodeAction", "Generate Local" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateVariable.AbstractGenerateVariableService`3+GenerateParameterCodeAction", "Generate Parameter" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateParameterizedMember.AbstractGenerateParameterizedMemberService`4+GenerateParameterizedMemberCodeAction", "Generate Parameterized Member" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateEnumMember.AbstractGenerateEnumMemberService`3+GenerateEnumMemberCodeAction", "Generate Enum Member" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+GenerateDefaultConstructorCodeAction", "Generate Default Constructors" }, { "Microsoft.CodeAnalysis.GenerateMember.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+CodeActionAll", "Generate Default Constructors All" }, - { "Microsoft.CodeAnalysis.GenerateMember.GenerateConstructor.AbstractGenerateConstructorService`2+MyCodeAction", "Generate Constructor" }, + { "Microsoft.CodeAnalysis.GenerateMember.GenerateConstructor.AbstractGenerateConstructorService`2", "Generate Constructor" }, { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider+GenerateEqualsAndGetHashCodeAction", "Generate Equals And Get Hash Code From Members" }, { "Microsoft.CodeAnalysis.GenerateEqualsAndGetHashCodeFromMembers.GenerateEqualsAndGetHashCodeFromMembersCodeRefactoringProvider+GenerateEqualsAndGetHashCodeWithDialogCodeAction", "Generate Equals And Get Hash Code From Members With Dialog" }, { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+ConstructorDelegatingCodeAction", "Generate Constructor From Members (Constructor Delegating)" }, { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+FieldDelegatingCodeAction", "Generate Constructor From Members (Field Delegating)" }, { "Microsoft.CodeAnalysis.GenerateConstructorFromMembers.AbstractGenerateConstructorFromMembersCodeRefactoringProvider+GenerateConstructorWithDialogCodeAction", "Generate Constructor From Members With Dialog" }, - { "Microsoft.CodeAnalysis.GenerateComparisonOperators.GenerateComparisonOperatorsCodeRefactoringProvider+MyCodeAction", "Generate Comparison Operators" }, - { "Microsoft.CodeAnalysis.Formatting.FormattingCodeFixProvider+MyCodeAction", "Fix Formatting" }, - { "Microsoft.CodeAnalysis.EncapsulateField.AbstractEncapsulateFieldService+MyCodeAction", "Encapsulate Field" }, - { "Microsoft.CodeAnalysis.DiagnosticComments.CodeFixes.AbstractAddDocCommentNodesCodeFixProvider`4+MyCodeAction", "Diagnostic Comments: Add DocComment Nodes" }, - { "Microsoft.CodeAnalysis.DiagnosticComments.CodeFixes.AbstractRemoveDocCommentNodeCodeFixProvider`2+MyCodeAction", "Diagnostic Comments: Remove DocComment Node" }, - { "Microsoft.CodeAnalysis.ConvertTupleToStruct.AbstractConvertTupleToStructCodeRefactoringProvider`10+MyCodeAction", "Convert Tuple To Struct" }, - { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertConcatenationToInterpolatedStringRefactoringProvider`1+MyCodeAction", "Convert Concatenation To Interpolated String" }, + { "Microsoft.CodeAnalysis.GenerateComparisonOperators.GenerateComparisonOperatorsCodeRefactoringProvider", "Generate Comparison Operators" }, + { "Microsoft.CodeAnalysis.Formatting.FormattingCodeFixProvider", "Fix Formatting" }, + { "Microsoft.CodeAnalysis.EncapsulateField.AbstractEncapsulateFieldService", "Encapsulate Field" }, + { "Microsoft.CodeAnalysis.DiagnosticComments.CodeFixes.AbstractAddDocCommentNodesCodeFixProvider`4", "Diagnostic Comments: Add DocComment Nodes" }, + { "Microsoft.CodeAnalysis.DiagnosticComments.CodeFixes.AbstractRemoveDocCommentNodeCodeFixProvider`2", "Diagnostic Comments: Remove DocComment Node" }, + { "Microsoft.CodeAnalysis.ConvertTupleToStruct.AbstractConvertTupleToStructCodeRefactoringProvider`10", "Convert Tuple To Struct" }, + { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertConcatenationToInterpolatedStringRefactoringProvider`1", "Convert Concatenation To Interpolated String" }, { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider`5+ConvertToInterpolatedStringCodeAction", "Convert Placeholder To Interpolated String" }, - { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.ConvertRegularStringToInterpolatedStringRefactoringProvider+MyCodeAction", "Convert Regular String To Interpolated String" }, - { "Microsoft.CodeAnalysis.ConvertNumericLiteral.AbstractConvertNumericLiteralCodeRefactoringProvider`1+MyCodeAction", "Convert Numeric Literal" }, - { "Microsoft.CodeAnalysis.ConvertLinq.AbstractConvertLinqQueryToForEachProvider`2+MyCodeAction", "Convert Linq Query To ForEach" }, + { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.ConvertRegularStringToInterpolatedStringRefactoringProvider", "Convert Regular String To Interpolated String" }, + { "Microsoft.CodeAnalysis.ConvertNumericLiteral.AbstractConvertNumericLiteralCodeRefactoringProvider`1", "Convert Numeric Literal" }, + { "Microsoft.CodeAnalysis.ConvertLinq.AbstractConvertLinqQueryToForEachProvider`2", "Convert Linq Query To ForEach" }, { "Microsoft.CodeAnalysis.ConvertLinq.ConvertForEachToLinqQuery.AbstractConvertForEachToLinqQueryProvider`2+ForEachToLinqQueryCodeAction", "Convert ForEach To Linq Query" }, - { "Microsoft.CodeAnalysis.ConvertIfToSwitch.AbstractConvertIfToSwitchCodeRefactoringProvider`4+MyCodeAction", "Convert If To Switch" }, - { "Microsoft.CodeAnalysis.ConvertForToForEach.AbstractConvertForToForEachCodeRefactoringProvider`6+MyCodeAction", "Convert For To ForEach" }, + { "Microsoft.CodeAnalysis.ConvertIfToSwitch.AbstractConvertIfToSwitchCodeRefactoringProvider`4", "Convert If To Switch" }, + { "Microsoft.CodeAnalysis.ConvertForToForEach.AbstractConvertForToForEachCodeRefactoringProvider`6", "Convert For To ForEach" }, { "Microsoft.CodeAnalysis.ConvertForEachToFor.AbstractConvertForEachToForCodeRefactoringProvider`2+ForEachToForCodeAction", "Convert ForEach To For" }, - { "Microsoft.CodeAnalysis.ConvertCast.AbstractConvertCastCodeRefactoringProvider`3+MyCodeAction", "Convert Cast" }, + { "Microsoft.CodeAnalysis.ConvertCast.AbstractConvertCastCodeRefactoringProvider`3", "Convert Cast" }, { "Microsoft.CodeAnalysis.ConvertAutoPropertyToFullProperty.AbstractConvertAutoPropertyToFullPropertyCodeRefactoringProvider`3+ConvertAutoPropertyToFullPropertyCodeAction", "Convert AutoProperty To Full Property" }, - { "Microsoft.CodeAnalysis.ConflictMarkerResolution.AbstractResolveConflictMarkerCodeFixProvider+MyCodeAction", "Resolve Conflict Marker" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertAnonymousTypeToClass.AbstractConvertAnonymousTypeToClassCodeRefactoringProvider`6+MyCodeAction", "Convert Anonymous Type To Class" }, + { "Microsoft.CodeAnalysis.ConflictMarkerResolution.AbstractResolveConflictMarkerCodeFixProvider", "Resolve Conflict Marker" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertAnonymousTypeToClass.AbstractConvertAnonymousTypeToClassCodeRefactoringProvider`6", "Convert Anonymous Type To Class" }, { "Microsoft.CodeAnalysis.AddMissingImports.AbstractAddMissingImportsRefactoringProvider+AddMissingImportsCodeAction", "Add Missing Imports (Paste)" }, { "Microsoft.CodeAnalysis.CodeRefactorings.PullMemberUp.AbstractPullMemberUpRefactoringProvider+PullMemberUpWithDialogCodeAction", "Pull Member Up" }, { "Microsoft.CodeAnalysis.CodeRefactorings.SyncNamespace.AbstractSyncNamespaceCodeRefactoringProvider`3+ChangeNamespaceCodeAction", "Sync Namespace: Change Namespace" }, { "Microsoft.CodeAnalysis.CodeRefactorings.SyncNamespace.AbstractSyncNamespaceCodeRefactoringProvider`3+MoveFileCodeAction", "Sync Namespace: Move File" }, { "Microsoft.CodeAnalysis.CodeRefactorings.MoveType.AbstractMoveTypeService`5+MoveTypeCodeAction", "Move Type" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.ExtractMethodCodeRefactoringProvider+MyCodeAction", "Extract Method" }, - { "Microsoft.CodeAnalysis.CodeRefactorings.AddAwait.AbstractAddAwaitCodeRefactoringProvider`1+MyCodeAction", "Add Await" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.ExtractMethod.ExtractMethodCodeRefactoringProvider", "Extract Method" }, + { "Microsoft.CodeAnalysis.CodeRefactorings.AddAwait.AbstractAddAwaitCodeRefactoringProvider`1", "Add Await" }, { "Microsoft.CodeAnalysis.CodeFixes.NamingStyles.NamingStyleCodeFixProvider+FixNameCodeAction", "Fix Naming Style" }, - { "Microsoft.CodeAnalysis.CodeFixes.MatchFolderAndNamespace.AbstractChangeNamespaceToMatchFolderCodeFixProvider+MyCodeAction", "Change Namespace To Match Folder" }, - { "Microsoft.CodeAnalysis.CodeFixes.FullyQualify.AbstractFullyQualifyCodeFixProvider+MyCodeAction", "Fully Qualify" }, + { "Microsoft.CodeAnalysis.CodeFixes.MatchFolderAndNamespace.AbstractChangeNamespaceToMatchFolderCodeFixProvider", "Change Namespace To Match Folder" }, + { "Microsoft.CodeAnalysis.CodeFixes.FullyQualify.AbstractFullyQualifyCodeFixProvider", "Fully Qualify" }, { "Microsoft.CodeAnalysis.CodeFixes.FullyQualify.AbstractFullyQualifyCodeFixProvider+GroupingCodeAction", "Fully Qualify (Grouping)" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageCodeAction", "Suppression.: Global Suppress Message" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction", "Suppression: Global Suppress Message (FixAll)" }, @@ -230,63 +232,63 @@ public class Program { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelBulkConfigureSeverityCodeAction", "Configure Severity: TopLevel Bulk Configure Severity" }, { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureSeverity.ConfigureSeverityLevelCodeFixProvider+TopLevelConfigureSeverityCodeAction", "Configure Severity: TopLevel Configure Severity" }, { "Microsoft.CodeAnalysis.CodeFixes.Configuration.ConfigureCodeStyle.ConfigureCodeStyleOptionCodeFixProvider+TopLevelConfigureCodeStyleOptionCodeAction", "Configure CodeStyle Option: TopLevel Configure CodeStyle Option" }, - { "Microsoft.CodeAnalysis.CodeFixes.Async.AbstractConvertToAsyncCodeFixProvider+MyCodeAction", "Convert To Async" }, - { "Microsoft.CodeAnalysis.CodeFixes.AddExplicitCast.AbstractAddExplicitCastCodeFixProvider`1+MyCodeAction", "Add Explicit Cast" }, - { "Microsoft.CodeAnalysis.AliasAmbiguousType.AbstractAliasAmbiguousTypeCodeFixProvider+MyCodeAction", "Alias Ambiguous Type" }, - { "Microsoft.CodeAnalysis.AddParameter.AbstractAddParameterCodeFixProvider`6+MyCodeAction", "Add Parameter" }, - { "Microsoft.CodeAnalysis.AddObsoleteAttribute.AbstractAddObsoleteAttributeCodeFixProvider+MyCodeAction", "Add Obsolete Attribute" }, + { "Microsoft.CodeAnalysis.CodeFixes.Async.AbstractConvertToAsyncCodeFixProvider", "Convert To Async" }, + { "Microsoft.CodeAnalysis.CodeFixes.AddExplicitCast.AbstractAddExplicitCastCodeFixProvider`1", "Add Explicit Cast" }, + { "Microsoft.CodeAnalysis.AliasAmbiguousType.AbstractAliasAmbiguousTypeCodeFixProvider", "Alias Ambiguous Type" }, + { "Microsoft.CodeAnalysis.AddParameter.AbstractAddParameterCodeFixProvider`6", "Add Parameter" }, + { "Microsoft.CodeAnalysis.AddObsoleteAttribute.AbstractAddObsoleteAttributeCodeFixProvider", "Add Obsolete Attribute" }, { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+AssemblyReferenceCodeAction", "AddImport (Assembly Reference)" }, { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+InstallPackageAndAddImportCodeAction", "AddImport (Install Package And Add Import)" }, { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+InstallWithPackageManagerCodeAction", "AddImport (Install With PackageManager)" }, { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+MetadataSymbolReferenceCodeAction", "AddImport (Metadata Symbol Reference)" }, { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+ParentInstallPackageCodeAction", "Add Import (Install Nuget Package)" }, { "Microsoft.CodeAnalysis.AddImport.AbstractAddImportFeatureService`1+ProjectSymbolReferenceCodeAction", "Add Import (Project Symbol Reference)" }, - { "Microsoft.CodeAnalysis.AddFileBanner.AbstractAddFileBannerCodeRefactoringProvider+MyCodeAction", "Add File Banner" }, - { "Microsoft.CodeAnalysis.AddDebuggerDisplay.AbstractAddDebuggerDisplayCodeRefactoringProvider`2+MyCodeAction", "Add Debugger Display" }, + { "Microsoft.CodeAnalysis.AddFileBanner.AbstractAddFileBannerCodeRefactoringProvider", "Add File Banner" }, + { "Microsoft.CodeAnalysis.AddDebuggerDisplay.AbstractAddDebuggerDisplayCodeRefactoringProvider`2", "Add Debugger Display" }, { "Microsoft.CodeAnalysis.AddConstructorParametersFromMembers.AddConstructorParametersFromMembersCodeRefactoringProvider+AddConstructorParametersCodeAction", "Add Constructor Parameters From Members" }, - { "Microsoft.CodeAnalysis.AddAnonymousTypeMemberName.AbstractAddAnonymousTypeMemberNameCodeFixProvider`3+MyCodeAction", "Add Anonymous Type Member Name" }, + { "Microsoft.CodeAnalysis.AddAnonymousTypeMemberName.AbstractAddAnonymousTypeMemberNameCodeFixProvider`3", "Add Anonymous Type Member Name" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+GlobalSuppressMessageFixAllCodeAction+GlobalSuppressionSolutionChangeAction", "Suppression: Global Suppress Message (FixAll)" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+AttributeRemoveAction", "Suppression: Remove Suppression (Attribute)" }, { "Microsoft.CodeAnalysis.CodeFixes.Suppression.AbstractSuppressionCodeFixProvider+RemoveSuppressionCodeAction+PragmaRemoveAction", "Suppression: Remove Suppression (Pragma)" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeActions.RemoveStatementCodeAction", "Remove Statement" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.CorrectNextControlVariable.CorrectNextControlVariableCodeFixProvider+CorrectNextControlVariableCodeAction", "Correct Next Control Variable" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateEndConstruct.GenerateEndConstructCodeFixProvider+MyCodeAction", "Generate End Construct" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateEndConstruct.GenerateEndConstructCodeFixProvider", "Generate End Construct" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateEvent.GenerateEventCodeFixProvider+GenerateEventCodeAction", "Generate Event" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue.IncorrectExitContinueCodeFixProvider+AddKeywordCodeAction", "Incorrect Exit Continue: Add Keyword" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue.IncorrectExitContinueCodeFixProvider+ReplaceKeywordCodeAction", "Incorrect Exit Continue: Replace Keyword" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectExitContinue.IncorrectExitContinueCodeFixProvider+ReplaceTokenKeywordCodeAction", "Incorrect Exit Continue: Replace Token Keyword" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectFunctionReturnType.IncorrectFunctionReturnTypeCodeFixProvider+MyCodeAction", "Incorrect Function Return Type" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator.VisualBasicChangeToYieldCodeFixProvider+MyCodeAction", "Change To Yield" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator.VisualBasicConvertToIteratorCodeFixProvider+MyCodeAction", "Convert To Iterator" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.IncorrectFunctionReturnType.IncorrectFunctionReturnTypeCodeFixProvider", "Incorrect Function Return Type" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator.VisualBasicChangeToYieldCodeFixProvider", "Change To Yield" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator.VisualBasicConvertToIteratorCodeFixProvider", "Convert To Iterator" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.MoveToTopOfFile.MoveToTopOfFileCodeFixProvider+MoveToLineCodeAction", "Move To Top Of File" }, { "Microsoft.CodeAnalysis.VisualBasic.CodeFixes.OverloadBase.OverloadBaseCodeFixProvider+AddKeywordAction", "Overload Base: Add Keyword" }, - { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.InlineTemporary.VisualBasicInlineTemporaryCodeRefactoringProvider+MyCodeAction", "Inline Temporary" }, - { "Microsoft.CodeAnalysis.VisualBasic.RemoveSharedFromModuleMembers.VisualBasicRemoveSharedFromModuleMembersCodeFixProvider+MyCodeAction", "Remove Shared From Module Members" }, - { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryByVal.VisualBasicRemoveUnnecessaryByValCodeFixProvider+MyCodeAction", "Remove Unnecessary ByVal" }, - { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryCast.VisualBasicRemoveUnnecessaryCastCodeFixProvider+MyCodeAction", "Remove Unnecessary Cast" }, - { "Microsoft.CodeAnalysis.VisualBasic.UseIsNotExpression.VisualBasicUseIsNotExpressionCodeFixProvider+MyCodeAction", "Use IsNot Expression" }, - { "Microsoft.CodeAnalysis.CSharp.UseTupleSwap.CSharpUseTupleSwapCodeFixProvider+MyCodeAction", "Use Tuple Swap" }, - { "Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseNullCheckOverTypeCheckCodeFixProvider+MyCodeAction", "Use Null Check Over Type Check" }, - { "Microsoft.CodeAnalysis.CSharp.SimplifyPropertyPattern.CSharpSimplifyPropertyPatternCodeFixProvider+MyCodeAction", "Simplify Property Pattern" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertNamespace.ConvertNamespaceCodeRefactoringProvider+MyCodeAction", "Convert Namespace Refactoring (FileScope/BlockScope)" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertNamespace.ConvertNamespaceCodeFixProvider+MyCodeAction", "Convert Namespace CodeFix (FileScope/BlockScope)" }, - { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseRecursivePatterns.UseRecursivePatternsCodeRefactoringProvider+MyCodeAction", "Use Recursive Patterns" }, + { "Microsoft.CodeAnalysis.VisualBasic.CodeRefactorings.InlineTemporary.VisualBasicInlineTemporaryCodeRefactoringProvider", "Inline Temporary" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveSharedFromModuleMembers.VisualBasicRemoveSharedFromModuleMembersCodeFixProvider", "Remove Shared From Module Members" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryByVal.VisualBasicRemoveUnnecessaryByValCodeFixProvider", "Remove Unnecessary ByVal" }, + { "Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryCast.VisualBasicRemoveUnnecessaryCastCodeFixProvider", "Remove Unnecessary Cast" }, + { "Microsoft.CodeAnalysis.VisualBasic.UseIsNotExpression.VisualBasicUseIsNotExpressionCodeFixProvider", "Use IsNot Expression" }, + { "Microsoft.CodeAnalysis.CSharp.UseTupleSwap.CSharpUseTupleSwapCodeFixProvider", "Use Tuple Swap" }, + { "Microsoft.CodeAnalysis.CSharp.UseIsNullCheck.CSharpUseNullCheckOverTypeCheckCodeFixProvider", "Use Null Check Over Type Check" }, + { "Microsoft.CodeAnalysis.CSharp.SimplifyPropertyPattern.CSharpSimplifyPropertyPatternCodeFixProvider", "Simplify Property Pattern" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertNamespace.ConvertNamespaceCodeRefactoringProvider", "Convert Namespace Refactoring (FileScope/BlockScope)" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertNamespace.ConvertNamespaceCodeFixProvider", "Convert Namespace CodeFix (FileScope/BlockScope)" }, + { "Microsoft.CodeAnalysis.CSharp.CodeRefactorings.UseRecursivePatterns.UseRecursivePatternsCodeRefactoringProvider", "Use Recursive Patterns" }, { "Microsoft.CodeAnalysis.MoveStaticMembers.MoveStaticMembersWithDialogCodeAction", "Move Static Members" }, - { "Microsoft.CodeAnalysis.SimplifyInterpolation.AbstractSimplifyInterpolationCodeFixProvider`5+MyCodeAction", "Simplify Interpolation" }, - { "Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceParameterService`4+MyCodeAction", "Introduce Parameter" }, + { "Microsoft.CodeAnalysis.SimplifyInterpolation.AbstractSimplifyInterpolationCodeFixProvider`5", "Simplify Interpolation" }, + { "Microsoft.CodeAnalysis.IntroduceVariable.AbstractIntroduceParameterService`4", "Introduce Parameter" }, { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+GenerateDefaultConstructorCodeAction", "Generate Default Constructor" }, { "Microsoft.CodeAnalysis.GenerateDefaultConstructors.AbstractGenerateDefaultConstructorsService`1+CodeActionAll", "Generate Default Constructur (All)" }, { "Microsoft.CodeAnalysis.ConvertToInterpolatedString.AbstractConvertPlaceholderToInterpolatedStringRefactoringProvider`6+ConvertToInterpolatedStringCodeAction", "Convert Placeholder To Interpolated String" }, - { "Microsoft.CodeAnalysis.ConvertAnonymousType.AbstractConvertAnonymousTypeToClassCodeRefactoringProvider`6+MyCodeAction", "Convert Anonymous Type To Class" }, - { "Microsoft.CodeAnalysis.ConvertAnonymousType.AbstractConvertAnonymousTypeToTupleCodeRefactoringProvider`3+MyCodeAction", "Convert Anonymous Type To Tuple" }, - { "Microsoft.CodeAnalysis.VisualBasic.SimplifyObjectCreation.VisualBasicSimplifyObjectCreationCodeFixProvider+MyCodeAction", "Simplify Object Creation" }, + { "Microsoft.CodeAnalysis.ConvertAnonymousType.AbstractConvertAnonymousTypeToClassCodeRefactoringProvider`6", "Convert Anonymous Type To Class" }, + { "Microsoft.CodeAnalysis.ConvertAnonymousType.AbstractConvertAnonymousTypeToTupleCodeRefactoringProvider`3", "Convert Anonymous Type To Tuple" }, + { "Microsoft.CodeAnalysis.VisualBasic.SimplifyObjectCreation.VisualBasicSimplifyObjectCreationCodeFixProvider", "Simplify Object Creation" }, { "Microsoft.CodeAnalysis.Editor.Implementation.RenameTracking.RenameTrackingTaggerProvider+RenameTrackingCodeAction", "Rename Tracking" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.AddInheritdoc.AddInheritdocCodeFixProvider+MyCodeAction", "Add Inheritdoc" }, - { "Microsoft.CodeAnalysis.CSharp.CodeFixes.TransposeRecordKeyword.CSharpTransposeRecordKeywordCodeFixProvider+MyCodeAction", "Fix record declaration" }, - { "Microsoft.CodeAnalysis.CSharp.ConvertToRawString.ConvertRegularStringToRawStringCodeRefactoringProvider+MyCodeAction", "Convert to raw string" }, - { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryLambdaExpression.CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider+MyCodeAction", "Remove Unnecessary Lambda Expression" }, - { "Microsoft.CodeAnalysis.CSharp.UseParameterNullChecking.CSharpUseParameterNullCheckingCodeFixProvider+MyCodeAction", "Use Parameter Null Checking" }, - { "Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json.LanguageServices.AbstractJsonDetectionCodeFixProvider+MyCodeAction", "Enable all JSON editor features" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.AddInheritdoc.AddInheritdocCodeFixProvider", "Add Inheritdoc" }, + { "Microsoft.CodeAnalysis.CSharp.CodeFixes.TransposeRecordKeyword.CSharpTransposeRecordKeywordCodeFixProvider", "Fix record declaration" }, + { "Microsoft.CodeAnalysis.CSharp.ConvertToRawString.ConvertRegularStringToRawStringCodeRefactoringProvider", "Convert to raw string" }, + { "Microsoft.CodeAnalysis.CSharp.RemoveUnnecessaryLambdaExpression.CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider", "Remove Unnecessary Lambda Expression" }, + { "Microsoft.CodeAnalysis.CSharp.UseParameterNullChecking.CSharpUseParameterNullCheckingCodeFixProvider", "Use Parameter Null Checking" }, + { "Microsoft.CodeAnalysis.Features.EmbeddedLanguages.Json.LanguageServices.AbstractJsonDetectionCodeFixProvider", "Enable all JSON editor features" }, }.ToImmutableDictionary(); public static void Main(string[] args) @@ -294,11 +296,11 @@ public static void Main(string[] args) Console.WriteLine("Loading assemblies and finding CodeActions ..."); var assemblies = GetAssemblies(args); - var codeActionTypes = GetCodeActionTypes(assemblies); + var codeActionAndProviderTypes = GetCodeActionAndProviderTypes(assemblies); - Console.WriteLine($"Generating Kusto datatable of {codeActionTypes.Length} CodeAction hashes ..."); + Console.WriteLine($"Generating Kusto datatable of {codeActionAndProviderTypes.Length} CodeAction and provider hashes ..."); - var telemetryInfos = GetTelemetryInfos(codeActionTypes); + var telemetryInfos = GetTelemetryInfos(codeActionAndProviderTypes); var datatable = GenerateKustoDatatable(telemetryInfos); var filepath = Path.GetFullPath(".\\ActionTable.txt"); @@ -336,20 +338,25 @@ static string GetRelativePath(string path, Uri baseUri) } } - internal static ImmutableArray GetCodeActionTypes(IEnumerable assemblies) + internal static ImmutableArray GetCodeActionAndProviderTypes(IEnumerable assemblies) { var types = assemblies.SelectMany( assembly => assembly.GetTypes().Where( type => !type.GetTypeInfo().IsInterface && !type.GetTypeInfo().IsAbstract)); return types - .Where(t => typeof(CodeAction).IsAssignableFrom(t)) + .Where(t => isCodeActionType(t) || isCodeActionProviderType(t)) .ToImmutableArray(); + + static bool isCodeActionType(Type t) => typeof(CodeAction).IsAssignableFrom(t); + + static bool isCodeActionProviderType(Type t) => typeof(CodeFixProvider).IsAssignableFrom(t) + || typeof(CodeRefactoringProvider).IsAssignableFrom(t); } - internal static ImmutableArray GetTelemetryInfos(ImmutableArray codeActionTypes) + internal static ImmutableArray GetTelemetryInfos(ImmutableArray codeActionAndProviderTypes) { - return codeActionTypes + return codeActionAndProviderTypes .Distinct(FullNameTypeComparer.Instance) .Select(GetTelemetryInfo) .ToImmutableArray(); diff --git a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Panels/TelemetryPanel.xaml.cs b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Panels/TelemetryPanel.xaml.cs index 0ec1eeaefc8b4..f5dad88cc0616 100644 --- a/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Panels/TelemetryPanel.xaml.cs +++ b/src/VisualStudio/VisualStudioDiagnosticsToolWindow/Panels/TelemetryPanel.xaml.cs @@ -13,7 +13,7 @@ using System.Windows.Controls; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; -using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.Shared.Extensions; namespace Roslyn.VisualStudio.DiagnosticsWindow { diff --git a/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs b/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs index 507618035aba8..2a951ed10e939 100644 --- a/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs +++ b/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs @@ -16,6 +16,7 @@ using Microsoft.CodeAnalysis.CodeRefactorings; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Formatting; +using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.Utilities; @@ -69,14 +70,47 @@ internal virtual ImmutableArray NestedCodeActions /// /// Gets custom tags for the CodeAction. /// - internal ImmutableArray CustomTags { get; set; } = ImmutableArray.Empty; + internal ImmutableArray CustomTags { get; private set; } = ImmutableArray.Empty; + + /// + /// Lazily set provider type that registered this code action. + /// Used for telemetry purposes only. + /// + private Type? _providerTypeForTelemetry; /// /// Used by the CodeFixService and CodeRefactoringService to add the Provider Name as a CustomTag. /// - internal void AddCustomTag(string tag) + internal void AddCustomTagAndTelemetryInfo(CodeChangeProviderMetadata? providerMetadata, object provider) { + Contract.ThrowIfFalse(provider is CodeFixProvider or CodeRefactoringProvider); + + // Add the provider name to the parent CodeAction's CustomTags. + // Always add a name even in cases of 3rd party fixers/refactorings that do not export + // name metadata. + var tag = providerMetadata?.Name ?? provider.GetTypeDisplayName(); CustomTags = CustomTags.Add(tag); + + // Set the provider type to use for logging telemetry. + _providerTypeForTelemetry = provider.GetType(); + } + + internal Guid GetTelemetryId(FixAllScope? fixAllScope = null) + { + // We need to identify the type name to use for CodeAction's telemetry ID. + // For code actions created from 'CodeAction.Create' factory methods, + // we use the provider type for telemetry. For the rest of the code actions + // created by sub-typing CodeAction type, we use the code action type for telemetry. + // For the former case, if the provider type is not set, we fallback to the CodeAction type instead. + var isFactoryGenerated = this is SimpleCodeAction { CreatedFromFactoryMethod: true }; + var type = isFactoryGenerated && _providerTypeForTelemetry != null + ? _providerTypeForTelemetry + : this.GetType(); + + // Additionally, we also add the equivalence key and fixAllScope ID (if non-null) + // to the telemetry ID. + var scope = fixAllScope?.GetScopeIdForTelemetry() ?? 0; + return type.GetTelemetryId(scope, EquivalenceKey); } /// @@ -324,7 +358,7 @@ public static CodeAction Create(string title, Func @@ -347,7 +381,7 @@ public static CodeAction Create(string title, Func @@ -369,31 +403,39 @@ public static CodeAction Create(string title, ImmutableArray nestedA throw new ArgumentNullException(nameof(nestedActions)); } - return new CodeActionWithNestedActions(title, nestedActions, isInlinable); + return CodeActionWithNestedActions.Create(title, nestedActions, isInlinable); } internal abstract class SimpleCodeAction : CodeAction { - public SimpleCodeAction( + protected SimpleCodeAction( string title, - string? equivalenceKey) + string? equivalenceKey, + bool createdFromFactoryMethod) { Title = title; EquivalenceKey = equivalenceKey; + CreatedFromFactoryMethod = createdFromFactoryMethod; } public sealed override string Title { get; } public sealed override string? EquivalenceKey { get; } + + /// + /// Indicates if this CodeAction was created using one of the 'CodeAction.Create' factory methods. + /// + public bool CreatedFromFactoryMethod { get; } } internal class CodeActionWithNestedActions : SimpleCodeAction { - public CodeActionWithNestedActions( + private CodeActionWithNestedActions( string title, ImmutableArray nestedActions, bool isInlinable, - CodeActionPriority priority = CodeActionPriority.Medium) - : base(title, ComputeEquivalenceKey(nestedActions)) + CodeActionPriority priority, + bool createdFromFactoryMethod) + : base(title, ComputeEquivalenceKey(nestedActions), createdFromFactoryMethod) { Debug.Assert(nestedActions.Length > 0); NestedCodeActions = nestedActions; @@ -401,6 +443,22 @@ public CodeActionWithNestedActions( Priority = priority; } + protected CodeActionWithNestedActions( + string title, + ImmutableArray nestedActions, + bool isInlinable, + CodeActionPriority priority = CodeActionPriority.Medium) + : this(title, nestedActions, isInlinable, priority, createdFromFactoryMethod: false) + { + } + + public static CodeActionWithNestedActions Create( + string title, + ImmutableArray nestedActions, + bool isInlinable, + CodeActionPriority priority = CodeActionPriority.Medium) + => new(title, nestedActions, isInlinable, priority, createdFromFactoryMethod: true); + internal override CodeActionPriority Priority { get; } internal sealed override bool IsInlinable { get; } @@ -430,15 +488,30 @@ internal class DocumentChangeAction : SimpleCodeAction { private readonly Func> _createChangedDocument; - public DocumentChangeAction( + private DocumentChangeAction( string title, Func> createChangedDocument, - string? equivalenceKey) - : base(title, equivalenceKey) + string? equivalenceKey, + bool createdFromFactoryMethod) + : base(title, equivalenceKey, createdFromFactoryMethod) { _createChangedDocument = createChangedDocument; } + protected DocumentChangeAction( + string title, + Func> createChangedDocument, + string? equivalenceKey) + : this(title, createChangedDocument, equivalenceKey, createdFromFactoryMethod: false) + { + } + + public static new DocumentChangeAction Create( + string title, + Func> createChangedDocument, + string? equivalenceKey) + => new(title, createChangedDocument, equivalenceKey, createdFromFactoryMethod: true); + protected sealed override Task GetChangedDocumentAsync(CancellationToken cancellationToken) => _createChangedDocument(cancellationToken); } @@ -447,28 +520,49 @@ internal class SolutionChangeAction : SimpleCodeAction { private readonly Func> _createChangedSolution; - public SolutionChangeAction( + private SolutionChangeAction( string title, Func> createChangedSolution, - string? equivalenceKey) - : base(title, equivalenceKey) + string? equivalenceKey, + bool createdFromFactoryMethod) + : base(title, equivalenceKey, createdFromFactoryMethod) { _createChangedSolution = createChangedSolution; } + protected SolutionChangeAction( + string title, + Func> createChangedSolution, + string? equivalenceKey) + : this(title, createChangedSolution, equivalenceKey, createdFromFactoryMethod: false) + { + } + + public static new SolutionChangeAction Create( + string title, + Func> createChangedSolution, + string? equivalenceKey) + => new(title, createChangedSolution, equivalenceKey, createdFromFactoryMethod: true); + protected sealed override Task GetChangedSolutionAsync(CancellationToken cancellationToken) => _createChangedSolution(cancellationToken).AsNullable(); } - internal class NoChangeAction : SimpleCodeAction + internal sealed class NoChangeAction : SimpleCodeAction { - public NoChangeAction( + private NoChangeAction( string title, - string? equivalenceKey) - : base(title, equivalenceKey) + string? equivalenceKey, + bool createdFromFactoryMethod) + : base(title, equivalenceKey, createdFromFactoryMethod) { } + public static NoChangeAction Create( + string title, + string? equivalenceKey) + => new(title, equivalenceKey, createdFromFactoryMethod: true); + protected sealed override Task GetChangedSolutionAsync(CancellationToken cancellationToken) => SpecializedTasks.Null(); } diff --git a/src/EditorFeatures/Core/Shared/Extensions/TelemetryExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/TelemetryExtensions.cs similarity index 84% rename from src/EditorFeatures/Core/Shared/Extensions/TelemetryExtensions.cs rename to src/Workspaces/Core/Portable/Shared/Extensions/TelemetryExtensions.cs index c9ca4ce684aa9..aa5cf659e9d07 100644 --- a/src/EditorFeatures/Core/Shared/Extensions/TelemetryExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/TelemetryExtensions.cs @@ -9,11 +9,11 @@ using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; -namespace Microsoft.CodeAnalysis.Editor.Shared.Extensions +namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static class TelemetryExtensions { - public static Guid GetTelemetryId(this Type type, short scope = 0) + public static Guid GetTelemetryId(this Type type, short scope = 0, string? additionalSuffixString = null) { type = GetTypeForTelemetry(type); Contract.ThrowIfNull(type.FullName); @@ -28,7 +28,12 @@ public static Guid GetTelemetryId(this Type type, short scope = 0) // the remainder with an empty byte array var suffixBytes = BitConverter.GetBytes(suffix).Concat(new byte[4]).ToArray(); - return new Guid(0, scope, 0, suffixBytes); + // Generate additional suffix to add to the Guid. + var additionalSuffix = (short)(additionalSuffixString != null + ? Hash.GetFNVHashCode(additionalSuffixString) + : 0); + + return new Guid(0, scope, additionalSuffix, suffixBytes); } public static Type GetTypeForTelemetry(this Type type) diff --git a/src/EditorFeatures/CSharpTest/Extensions/TelemetryExtensionTests.cs b/src/Workspaces/CoreTest/Shared/Extensions/TelemetryExtensions/TelemetryExtensionTests.cs similarity index 87% rename from src/EditorFeatures/CSharpTest/Extensions/TelemetryExtensionTests.cs rename to src/Workspaces/CoreTest/Shared/Extensions/TelemetryExtensions/TelemetryExtensionTests.cs index 1225c64fd1c12..4caf1ae3d6375 100644 --- a/src/EditorFeatures/CSharpTest/Extensions/TelemetryExtensionTests.cs +++ b/src/Workspaces/CoreTest/Shared/Extensions/TelemetryExtensions/TelemetryExtensionTests.cs @@ -5,10 +5,10 @@ #nullable disable using System; -using Microsoft.CodeAnalysis.Editor.Shared.Extensions; +using Microsoft.CodeAnalysis.Shared.Extensions; using Xunit; -namespace Microsoft.CodeAnalysis.Editor.CSharp.UnitTests.Extensions +namespace Microsoft.CodeAnalysis.UnitTests.Extensions { public class TelemetryExtensionTests { From 1f2d4746407d7f4ab886755bdced9310b112b7ff Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 30 Mar 2022 13:54:14 +0000 Subject: [PATCH 086/131] Update dependencies from https://github.com/dotnet/arcade build 20220329.1 (#60481) [main] Update dependencies from dotnet/arcade --- eng/Version.Details.xml | 8 ++++---- global.json | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b5edcb31630b9..73634212ab677 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -13,18 +13,18 @@ - + https://github.com/dotnet/arcade - c8a95297e2622251c125aa5c0ef7c822275a792d + 1527dc867ccb652def4c0f57fbd2ebbed3a94019 https://github.com/dotnet/roslyn 5d10d428050c0d6afef30a072c4ae68776621877 - + https://github.com/dotnet/arcade - c8a95297e2622251c125aa5c0ef7c822275a792d + 1527dc867ccb652def4c0f57fbd2ebbed3a94019 diff --git a/global.json b/global.json index 4932c3ed106d3..28e6b436a0b25 100644 --- a/global.json +++ b/global.json @@ -12,7 +12,7 @@ "xcopy-msbuild": "16.10.0-preview2" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22171.2", - "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22171.2" + "Microsoft.DotNet.Arcade.Sdk": "7.0.0-beta.22179.1", + "Microsoft.DotNet.Helix.Sdk": "7.0.0-beta.22179.1" } } From 3d3724881e7711848a2b32f4636c008a9a60eb43 Mon Sep 17 00:00:00 2001 From: akhera99 Date: Wed, 30 Mar 2022 09:32:41 -0700 Subject: [PATCH 087/131] added named param --- .../InlineDiagnostics/InlineDiagnosticsAdornmentManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/EditorFeatures/Core.Wpf/InlineDiagnostics/InlineDiagnosticsAdornmentManager.cs b/src/EditorFeatures/Core.Wpf/InlineDiagnostics/InlineDiagnosticsAdornmentManager.cs index ecc82ef57fa4a..f17b0c91163a3 100644 --- a/src/EditorFeatures/Core.Wpf/InlineDiagnostics/InlineDiagnosticsAdornmentManager.cs +++ b/src/EditorFeatures/Core.Wpf/InlineDiagnostics/InlineDiagnosticsAdornmentManager.cs @@ -183,7 +183,7 @@ protected override void AddAdornmentsToAdornmentLayer_CallOnlyOnUIThread(Normali var classificationType = _classificationRegistryService.GetClassificationType(InlineDiagnosticsTag.GetClassificationId(tag.ErrorType)); // Pass in null! because the geometry is unused for drawing anything for Inline Diagnostics - var graphicsResult = tag.GetGraphics(TextView, null!, GetFormat(classificationType)); + var graphicsResult = tag.GetGraphics(TextView, unused: null!, GetFormat(classificationType)); var visualElement = graphicsResult.VisualElement; From 9da0d6ec606d47fe3d6ee1beb1e5621e5e2c41ab Mon Sep 17 00:00:00 2001 From: DoctorKrolic Date: Wed, 30 Mar 2022 23:21:01 +0300 Subject: [PATCH 088/131] Fixed stack overflow issue with generic constraints, pointing to each other --- ...entInterfaceService.AccessibilityHelper.cs | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs index ca9e34d13e334..cd14d8a5187aa 100644 --- a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs +++ b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs @@ -2,6 +2,8 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System.Collections.Generic; + namespace Microsoft.CodeAnalysis.ImplementInterface { internal abstract partial class AbstractImplementInterfaceService @@ -78,18 +80,26 @@ public static bool IsLessAccessibleThan(ISymbol? first, INamedTypeSymbol second) } } - private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol? first, INamedTypeSymbol second) + private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol? first, INamedTypeSymbol second, List? alreadyCheckingTypes = null) { if (first is null) { return false; } + alreadyCheckingTypes ??= new(); + alreadyCheckingTypes.Add(first); + if (first is ITypeParameterSymbol typeParameter) { foreach (var constraint in typeParameter.ConstraintTypes) { - if (IsTypeLessAccessibleThanOtherType(constraint, second)) + if (alreadyCheckingTypes.Contains(constraint)) + { + continue; + } + + if (IsTypeLessAccessibleThanOtherType(constraint, second, alreadyCheckingTypes)) { return true; } @@ -111,14 +121,19 @@ private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol? first, INamed { foreach (var genericParam in namedType.TypeArguments) { - if (IsTypeLessAccessibleThanOtherType(genericParam, second)) + if (alreadyCheckingTypes.Contains(genericParam)) + { + continue; + } + + if (IsTypeLessAccessibleThanOtherType(genericParam, second, alreadyCheckingTypes)) { return true; } } } - if (IsTypeLessAccessibleThanOtherType(first.ContainingType, second)) + if (IsTypeLessAccessibleThanOtherType(first.ContainingType, second, alreadyCheckingTypes)) { return true; } From 46296942bb9bf527e0f2ed28df5a5b31c2890448 Mon Sep 17 00:00:00 2001 From: akhera99 Date: Wed, 30 Mar 2022 13:38:30 -0700 Subject: [PATCH 089/131] look for methodkind.local function when checking intent --- .../InlineHints/AbstractInlineParameterNameHintsService.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 83030a157023d..0f35f0f5a0d01 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -219,7 +219,7 @@ protected static bool MatchesMethodIntent(IParameterSymbol? parameter) // parameter names to improve clarity. The parameter is clear from the context of the method name. // First, this only applies to methods (as we're looking at the method name itself) so filter down to those. - if (parameter is not { ContainingSymbol: IMethodSymbol { MethodKind: MethodKind.Ordinary } method }) + if (parameter is not { ContainingSymbol: IMethodSymbol { MethodKind: MethodKind.Ordinary or MethodKind.LocalFunction } method }) return false; // We only care when dealing with the first parameter. Note: we don't have to worry parameter reordering From 2659333c2f9c7390b40e4c89e0e87f69aa0015dd Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Wed, 30 Mar 2022 13:47:58 -0700 Subject: [PATCH 090/131] Publish blame heap dumps for new integration tests --- eng/pipelines/test-integration-job.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/eng/pipelines/test-integration-job.yml b/eng/pipelines/test-integration-job.yml index d12843eef7182..2f1156bbc8007 100644 --- a/eng/pipelines/test-integration-job.yml +++ b/eng/pipelines/test-integration-job.yml @@ -47,7 +47,16 @@ steps: condition: not(succeeded()) - task: PublishBuildArtifacts@1 - displayName: Publish Screenshots and Test Attachments + displayName: Publish Test Attachments + inputs: + PathtoPublish: '$(Build.SourcesDirectory)\artifacts\bin\Microsoft.VisualStudio.LanguageServices.New.IntegrationTests\${{ parameters.configuration }}\net472\TestResults' + ArtifactName: '$(System.JobAttempt)-Blame ${{ parameters.configuration }} OOP64_${{ parameters.oop64bit }} OOPCoreClr_${{ parameters.oopCoreClr }} LspEditor_${{ parameters.lspEditor }} $(Build.BuildNumber)' + publishLocation: Container + continueOnError: true + condition: not(succeeded()) + + - task: PublishBuildArtifacts@1 + displayName: Publish Screenshots and Test Attachments (Old Tests) inputs: PathtoPublish: '$(Build.SourcesDirectory)\artifacts\bin\Microsoft.VisualStudio.LanguageServices.IntegrationTests\${{ parameters.configuration }}\net472\TestResults' ArtifactName: '$(System.JobAttempt)-Screenshots ${{ parameters.configuration }} OOP64_${{ parameters.oop64bit }} OOPCoreClr_${{ parameters.oopCoreClr }} LspEditor_${{ parameters.lspEditor }} $(Build.BuildNumber)' From 9b6ef24f67caed197c417d38738d18f1398820c0 Mon Sep 17 00:00:00 2001 From: akhera99 Date: Wed, 30 Mar 2022 14:27:40 -0700 Subject: [PATCH 091/131] test --- .../CSharpInlineParameterNameHintsTests.vb | 25 +++++++++++++++++++ ...AbstractInlineParameterNameHintsService.cs | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb index 2f4b27d604871..9552ad7909e3c 100644 --- a/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb +++ b/src/EditorFeatures/Test2/InlineHints/CSharpInlineParameterNameHintsTests.vb @@ -704,6 +704,31 @@ class A Await VerifyParamHints(input, input) End Function + + + Public Async Function TestNotOnEnableDisableBoolean3() As Task + Dim input = + + + +class A +{ + void Main() + { + EnableLogging(true); + + void EnableLogging(bool value) + { + } + } +} + + + + + Await VerifyParamHints(input, input) + End Function + Public Async Function TestOnEnableDisableNonBoolean1() As Task diff --git a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs index 0f35f0f5a0d01..14cd9a45ab867 100644 --- a/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs +++ b/src/Features/Core/Portable/InlineHints/AbstractInlineParameterNameHintsService.cs @@ -218,7 +218,7 @@ protected static bool MatchesMethodIntent(IParameterSymbol? parameter) // Methods like `SetColor(color: "y")` `FromResult(result: "x")` `Enable/DisablePolling(bool)` don't need // parameter names to improve clarity. The parameter is clear from the context of the method name. - // First, this only applies to methods (as we're looking at the method name itself) so filter down to those. + // First, this only applies to methods/local functions (as we're looking at the method name itself) so filter down to those. if (parameter is not { ContainingSymbol: IMethodSymbol { MethodKind: MethodKind.Ordinary or MethodKind.LocalFunction } method }) return false; From 84c0f528dbfa5183a59841143a8643e387ced568 Mon Sep 17 00:00:00 2001 From: "gel@microsoft.com" Date: Wed, 30 Mar 2022 17:05:10 -0700 Subject: [PATCH 092/131] Enable NRT in AbstractSyncNamespaceCodeRefactoringProvider --- ...arpSyncNamespaceCodeRefactoringProvider.cs | 9 ++-- ...eRefactoringProvider.MoveFileCodeAction.cs | 8 ++-- ...cNamespaceCodeRefactoringProvider.State.cs | 44 ++++++++++--------- ...actSyncNamespaceCodeRefactoringProvider.cs | 6 +-- 4 files changed, 32 insertions(+), 35 deletions(-) diff --git a/src/Features/CSharp/Portable/CodeRefactorings/SyncNamespace/CSharpSyncNamespaceCodeRefactoringProvider.cs b/src/Features/CSharp/Portable/CodeRefactorings/SyncNamespace/CSharpSyncNamespaceCodeRefactoringProvider.cs index 1bd683cfdeb52..a18d0f1c39500 100644 --- a/src/Features/CSharp/Portable/CodeRefactorings/SyncNamespace/CSharpSyncNamespaceCodeRefactoringProvider.cs +++ b/src/Features/CSharp/Portable/CodeRefactorings/SyncNamespace/CSharpSyncNamespaceCodeRefactoringProvider.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System.Collections.Immutable; using System.Composition; using System.Diagnostics.CodeAnalysis; @@ -28,14 +26,15 @@ public CSharpSyncNamespaceCodeRefactoringProvider() { } - protected override async Task TryGetApplicableInvocationNodeAsync(Document document, TextSpan span, CancellationToken cancellationToken) + protected override async Task TryGetApplicableInvocationNodeAsync(Document document, TextSpan span, CancellationToken cancellationToken) { if (!span.IsEmpty) return null; - var position = span.Start; + if (await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false) is not CompilationUnitSyntax compilationUnit) + return null; - var compilationUnit = (CompilationUnitSyntax)await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); + var position = span.Start; var namespaceDecls = compilationUnit.DescendantNodes(n => n is CompilationUnitSyntax or BaseNamespaceDeclarationSyntax) .OfType().ToImmutableArray(); diff --git a/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs b/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs index a129c38618712..e251d8d797f2b 100644 --- a/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs +++ b/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.MoveFileCodeAction.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Collections.Generic; using System.Collections.Immutable; @@ -14,6 +12,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.PooledObjects; +using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CodeRefactorings.SyncNamespace @@ -42,12 +41,11 @@ public MoveFileCodeAction(State state, ImmutableArray newFolders) protected override async Task> ComputeOperationsAsync(CancellationToken cancellationToken) { - var id = _state.Document.Id; + var document = _state.Document; var solution = _state.Document.Project.Solution; - var document = solution.GetDocument(id); var newDocumentId = DocumentId.CreateNewId(document.Project.Id, document.Name); - solution = solution.RemoveDocument(id); + solution = solution.RemoveDocument(document.Id); var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false); solution = solution.AddDocument(newDocumentId, document.Name, text, folders: _newfolders); diff --git a/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.State.cs b/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.State.cs index 9346e60d8705b..5690a4596014d 100644 --- a/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.State.cs +++ b/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.State.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -43,7 +41,7 @@ internal sealed class State /// This is the new name we want to change the namespace to. /// Empty string means global namespace, whereas null means change namespace action is not available. /// - public string TargetNamespace { get; } + public string? TargetNamespace { get; } /// /// This is the part of the declared namespace that is contained in default namespace. @@ -51,13 +49,13 @@ internal sealed class State /// For example, if default namespace is `A` and declared namespace is `A.B.C`, /// this would be `B.C`. /// - public string RelativeDeclaredNamespace { get; } + public string? RelativeDeclaredNamespace { get; } private State( Document document, SyntaxNode container, - string targetNamespace, - string relativeDeclaredNamespace) + string? targetNamespace, + string? relativeDeclaredNamespace) { Document = document; Container = container; @@ -65,7 +63,7 @@ private State( RelativeDeclaredNamespace = relativeDeclaredNamespace; } - public static async Task CreateAsync( + public static async Task CreateAsync( AbstractSyncNamespaceCodeRefactoringProvider provider, Document document, TextSpan textSpan, @@ -93,7 +91,7 @@ public static async Task CreateAsync( return null; } - var changeNamespaceService = document.GetLanguageService(); + var changeNamespaceService = document.GetRequiredLanguageService(); var canChange = await changeNamespaceService.CanChangeNamespaceAsync(document, applicableNode, cancellationToken).ConfigureAwait(false); if (!canChange || !IsDocumentPathRootedInProjectFolder(document)) @@ -101,7 +99,7 @@ public static async Task CreateAsync( return null; } - var syntaxFacts = document.GetLanguageService(); + var syntaxFacts = document.GetRequiredLanguageService(); // We can't determine what the expected namespace would be without knowing the default namespace. var defaultNamespace = GetDefaultNamespace(document, syntaxFacts); @@ -152,36 +150,40 @@ public static async Task CreateAsync( /// private static bool IsDocumentPathRootedInProjectFolder(Document document) { + var absoluteDircetoryPath = PathUtilities.GetDirectoryName(document.FilePath); + if (absoluteDircetoryPath is null) + return false; + var projectRoot = PathUtilities.GetDirectoryName(document.Project.FilePath); - var folderPath = Path.Combine(document.Folders.ToArray()); + if (projectRoot is null) + return false; - var absoluteDircetoryPath = PathUtilities.GetDirectoryName(document.FilePath); + var folderPath = Path.Combine(document.Folders.ToArray()); var logicalDirectoryPath = PathUtilities.CombineAbsoluteAndRelativePaths(projectRoot, folderPath); + if (logicalDirectoryPath is null) + return false; return PathUtilities.PathsEqual(absoluteDircetoryPath, logicalDirectoryPath); } - private static string GetDefaultNamespace(Document document, ISyntaxFactsService syntaxFacts) + private static string? GetDefaultNamespace(Document document, ISyntaxFactsService syntaxFacts) { var solution = document.Project.Solution; var linkedIds = document.GetLinkedDocumentIds(); - var documents = linkedIds.SelectAsArray(id => solution.GetDocument(id)).Add(document); + var documents = linkedIds.SelectAsArray(id => solution.GetRequiredDocument(id)).Add(document); // For all projects containing all the linked documents, bail if // 1. Any of them doesn't have default namespace, or // 2. Multiple default namespace are found. (this might be possible by tweaking project file). // The refactoring depends on a single default namespace to operate. - var defaultNamespaceFromProjects = new HashSet( + var defaultNamespaceFromProjects = new HashSet( documents.Select(d => d.Project.DefaultNamespace), syntaxFacts.StringComparer); - if (defaultNamespaceFromProjects.Count != 1 - || defaultNamespaceFromProjects.First() == null) - { + if (defaultNamespaceFromProjects.Count > 1) return null; - } - return defaultNamespaceFromProjects.Single(); + return defaultNamespaceFromProjects.SingleOrDefault(); } /// @@ -195,7 +197,7 @@ private static string GetDefaultNamespace(Document document, ISyntaxFactsService /// the relative namespace is "". /// - If is "" then the relative namespace us . /// - private static string GetRelativeNamespace(string relativeTo, string @namespace, ISyntaxFactsService syntaxFacts) + private static string? GetRelativeNamespace(string relativeTo, string @namespace, ISyntaxFactsService syntaxFacts) { Debug.Assert(relativeTo != null && @namespace != null); @@ -213,7 +215,7 @@ private static string GetRelativeNamespace(string relativeTo, string @namespace, } var containingText = relativeTo + "."; - var namespacePrefix = @namespace.Substring(0, containingText.Length); + var namespacePrefix = @namespace[..containingText.Length]; return syntaxFacts.StringComparer.Equals(containingText, namespacePrefix) ? @namespace[(relativeTo.Length + 1)..] diff --git a/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.cs b/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.cs index c76493f0ee874..95d0fb8d24e5e 100644 --- a/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.cs +++ b/src/Features/Core/Portable/CodeRefactorings/SyncNamespace/AbstractSyncNamespaceCodeRefactoringProvider.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable disable - using System; using System.Threading; using System.Threading.Tasks; @@ -69,7 +67,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte // is global namespace, i.e. default namespace is "" and the file is located at project // root directory, and no namespace declaration in the document, respectively. - var service = document.GetLanguageService(); + var service = document.GetRequiredLanguageService(); var solutionChangeAction = new ChangeNamespaceCodeAction( state.TargetNamespace.Length == 0 @@ -91,7 +89,7 @@ public override async Task ComputeRefactoringsAsync(CodeRefactoringContext conte /// declaration in global namespace and there's no namespace declaration in this document. /// (3) otherwise, null. /// - protected abstract Task TryGetApplicableInvocationNodeAsync(Document document, TextSpan span, CancellationToken cancellationToken); + protected abstract Task TryGetApplicableInvocationNodeAsync(Document document, TextSpan span, CancellationToken cancellationToken); protected abstract string EscapeIdentifier(string identifier); From 79999605e8eb1c075f7584db732aaa875e45a66e Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Thu, 31 Mar 2022 09:38:33 -0700 Subject: [PATCH 093/131] Update Spanish queue to Windows.10.Amd64.Server2022.ES.Open --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6db159e4aab55..d2a248aec0f0a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -97,7 +97,7 @@ jobs: buildJobName: Build_Windows_Release testArtifactName: Transport_Artifacts_Windows_Release configuration: Release - testArguments: -testDesktop -testArch x64 -helixQueueName Windows.10.Amd64.Server19H1.ES.Open + testArguments: -testDesktop -testArch x64 -helixQueueName Windows.10.Amd64.Server2022.ES.Open - ${{ if ne(variables['Build.Reason'], 'PullRequest') }}: - template: eng/pipelines/test-windows-job.yml From c050af9bef823f8d743832e6ac2f8a71e9176939 Mon Sep 17 00:00:00 2001 From: Manish Vasani Date: Thu, 31 Mar 2022 09:55:58 -0700 Subject: [PATCH 094/131] Fix test and review feedback --- src/Workspaces/Core/Portable/CodeActions/CodeAction.cs | 2 ++ .../Core/Portable/Shared/Extensions/TelemetryExtensions.cs | 1 - .../Extensions/TelemetryExtensions/TelemetryExtensionTests.cs | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs b/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs index 2a951ed10e939..c3eb84d293a67 100644 --- a/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs +++ b/src/Workspaces/Core/Portable/CodeActions/CodeAction.cs @@ -423,6 +423,8 @@ protected SimpleCodeAction( /// /// Indicates if this CodeAction was created using one of the 'CodeAction.Create' factory methods. + /// This is used in to determine the appropriate type + /// name to log in the CodeAction telemetry. /// public bool CreatedFromFactoryMethod { get; } } diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/TelemetryExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/TelemetryExtensions.cs index aa5cf659e9d07..e49e2aef8547e 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/TelemetryExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/TelemetryExtensions.cs @@ -6,7 +6,6 @@ using System.Globalization; using System.Linq; using Microsoft.CodeAnalysis.CodeFixes; -using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Shared.Extensions diff --git a/src/Workspaces/CoreTest/Shared/Extensions/TelemetryExtensions/TelemetryExtensionTests.cs b/src/Workspaces/CoreTest/Shared/Extensions/TelemetryExtensions/TelemetryExtensionTests.cs index 4caf1ae3d6375..2dcc610ce941b 100644 --- a/src/Workspaces/CoreTest/Shared/Extensions/TelemetryExtensions/TelemetryExtensionTests.cs +++ b/src/Workspaces/CoreTest/Shared/Extensions/TelemetryExtensions/TelemetryExtensionTests.cs @@ -15,14 +15,14 @@ public class TelemetryExtensionTests [Fact] public void TestConstantTelemetryId() { - var expected = Guid.Parse("00000000-0000-0000-c4c5-914100000000"); + var expected = Guid.Parse("00000000-0000-0000-54ad-749900000000"); var actual = typeof(TelemetryExtensionTests).GetTelemetryId(); var actualBytes = actual.ToByteArray(); // If the assertion fails then telemetry ids could be changing // making them hard to track. It's important to not regress // the ability to track telemetry across versions of Roslyn. - Assert.Equal(new Guid(actualBytes), expected); + Assert.Equal(expected, new Guid(actualBytes)); } } } From f5b5f0bfe06a1a26320cfcf971de57a9669565a7 Mon Sep 17 00:00:00 2001 From: DoctorKrolic Date: Thu, 31 Mar 2022 22:09:40 +0300 Subject: [PATCH 095/131] PR feedback --- ...ImplementInterfaceService.AccessibilityHelper.cs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs index cd14d8a5187aa..3a6c1e5608a82 100644 --- a/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs +++ b/src/Features/Core/Portable/ImplementInterface/AbstractImplementInterfaceService.AccessibilityHelper.cs @@ -31,7 +31,7 @@ public static bool IsLessAccessibleThan(ISymbol? first, INamedTypeSymbol second) switch (first) { case IPropertySymbol propertySymbol: - if (IsTypeLessAccessibleThanOtherType(propertySymbol.Type, second)) + if (IsTypeLessAccessibleThanOtherType(propertySymbol.Type, second, new())) { return true; } @@ -49,14 +49,14 @@ public static bool IsLessAccessibleThan(ISymbol? first, INamedTypeSymbol second) return false; case IMethodSymbol methodSymbol: - if (IsTypeLessAccessibleThanOtherType(methodSymbol.ReturnType, second)) + if (IsTypeLessAccessibleThanOtherType(methodSymbol.ReturnType, second, new())) { return true; } foreach (var parameter in methodSymbol.Parameters) { - if (IsTypeLessAccessibleThanOtherType(parameter.Type, second)) + if (IsTypeLessAccessibleThanOtherType(parameter.Type, second, new())) { return true; } @@ -64,7 +64,7 @@ public static bool IsLessAccessibleThan(ISymbol? first, INamedTypeSymbol second) foreach (var typeArg in methodSymbol.TypeArguments) { - if (IsTypeLessAccessibleThanOtherType(typeArg, second)) + if (IsTypeLessAccessibleThanOtherType(typeArg, second, new())) { return true; } @@ -73,21 +73,20 @@ public static bool IsLessAccessibleThan(ISymbol? first, INamedTypeSymbol second) return false; case IEventSymbol eventSymbol: - return IsTypeLessAccessibleThanOtherType(eventSymbol.Type, second); + return IsTypeLessAccessibleThanOtherType(eventSymbol.Type, second, new()); default: return false; } } - private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol? first, INamedTypeSymbol second, List? alreadyCheckingTypes = null) + private static bool IsTypeLessAccessibleThanOtherType(ITypeSymbol? first, INamedTypeSymbol second, HashSet alreadyCheckingTypes) { if (first is null) { return false; } - alreadyCheckingTypes ??= new(); alreadyCheckingTypes.Add(first); if (first is ITypeParameterSymbol typeParameter) From 71dfd2726aa86f283c4f6651512cb307d66d76ea Mon Sep 17 00:00:00 2001 From: Andrew Hall Date: Thu, 31 Mar 2022 13:21:42 -0700 Subject: [PATCH 096/131] Move StackTraceAnalyzer over to VirtualCharSequence (#60404) * Convert to using VirtualChars to reduce string allocations from the stack trace analyzer * Add benchmarks * Fixes AB#1504223 --- .../Microsoft.CodeAnalysis.Features.csproj | 1 + .../StackTraceExplorer/DefaultStackParser.cs | 4 +- .../DotnetStackFrameParser.cs | 4 +- .../StackTraceExplorer/IStackFrameParser.cs | 4 +- .../StackTraceExplorer/IgnoredFrame.cs | 9 +- .../StackTraceAnalysisResult.cs | 3 + .../StackTraceExplorer/StackTraceAnalyzer.cs | 82 +- .../VSDebugCallstackParser.cs | 19 +- .../StackTraceExplorerBenchmarks.cs | 1770 +++++++++++++++++ 9 files changed, 1871 insertions(+), 25 deletions(-) create mode 100644 src/Tools/IdeBenchmarks/StackTraceExplorer/StackTraceExplorerBenchmarks.cs diff --git a/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj b/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj index c3a347c1f3ec7..8be2c42729317 100644 --- a/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj +++ b/src/Features/Core/Portable/Microsoft.CodeAnalysis.Features.csproj @@ -57,6 +57,7 @@ + + + diff --git a/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs b/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs index 7c0fe97b4ecca..5e5aa7687a5c4 100644 --- a/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs +++ b/src/Compilers/CSharp/Portable/FlowAnalysis/NullableWalker.cs @@ -3885,13 +3885,12 @@ private int GetOrCreatePlaceholderSlot(object identifier, TypeWithAnnotations ty return null; } - bool isInferred = node.Syntax.Kind() == SyntaxKind.ImplicitArrayCreationExpression; - var arrayType = VisitArrayInitialization(node.Type, isInferred, initialization, node.HasErrors); + var arrayType = VisitArrayInitialization(node.Type, initialization, node.HasErrors); SetResultType(node, TypeWithState.Create(arrayType, NullableFlowState.NotNull)); return null; } - private TypeSymbol VisitArrayInitialization(TypeSymbol type, bool isInferred, BoundArrayInitialization initialization, bool hasErrors) + private TypeSymbol VisitArrayInitialization(TypeSymbol type, BoundArrayInitialization initialization, bool hasErrors) { TakeIncrementalSnapshot(initialization); var expressions = ArrayBuilder.GetInstance(initialization.Initializers.Length); @@ -3909,7 +3908,7 @@ private TypeSymbol VisitArrayInitialization(TypeSymbol type, bool isInferred, Bo }; var resultType = type; - if (!isInferred) + if (!initialization.IsInferred) { foreach (var expr in expressions) { @@ -10752,8 +10751,7 @@ protected override void VisitInterpolatedStringHandlerConstructor(BoundExpressio } Debug.Assert(node.Type is not null); - bool isInferred = node.Syntax.Kind() == SyntaxKind.ImplicitStackAllocArrayCreationExpression; - var type = VisitArrayInitialization(node.Type, isInferred, initialization, node.HasErrors); + var type = VisitArrayInitialization(node.Type, initialization, node.HasErrors); SetResultType(node, TypeWithState.Create(type, NullableFlowState.NotNull)); return null; } diff --git a/src/Compilers/CSharp/Portable/Generated/BoundNodes.xml.Generated.cs b/src/Compilers/CSharp/Portable/Generated/BoundNodes.xml.Generated.cs index af98de7773ece..7ab4a23dcdfc8 100644 --- a/src/Compilers/CSharp/Portable/Generated/BoundNodes.xml.Generated.cs +++ b/src/Compilers/CSharp/Portable/Generated/BoundNodes.xml.Generated.cs @@ -7054,27 +7054,30 @@ public BoundArrayCreation Update(ImmutableArray bounds, BoundAr internal sealed partial class BoundArrayInitialization : BoundExpression { - public BoundArrayInitialization(SyntaxNode syntax, ImmutableArray initializers, bool hasErrors = false) + public BoundArrayInitialization(SyntaxNode syntax, bool isInferred, ImmutableArray initializers, bool hasErrors = false) : base(BoundKind.ArrayInitialization, syntax, null, hasErrors || initializers.HasErrors()) { RoslynDebug.Assert(!initializers.IsDefault, "Field 'initializers' cannot be null (use Null=\"allow\" in BoundNodes.xml to remove this check)"); + this.IsInferred = isInferred; this.Initializers = initializers; } public new TypeSymbol? Type => base.Type; + public bool IsInferred { get; } + public ImmutableArray Initializers { get; } [DebuggerStepThrough] public override BoundNode? Accept(BoundTreeVisitor visitor) => visitor.VisitArrayInitialization(this); - public BoundArrayInitialization Update(ImmutableArray initializers) + public BoundArrayInitialization Update(bool isInferred, ImmutableArray initializers) { - if (initializers != this.Initializers) + if (isInferred != this.IsInferred || initializers != this.Initializers) { - var result = new BoundArrayInitialization(this.Syntax, initializers, this.HasErrors); + var result = new BoundArrayInitialization(this.Syntax, isInferred, initializers, this.HasErrors); result.CopyAttributes(this); return result; } @@ -11671,7 +11674,7 @@ internal abstract partial class BoundTreeRewriter : BoundTreeVisitor { ImmutableArray initializers = this.VisitList(node.Initializers); TypeSymbol? type = this.VisitType(node.Type); - return node.Update(initializers); + return node.Update(node.IsInferred, initializers); } public override BoundNode? VisitStackAllocArrayCreation(BoundStackAllocArrayCreation node) { @@ -13949,12 +13952,12 @@ public NullabilityRewriter(ImmutableDictionary new TreeDumperNode("arrayInitialization", null, new TreeDumperNode[] { + new TreeDumperNode("isInferred", node.IsInferred, null), new TreeDumperNode("initializers", null, from x in node.Initializers select Visit(x, null)), new TreeDumperNode("type", node.Type, null), new TreeDumperNode("isSuppressed", node.IsSuppressed, null), diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs index e5c7af97c517c..c721939835811 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Call.cs @@ -1108,7 +1108,7 @@ private static BoundExpression CreateParamArrayArgument(SyntaxNode syntax, return new BoundArrayCreation( syntax, ImmutableArray.Create(arraySize), - new BoundArrayInitialization(syntax, arrayArgs) { WasCompilerGenerated = true }, + new BoundArrayInitialization(syntax, isInferred: false, arrayArgs) { WasCompilerGenerated = true }, paramArrayType) { WasCompilerGenerated = true }; } diff --git a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs index a221190fe0d1e..ad2fc09b1bd38 100644 --- a/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs +++ b/src/Compilers/CSharp/Portable/Lowering/SyntheticBoundNodeFactory.cs @@ -1357,7 +1357,7 @@ public BoundExpression Array(TypeSymbol elementType, ImmutableArray(Literal(elements.Length)), - new BoundArrayInitialization(Syntax, elements) { WasCompilerGenerated = true }, + new BoundArrayInitialization(Syntax, isInferred: false, elements) { WasCompilerGenerated = true }, Compilation.CreateArrayTypeSymbol(elementType)); } diff --git a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Rewriters/LocalDeclarationRewriter.cs b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Rewriters/LocalDeclarationRewriter.cs index eac363440360d..28debd342d1a9 100644 --- a/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Rewriters/LocalDeclarationRewriter.cs +++ b/src/ExpressionEvaluator/CSharp/Source/ExpressionCompiler/Rewriters/LocalDeclarationRewriter.cs @@ -161,7 +161,7 @@ private static BoundExpression GetCustomTypeInfoPayload(LocalSymbol local, Synta return new BoundArrayCreation( syntax, ImmutableArray.Create(lengthExpr), - new BoundArrayInitialization(syntax, initializerExprs.ToImmutableAndFree()), + new BoundArrayInitialization(syntax, isInferred: false, initializerExprs.ToImmutableAndFree()), byteArrayType); } } From 6888cd64fd590ed8a3c66fcda9804ab8d6e08b98 Mon Sep 17 00:00:00 2001 From: Julien Couvreur Date: Thu, 31 Mar 2022 16:48:25 -0700 Subject: [PATCH 099/131] Document ROSLYN_TEST_USEDASSEMBLIES (#60478) --- .../Building, Debugging, and Testing on Windows.md | 14 ++++++++++++++ eng/build.ps1 | 2 +- .../Test/Core/Compilation/CompilationExtensions.cs | 14 +++++++++----- .../Test/Utilities/CSharp/CSharpTestBase.cs | 1 + 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/docs/contributing/Building, Debugging, and Testing on Windows.md b/docs/contributing/Building, Debugging, and Testing on Windows.md index 1536f77e8e3d1..5e1e5ee638512 100644 --- a/docs/contributing/Building, Debugging, and Testing on Windows.md +++ b/docs/contributing/Building, Debugging, and Testing on Windows.md @@ -196,6 +196,20 @@ See more details in the [IOperation test hook](https://github.com/dotnet/roslyn/ `C:\Source\roslyn> cd ..` `C:\Source> dotnet-format analyzers .\roslyn\Compilers.sln --diagnostics=RS0016 --no-restore --include-generated -v diag` +## Replicating Failures in the Used Assemblies leg + +In order to replicate test failures in that leg, there are a few options: + +1. Uncomment `src/Compilers/Test/Core/Compilation/CompilationExtensions.cs:9`, which defines `ROSLYN_TEST_USEDASSEMBLIES`, and run your tests. Do _not_ check this in, as it +will enable the test hook for every test in every project and significantly slow down regular test runs. +2. Set the `ROSLYN_TEST_USEDASSEMBLIES` environment variable and restart VS with it set. +3. Set a breakpoint at the start of `CSharpTestBase.VerifyUsedAssemblyReferences` in `src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs`. When it breaks, use VS's jump to location or +drag the instruction pointer past the early check and return on `EnableVerifyUsedAssemblies`. + +When a test failure is isolated, please add a _dedicated_ test for this (ie. failing even when the Used Assemblies validation isn't enabled) to make it easier to avoid future regressions. +Preferrably, don't replicate the entire original test, just enough to hit the bug to ensure that it's protected against regressions. +Before pushing a relevant fix to CI, you can validate locally using the `-testUsedAssemblies` command-line option for `build.cmd`. For example: `build.cmd -testCoreClr -testCompilerOnly -testUsedAssemblies`. + ## Contributing Please see [Contributing Code](https://github.com/dotnet/roslyn/blob/main/CONTRIBUTING.md) for details on contributing changes back to the code. diff --git a/eng/build.ps1 b/eng/build.ps1 index 028c793adf182..8cb1c38bab99d 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -98,7 +98,7 @@ function Print-Usage() { Write-Host " -testCompilerOnly Run only the compiler unit tests" Write-Host " -testVsi Run all integration tests" Write-Host " -testIOperation Run extra checks to validate IOperations" - Write-Host " -testUsedAssemblies Run extra checks to validate used assemblies feature" + Write-Host " -testUsedAssemblies Run extra checks to validate used assemblies feature (see ROSLYN_TEST_USEDASSEMBLIES in codebase)" Write-Host "" Write-Host "Advanced settings:" Write-Host " -ci Set when running on CI server" diff --git a/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs b/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs index b32953150b1a8..b09de6ec1964e 100644 --- a/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs +++ b/src/Compilers/Test/Core/Compilation/CompilationExtensions.cs @@ -6,15 +6,16 @@ // Uncomment to enable the IOperation test hook on all test runs. Do not commit this uncommented. //#define ROSLYN_TEST_IOPERATION +// Uncomment to enable the Used Assemblies test hook on all test runs. Do not commit this uncommented. +//#define ROSLYN_TEST_USEDASSEMBLIES + using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.IO; using System.Linq; -using System.Reflection.Metadata; using System.Text; -using System.Text.RegularExpressions; using System.Threading; using Microsoft.CodeAnalysis.CodeGen; using Microsoft.CodeAnalysis.CSharp; @@ -22,11 +23,9 @@ using Microsoft.CodeAnalysis.FlowAnalysis; using Microsoft.CodeAnalysis.Operations; using Microsoft.CodeAnalysis.PooledObjects; -using Microsoft.CodeAnalysis.Symbols; using Roslyn.Test.Utilities; using Roslyn.Utilities; using Xunit; -using Xunit.Sdk; namespace Microsoft.CodeAnalysis.Test.Utilities { @@ -39,7 +38,12 @@ public static class CompilationExtensions !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ROSLYN_TEST_IOPERATION")); #endif - internal static bool EnableVerifyUsedAssemblies { get; } = !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ROSLYN_TEST_USEDASSEMBLIES")); + internal static bool EnableVerifyUsedAssemblies { get; } = +#if ROSLYN_TEST_USEDASSEMBLIES + true; +#else + !string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ROSLYN_TEST_USEDASSEMBLIES")); +#endif internal static ImmutableArray EmitToArray( this Compilation compilation, diff --git a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs index 7ec96c09388a9..69bfc90a919a4 100644 --- a/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs +++ b/src/Compilers/Test/Utilities/CSharp/CSharpTestBase.cs @@ -1210,6 +1210,7 @@ private static void ValidateCompilation(Func createCompilatio private static void VerifyUsedAssemblyReferences(Func createCompilationLambda) { + // To run the additional validation below, comment this out or define ROSLYN_TEST_USEDASSEMBLIES if (!CompilationExtensions.EnableVerifyUsedAssemblies) { return; From 2feed2549f8255d9675abd13bbdd674a67bfde67 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Wed, 30 Mar 2022 19:45:34 -0700 Subject: [PATCH 100/131] Fix merge --- .../SpellCheck/AbstractSpellCheckingHandler.cs | 17 ----------------- .../SpellCheck/WorkspaceSpellCheckHandler.cs | 8 ++++++++ 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/src/Features/LanguageServer/Protocol/Handler/SpellCheck/AbstractSpellCheckingHandler.cs b/src/Features/LanguageServer/Protocol/Handler/SpellCheck/AbstractSpellCheckingHandler.cs index 4a84a4b01a4a6..f7f8a29abfb4a 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SpellCheck/AbstractSpellCheckingHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SpellCheck/AbstractSpellCheckingHandler.cs @@ -97,12 +97,6 @@ protected AbstractSpellCheckHandler() continue; } - if (!IncludeDocument(document, context.ClientName)) - { - context.TraceInformation($"Ignoring document '{document.FilePath}' because of razor/client-name mismatch"); - continue; - } - var newResultId = await _versionedCache.GetNewResultIdAsync( documentToPreviousParams, document, @@ -132,17 +126,6 @@ protected AbstractSpellCheckHandler() return progress.GetValues(); } - private static bool IncludeDocument(Document document, string? clientName) - { - // Documents either belong to Razor or not. We can determine this by checking if the doc has a span-mapping - // service or not. If we're not in razor, we do not include razor docs. If we are in razor, we only - // include razor docs. - var isRazorDoc = document.IsRazorDocument(); - var wantsRazorDoc = clientName != null; - - return wantsRazorDoc == isRazorDoc; - } - private static Dictionary GetDocumentToPreviousParams( RequestContext context, ImmutableArray previousResults) { diff --git a/src/Features/LanguageServer/Protocol/Handler/SpellCheck/WorkspaceSpellCheckHandler.cs b/src/Features/LanguageServer/Protocol/Handler/SpellCheck/WorkspaceSpellCheckHandler.cs index f873faf4339e2..3101c1cd3d2a3 100644 --- a/src/Features/LanguageServer/Protocol/Handler/SpellCheck/WorkspaceSpellCheckHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/SpellCheck/WorkspaceSpellCheckHandler.cs @@ -5,6 +5,7 @@ using System.Collections.Immutable; using System.Linq; using System.Threading; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Api; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.VisualStudio.LanguageServer.Protocol; using Roslyn.Utilities; @@ -83,6 +84,13 @@ void AddDocumentsFromProject(Project? project, ImmutableArray supportedL continue; } + // Do not attempt to get spell check results for Razor files, Razor will directly ask us for document based results + // for any razor file they are interested in. + if (document.IsRazorDocument()) + { + continue; + } + result.Add(document); } } From 23f20620218aa6da867b3241fef5c64322b34b60 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Fri, 1 Apr 2022 15:56:09 -0700 Subject: [PATCH 101/131] Use isInferred: false when creating BoundArrayInitialization in CreateUTF8ByteRepresentation --- .../LocalRewriter/LocalRewriter_Conversion.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs index 6ef1742a0e41b..99129386d182b 100644 --- a/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs +++ b/src/Compilers/CSharp/Portable/Lowering/LocalRewriter/LocalRewriter_Conversion.cs @@ -163,7 +163,7 @@ private BoundExpression CreateUTF8ByteRepresentation(SyntaxNode resultSyntax, Sy var utf8Bytes = new BoundArrayCreation( resultSyntax, ImmutableArray.Create(_factory.Literal(builder.Count)), - new BoundArrayInitialization(resultSyntax, builder.ToImmutableAndFree()), + new BoundArrayInitialization(resultSyntax, isInferred: false, builder.ToImmutableAndFree()), byteArray); return utf8Bytes; } @@ -280,9 +280,9 @@ private BoundExpression MakeConversionNodeCore( Debug.Assert(rewrittenOperand.Type is { }); // Spec 6.1.1: - // An identity conversion converts from any type to the same type. + // An identity conversion converts from any type to the same type. // This conversion exists such that an entity that already has a required type can be said to be convertible to that type. - // Because object and dynamic are considered equivalent there is an identity conversion between object and dynamic, + // Because object and dynamic are considered equivalent there is an identity conversion between object and dynamic, // and between constructed types that are the same when replacing all occurrences of dynamic with object. // Why ignoreDynamic: false? @@ -415,8 +415,8 @@ private BoundExpression MakeConversionNodeCore( } case ConversionKind.ImplicitEnumeration: - // A conversion from constant zero to nullable is actually classified as an - // implicit enumeration conversion, not an implicit nullable conversion. + // A conversion from constant zero to nullable is actually classified as an + // implicit enumeration conversion, not an implicit nullable conversion. // Lower it to (E?)(E)0. if (rewrittenType.IsNullableType()) { @@ -465,7 +465,7 @@ private BoundExpression MakeConversionNodeCore( { // This is where we handle conversion from Decimal to Enum: e.g., E e = (E) d; // where 'e' is of type Enum E and 'd' is of type Decimal. - // Conversion can be simply done by applying its underlying numeric type to RewriteDecimalConversion(). + // Conversion can be simply done by applying its underlying numeric type to RewriteDecimalConversion(). Debug.Assert(rewrittenType.IsEnumType()); var underlyingTypeTo = rewrittenType.GetEnumUnderlyingType()!; @@ -593,7 +593,7 @@ bool IsInRange(SpecialType type, SpecialType low, SpecialType high) => SpecialType sourceST = GetUnderlyingSpecialType(source); SpecialType targetST = GetUnderlyingSpecialType(target); - // integral to double or float is never checked, but float/double to integral + // integral to double or float is never checked, but float/double to integral // may be checked. return (explicitCastInCode || sourceST != targetST) && IsInRange(sourceST, SpecialType.System_Char, SpecialType.System_Double) && @@ -675,17 +675,17 @@ private BoundExpression MakeConversionNode( // However, it is possible that we have cached a conversion (for example, to be used // in an increment or decrement operator) and are only just realizing it now. // - // Due to an oddity in the way we create a non-lifted user-defined conversion from A to D? - // (required backwards compatibility with the native compiler) we can end up in a situation + // Due to an oddity in the way we create a non-lifted user-defined conversion from A to D? + // (required backwards compatibility with the native compiler) we can end up in a situation // where we have: // // a standard conversion from A to B? // then a standard conversion from B? to B // then a user-defined conversion from B to C - // then a standard conversion from C to C? + // then a standard conversion from C to C? // then a standard conversion from C? to D? // - // In that scenario, the "from type" of the conversion will be B? and the "from conversion" will be + // In that scenario, the "from type" of the conversion will be B? and the "from conversion" will be // from A to B?. Similarly the "to type" of the conversion will be C? and the "to conversion" // of the conversion will be from C? to D?. We still need to induce the conversions from B? to B // and from C to C?. @@ -880,7 +880,7 @@ private BoundExpression RewriteNullableConversion( } else if (rewrittenType.IsNullableType()) { - // SPEC: If the nullable conversion is from S to T?, the conversion is + // SPEC: If the nullable conversion is from S to T?, the conversion is // SPEC: evaluated as the underlying conversion from S to T followed // SPEC: by a wrapping from T to T?. @@ -901,7 +901,7 @@ private BoundExpression RewriteNullableConversion( BoundExpression? value = NullableAlwaysHasValue(rewrittenOperand); if (value == null) { - // (If the source is known to be possibly null then we need to keep the call to get Value + // (If the source is known to be possibly null then we need to keep the call to get Value // in place so that it throws at runtime.) MethodSymbol get_Value = UnsafeGetNullableMethod(syntax, rewrittenOperandType, SpecialMember.System_Nullable_T_get_Value); value = BoundCall.Synthesized(syntax, rewrittenOperand, get_Value); @@ -1040,7 +1040,7 @@ private BoundExpression RewriteFullyLiftedBuiltInConversion( return new BoundDefaultExpression(syntax, type); } - // If the converted expression is known to never be null then we can return + // If the converted expression is known to never be null then we can return // new R?(op_Whatever(nonNullableValue)) BoundExpression? nonNullValue = NullableAlwaysHasValue(operand); if (nonNullValue != null) @@ -1218,7 +1218,7 @@ private BoundExpression RewriteLiftedUserDefinedConversion( return BoundConversion.Synthesized(syntax, rewrittenOperand, conv, @checked: @checked, explicitCastInCode: true, conversionGroupOpt: null, constantValueOpt: null, rewrittenType); } - // DELIBERATE SPEC VIOLATION: + // DELIBERATE SPEC VIOLATION: // The native compiler allows for a "lifted" conversion even when the return type of the conversion // not a non-nullable value type. For example, if we have a conversion from struct S to string, // then a "lifted" conversion from S? to string is considered by the native compiler to exist, @@ -1234,7 +1234,7 @@ private BoundExpression RewriteLiftedUserDefinedConversion( return optimized; } - // We have no optimizations we can perform. If the return type of the + // We have no optimizations we can perform. If the return type of the // conversion method is a non-nullable value type R then we lower this as: // // temp = operand From 4f4fe66149aae8ca546efd26df609bf773e3cdc8 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Fri, 1 Apr 2022 16:10:18 -0700 Subject: [PATCH 102/131] Update Language Feature Status.md (#60482) --- docs/Language Feature Status.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Language Feature Status.md b/docs/Language Feature Status.md index cfa43ae675dde..036073c51e956 100644 --- a/docs/Language Feature Status.md +++ b/docs/Language Feature Status.md @@ -30,7 +30,7 @@ efforts behind them. | [ref fields](https://github.com/dotnet/csharplang/blob/main/proposals/low-level-struct-improvements.md) | [ref-fields](https://github.com/dotnet/roslyn/tree/features/ref-fields) | [In Progress](https://github.com/dotnet/roslyn/issues/59194) | [cston](https://github.com/cston) | [RikkiGibson](https://github.com/RikkiGibson), [AlekseyTs](https://github.com/AlekseyTs) | [jaredpar](https://github.com/jaredpar) | | [Checked Operators](https://github.com/dotnet/csharplang/issues/4665) | [CheckedUserDefinedOperators](https://github.com/dotnet/roslyn/tree/features/CheckedUserDefinedOperators) | [In Progress](https://github.com/dotnet/roslyn/issues/59458) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [chsienki](https://github.com/chsienki) | [AlekseyTs](https://github.com/AlekseyTs) | | [auto-default structs](https://github.com/dotnet/csharplang/issues/5737) | main | [In Progress](https://github.com/dotnet/roslyn/issues/60167) | [RikkiGibson](https://github.com/RikkiGibson) | [cston](https://github.com/cston), [jcouv](https://github.com/jcouv) | -| [Unsigned Right Shift](https://github.com/dotnet/csharplang/issues/4682) | [UnsignedRightShift](https://github.com/dotnet/roslyn/tree/features/UnsignedRightShift) | [In Progress](https://github.com/dotnet/roslyn/issues/60433) | [AlekseyTs](https://github.com/AlekseyTs) | TBD | [AlekseyTs](https://github.com/AlekseyTs) | +| [Unsigned Right Shift](https://github.com/dotnet/csharplang/issues/4682) | [UnsignedRightShift](https://github.com/dotnet/roslyn/tree/features/UnsignedRightShift) | [In Progress](https://github.com/dotnet/roslyn/issues/60433) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs) | # C# 10.0 From 087bc2c4e3adcfe54b5592ca32b984c3be08fbac Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Fri, 1 Apr 2022 16:57:50 +0200 Subject: [PATCH 103/131] Move few 'CodeFixProvider's to Analyzers layer --- .../AddExplicitCastCodeFixProvider.cs | 0 .../AddExplicitCast/ArgumentFixer.cs | 0 .../AddExplicitCast/AttributeArgumentFixer.cs | 0 .../AddInheritdocCodeFixProvider.cs | 14 +++-- ...harpAddObsoleteAttributeCodeFixProvider.cs | 2 +- ...CSharpAliasAmbiguousTypeCodeFixProvider.cs | 0 .../CodeFixes/CSharpCodeFixes.projitems | 21 ++++++- .../CodeFixes/CSharpCodeFixesResources.resx | 37 ++++++++++++ ...DisambiguateSameVariableCodeFixProvider.cs | 6 +- .../CSharpFixReturnTypeCodeFixProvider.cs | 4 +- ...BaseCodeFixProvider.AddNewKeywordAction.cs | 20 +++++-- .../HideBase/HideBaseCodeFixProvider.cs | 0 .../Iterator/CSharpAddYieldCodeFixProvider.cs | 4 +- ...SharpChangeToIEnumerableCodeFixProvider.cs | 4 +- .../CSharpMakeMemberStaticCodeFixProvider.cs | 0 ...akeStatementAsynchronousCodeFixProvider.cs | 6 +- .../CSharpMakeTypeAbstractCodeFixProvider.cs | 0 .../CSharpDeclareAsNullableCodeFixProvider.cs | 4 +- .../CSharpUnsealClassCodeFixProvider.cs | 2 +- ...terpolatedVerbatimStringCodeFixProvider.cs | 4 +- .../CSharpUseLocalFunctionCodeFixProvider.cs | 5 ++ .../xlf/CSharpCodeFixesResources.cs.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.de.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.es.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.fr.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.it.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.ja.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.ko.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.pl.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.pt-BR.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.ru.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.tr.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.zh-Hans.xlf | 60 +++++++++++++++++++ .../xlf/CSharpCodeFixesResources.zh-Hant.xlf | 60 +++++++++++++++++++ .../AddExplicitCast/AddExplicitCastTests.cs | 18 +++--- .../AddExplicitCastTests_FixAllTests.cs | 0 .../Tests/CSharpAnalyzers.UnitTests.projitems | 2 + .../Core/Analyzers/AnalyzersResources.resx | 2 +- .../AbstractAddExplicitCastCodeFixProvider.cs | 27 +++------ .../Core}/CodeFixes/AddExplicitCast/Fixer.cs | 0 .../InheritanceDistanceComparer.cs | 0 ...ractAddObsoleteAttributeCodeFixProvider.cs | 2 +- ...stractAliasAmbiguousTypeCodeFixProvider.cs | 12 ++-- .../Core/CodeFixes/CodeFixes.projitems | 9 +++ .../Core/CodeFixes/CodeFixesResources.resx | 15 +++++ .../AbstractIteratorCodeFixProvider.cs | 0 ...AbstractMakeMemberStaticCodeFixProvider.cs | 4 +- ...AbstractMakeTypeAbstractCodeFixProvider.cs | 4 +- .../AbstractUnsealClassCodeFixProvider.cs | 6 +- .../CodeFixes/xlf/CodeFixesResources.cs.xlf | 25 ++++++++ .../CodeFixes/xlf/CodeFixesResources.de.xlf | 25 ++++++++ .../CodeFixes/xlf/CodeFixesResources.es.xlf | 25 ++++++++ .../CodeFixes/xlf/CodeFixesResources.fr.xlf | 25 ++++++++ .../CodeFixes/xlf/CodeFixesResources.it.xlf | 25 ++++++++ .../CodeFixes/xlf/CodeFixesResources.ja.xlf | 25 ++++++++ .../CodeFixes/xlf/CodeFixesResources.ko.xlf | 25 ++++++++ .../CodeFixes/xlf/CodeFixesResources.pl.xlf | 25 ++++++++ .../xlf/CodeFixesResources.pt-BR.xlf | 25 ++++++++ .../CodeFixes/xlf/CodeFixesResources.ru.xlf | 25 ++++++++ .../CodeFixes/xlf/CodeFixesResources.tr.xlf | 25 ++++++++ .../xlf/CodeFixesResources.zh-Hans.xlf | 25 ++++++++ .../xlf/CodeFixesResources.zh-Hant.xlf | 25 ++++++++ .../AddExplicitCast/ArgumentFixer.vb | 0 ...sualBasicAddExplicitCastCodeFixProvider.vb | 0 ...asicAddObsoleteAttributeCodeFixProvider.vb | 2 +- ...lBasicAliasAmbiguousTypeCodeFixProvider.vb | 0 ...VisualBasicChangeToYieldCodeFixProvider.vb | 4 +- ...alBasicConvertToIteratorCodeFixProvider.vb | 6 +- ...ualBasicMakeTypeAbstractCodeFixProvider.vb | 0 .../VisualBasicUnsealClassCodeFixProvider.vb | 2 +- .../CodeFixes/VisualBasicCodeFixes.projitems | 8 +++ .../VisualBasicCodeFixesResources.resx | 12 ++++ .../xlf/VisualBasicCodeFixesResources.cs.xlf | 20 +++++++ .../xlf/VisualBasicCodeFixesResources.de.xlf | 20 +++++++ .../xlf/VisualBasicCodeFixesResources.es.xlf | 20 +++++++ .../xlf/VisualBasicCodeFixesResources.fr.xlf | 20 +++++++ .../xlf/VisualBasicCodeFixesResources.it.xlf | 20 +++++++ .../xlf/VisualBasicCodeFixesResources.ja.xlf | 20 +++++++ .../xlf/VisualBasicCodeFixesResources.ko.xlf | 20 +++++++ .../xlf/VisualBasicCodeFixesResources.pl.xlf | 20 +++++++ .../VisualBasicCodeFixesResources.pt-BR.xlf | 20 +++++++ .../xlf/VisualBasicCodeFixesResources.ru.xlf | 20 +++++++ .../xlf/VisualBasicCodeFixesResources.tr.xlf | 20 +++++++ .../VisualBasicCodeFixesResources.zh-Hans.xlf | 20 +++++++ .../VisualBasicCodeFixesResources.zh-Hant.xlf | 20 +++++++ .../AddExplicitCast/AddExplicitCastTests.vb | 14 ++--- .../AddExplicitCastTests_FixAllTests.vb | 0 .../VisualBasicAnalyzers.UnitTests.projitems | 2 + .../Portable/CSharpFeaturesResources.resx | 35 ++--------- .../xlf/CSharpFeaturesResources.cs.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.de.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.es.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.fr.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.it.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.ja.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.ko.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.pl.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.pt-BR.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.ru.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.tr.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.zh-Hans.xlf | 47 +-------------- .../xlf/CSharpFeaturesResources.zh-Hant.xlf | 47 +-------------- .../Core/Portable/FeaturesResources.resx | 23 +------ ...ctImplementAbstractClassCodeFixProvider.cs | 2 +- .../AbstractUseAutoPropertyCodeFixProvider.cs | 10 +++- .../Portable/xlf/FeaturesResources.cs.xlf | 35 ----------- .../Portable/xlf/FeaturesResources.de.xlf | 35 ----------- .../Portable/xlf/FeaturesResources.es.xlf | 35 ----------- .../Portable/xlf/FeaturesResources.fr.xlf | 35 ----------- .../Portable/xlf/FeaturesResources.it.xlf | 35 ----------- .../Portable/xlf/FeaturesResources.ja.xlf | 35 ----------- .../Portable/xlf/FeaturesResources.ko.xlf | 35 ----------- .../Portable/xlf/FeaturesResources.pl.xlf | 35 ----------- .../Portable/xlf/FeaturesResources.pt-BR.xlf | 35 ----------- .../Portable/xlf/FeaturesResources.ru.xlf | 35 ----------- .../Portable/xlf/FeaturesResources.tr.xlf | 35 ----------- .../xlf/FeaturesResources.zh-Hans.xlf | 35 ----------- .../xlf/FeaturesResources.zh-Hant.xlf | 35 ----------- .../Portable/VBFeaturesResources.resx | 12 ---- .../Portable/xlf/VBFeaturesResources.cs.xlf | 20 ------- .../Portable/xlf/VBFeaturesResources.de.xlf | 20 ------- .../Portable/xlf/VBFeaturesResources.es.xlf | 20 ------- .../Portable/xlf/VBFeaturesResources.fr.xlf | 20 ------- .../Portable/xlf/VBFeaturesResources.it.xlf | 20 ------- .../Portable/xlf/VBFeaturesResources.ja.xlf | 20 ------- .../Portable/xlf/VBFeaturesResources.ko.xlf | 20 ------- .../Portable/xlf/VBFeaturesResources.pl.xlf | 20 ------- .../xlf/VBFeaturesResources.pt-BR.xlf | 20 ------- .../Portable/xlf/VBFeaturesResources.ru.xlf | 20 ------- .../Portable/xlf/VBFeaturesResources.tr.xlf | 20 ------- .../xlf/VBFeaturesResources.zh-Hans.xlf | 20 ------- .../xlf/VBFeaturesResources.zh-Hant.xlf | 20 ------- .../Shared/Extensions/IListExtensions.cs | 29 --------- .../Extensions/IMethodSymbolExtensions.cs | 21 ------- .../Shared/Extensions/ISymbolExtensions.cs | 11 ---- .../Shared/Extensions/SourceTextExtensions.cs | 18 ------ .../Core/Portable/WorkspacesResources.resx | 33 ---------- .../Portable/xlf/WorkspacesResources.cs.xlf | 55 ----------------- .../Portable/xlf/WorkspacesResources.de.xlf | 55 ----------------- .../Portable/xlf/WorkspacesResources.es.xlf | 55 ----------------- .../Portable/xlf/WorkspacesResources.fr.xlf | 55 ----------------- .../Portable/xlf/WorkspacesResources.it.xlf | 55 ----------------- .../Portable/xlf/WorkspacesResources.ja.xlf | 55 ----------------- .../Portable/xlf/WorkspacesResources.ko.xlf | 55 ----------------- .../Portable/xlf/WorkspacesResources.pl.xlf | 55 ----------------- .../xlf/WorkspacesResources.pt-BR.xlf | 55 ----------------- .../Portable/xlf/WorkspacesResources.ru.xlf | 55 ----------------- .../Portable/xlf/WorkspacesResources.tr.xlf | 55 ----------------- .../xlf/WorkspacesResources.zh-Hans.xlf | 55 ----------------- .../xlf/WorkspacesResources.zh-Hant.xlf | 55 ----------------- .../Extensions/IMethodSymbolExtensions.cs | 23 +++++++ .../Core/Extensions/ISymbolExtensions.cs | 17 ++++++ .../Core/Extensions/ListExtensions.cs | 16 +++++ ...ourceTextExtensions_SharedWithCodeStyle.cs | 19 ++++++ .../CSharpWorkspaceExtensions.projitems | 25 ++++++++ .../CodeGeneration/ArgumentGenerator.cs | 0 .../CodeGeneration/AttributeGenerator.cs | 0 .../CSharpCodeGenerationHelpers.cs | 0 .../CSharpCodeGenerationOptions.cs | 0 .../CSharpCodeGenerationPreferences.cs | 7 ++- .../CSharpCodeGenerationService.cs | 7 ++- .../CSharpCodeGenerationServiceFactory.cs | 0 .../CSharpDeclarationComparer.cs | 0 .../CSharpFlagsEnumGenerator.cs | 0 .../CodeGeneration/CSharpSyntaxGenerator.cs | 0 .../CodeGeneration/ConstructorGenerator.cs | 0 .../CodeGeneration/ConversionGenerator.cs | 0 .../CodeGeneration/DestructorGenerator.cs | 0 .../CodeGeneration/EnumMemberGenerator.cs | 0 .../CSharp}/CodeGeneration/EventGenerator.cs | 0 .../CodeGeneration/ExpressionGenerator.cs | 0 .../CSharp}/CodeGeneration/FieldGenerator.cs | 0 .../CSharp}/CodeGeneration/MethodGenerator.cs | 0 .../CodeGeneration/NamedTypeGenerator.cs | 0 .../CodeGeneration/NamespaceGenerator.cs | 0 .../CodeGeneration/OperatorGenerator.cs | 0 .../CodeGeneration/ParameterGenerator.cs | 0 .../CodeGeneration/PropertyGenerator.cs | 0 .../CodeGeneration/StatementGenerator.cs | 0 .../CodeGeneration/TypeParameterGenerator.cs | 0 .../CSharpAddImportsService.cs | 11 +++- .../AbstractCodeGenerationService.cs | 32 ++++++---- ...ctCodeGenerationService_FindDeclaration.cs | 2 +- .../AbstractFlagsEnumGenerator.cs | 0 .../CodeGeneration/CodeGenerationContext.cs | 2 +- .../CodeGenerationDestination.cs | 0 .../CodeGeneration/CodeGenerationHelpers.cs | 4 +- .../CodeGenerationOperatorKind.cs | 0 .../CodeGeneration/CodeGenerationOptions.cs | 0 .../CodeGenerationPreferences.cs | 10 +++- .../CodeGenerationSymbolFactory.cs | 11 +++- .../Core}/CodeGeneration/CodeGenerator.cs | 0 .../CodeGeneration/ICodeGenerationService.cs | 8 ++- .../INamedTypeSymbolExtensions.cs | 0 .../Core/CodeGeneration}/ITypeGenerator.cs | 0 .../CodeGeneration/LiteralSpecialValues.cs | 0 .../NullableSyntaxAnnotation.cs | 0 .../CodeGenerationAbstractMethodSymbol.cs | 5 ++ .../CodeGenerationAbstractNamedTypeSymbol.cs | 5 ++ .../Symbols/CodeGenerationArrayTypeSymbol.cs | 0 .../Symbols/CodeGenerationAttributeData.cs | 0 .../CodeGenerationConstructedMethodSymbol.cs | 0 ...odeGenerationConstructedNamedTypeSymbol.cs | 0 .../Symbols/CodeGenerationConstructorInfo.cs | 0 .../CodeGenerationConstructorSymbol.cs | 5 ++ .../Symbols/CodeGenerationConversionSymbol.cs | 5 ++ .../Symbols/CodeGenerationDestructorInfo.cs | 0 .../Symbols/CodeGenerationDestructorSymbol.cs | 0 .../Symbols/CodeGenerationEventInfo.cs | 0 .../Symbols/CodeGenerationEventSymbol.cs | 5 ++ .../Symbols/CodeGenerationFieldInfo.cs | 0 .../Symbols/CodeGenerationFieldSymbol.cs | 5 ++ .../Symbols/CodeGenerationMethodInfo.cs | 0 .../Symbols/CodeGenerationMethodSymbol.cs | 5 ++ .../Symbols/CodeGenerationNamedTypeSymbol.cs | 7 ++- .../Symbols/CodeGenerationNamespaceInfo.cs | 0 .../CodeGenerationNamespaceOrTypeSymbol.cs | 5 ++ .../Symbols/CodeGenerationNamespaceSymbol.cs | 0 .../Symbols/CodeGenerationOperatorSymbol.cs | 7 ++- .../Symbols/CodeGenerationParameterSymbol.cs | 5 ++ .../CodeGenerationPointerTypeSymbol.cs | 0 .../Symbols/CodeGenerationPropertyInfo.cs | 0 .../Symbols/CodeGenerationPropertySymbol.cs | 5 ++ .../Symbols/CodeGenerationSymbol.cs | 27 ++++++++- .../CodeGenerationTypeParameterSymbol.cs | 0 .../Symbols/CodeGenerationTypeSymbol.cs | 5 ++ .../SyntaxAnnotationExtensions.cs | 18 ------ .../Core}/CodeGeneration/TypeGenerator.cs | 0 .../Core}/Extensions/ArrayExtensions.cs | 0 .../Core/Extensions/DocumentExtensions.cs | 6 ++ .../AddImports/AbstractAddImportsService.cs | 10 +++- .../AddImports/IAddImportsService.cs | 23 +++++-- ...AbstractGeneratedCodeRecognitionService.cs | 2 +- .../IGeneratedCodeRecognitionService.cs | 2 + .../ImportAdder}/ImportAdderService.cs | 0 .../Core/WorkspaceExtensions.projitems | 48 +++++++++++++++ .../Core/WorkspaceExtensionsResources.resx | 33 ++++++++++ .../xlf/WorkspaceExtensionsResources.cs.xlf | 55 +++++++++++++++++ .../xlf/WorkspaceExtensionsResources.de.xlf | 55 +++++++++++++++++ .../xlf/WorkspaceExtensionsResources.es.xlf | 55 +++++++++++++++++ .../xlf/WorkspaceExtensionsResources.fr.xlf | 55 +++++++++++++++++ .../xlf/WorkspaceExtensionsResources.it.xlf | 55 +++++++++++++++++ .../xlf/WorkspaceExtensionsResources.ja.xlf | 55 +++++++++++++++++ .../xlf/WorkspaceExtensionsResources.ko.xlf | 55 +++++++++++++++++ .../xlf/WorkspaceExtensionsResources.pl.xlf | 55 +++++++++++++++++ .../WorkspaceExtensionsResources.pt-BR.xlf | 55 +++++++++++++++++ .../xlf/WorkspaceExtensionsResources.ru.xlf | 55 +++++++++++++++++ .../xlf/WorkspaceExtensionsResources.tr.xlf | 55 +++++++++++++++++ .../WorkspaceExtensionsResources.zh-Hans.xlf | 55 +++++++++++++++++ .../WorkspaceExtensionsResources.zh-Hant.xlf | 55 +++++++++++++++++ .../VisualBasicAddImportsService.vb | 11 +++- 251 files changed, 2691 insertions(+), 2351 deletions(-) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/AddExplicitCast/AddExplicitCastCodeFixProvider.cs (100%) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/AddExplicitCast/ArgumentFixer.cs (100%) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/AddExplicitCast/AttributeArgumentFixer.cs (100%) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs (91%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/AddObsoleteAttribute/CSharpAddObsoleteAttributeCodeFixProvider.cs (94%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/AliasAmbiguousType/CSharpAliasAmbiguousTypeCodeFixProvider.cs (100%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs (97%) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs (96%) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/HideBase/HideBaseCodeFixProvider.AddNewKeywordAction.cs (82%) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/HideBase/HideBaseCodeFixProvider.cs (100%) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs (97%) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/Iterator/CSharpChangeToIEnumerableCodeFixProvider.cs (97%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/MakeMemberStatic/CSharpMakeMemberStaticCodeFixProvider.cs (100%) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixProvider.cs (96%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/MakeTypeAbstract/CSharpMakeTypeAbstractCodeFixProvider.cs (100%) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/Nullable/CSharpDeclareAsNullableCodeFixProvider.cs (99%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/UnsealClass/CSharpUnsealClassCodeFixProvider.cs (93%) rename src/{Features/CSharp/Portable => Analyzers/CSharp}/CodeFixes/UseInterpolatedVerbatimString/CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs (93%) rename src/{Features/CSharp/Portable => Analyzers/CSharp/CodeFixes}/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs (99%) rename src/{EditorFeatures/CSharpTest/Diagnostics => Analyzers/CSharp/Tests}/AddExplicitCast/AddExplicitCastTests.cs (98%) rename src/{EditorFeatures/CSharpTest/Diagnostics => Analyzers/CSharp/Tests}/AddExplicitCast/AddExplicitCastTests_FixAllTests.cs (100%) rename src/{Features/Core/Portable => Analyzers/Core}/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs (89%) rename src/{Features/Core/Portable => Analyzers/Core}/CodeFixes/AddExplicitCast/Fixer.cs (100%) rename src/{Features/Core/Portable => Analyzers/Core}/CodeFixes/AddExplicitCast/InheritanceDistanceComparer.cs (100%) rename src/{Features/Core/Portable => Analyzers/Core/CodeFixes}/AddObsoleteAttribute/AbstractAddObsoleteAttributeCodeFixProvider.cs (98%) rename src/{Features/Core/Portable => Analyzers/Core/CodeFixes}/AliasAmbiguousType/AbstractAliasAmbiguousTypeCodeFixProvider.cs (89%) rename src/{Features/Core/Portable => Analyzers/Core}/CodeFixes/Iterator/AbstractIteratorCodeFixProvider.cs (100%) rename src/{Features/Core/Portable => Analyzers/Core/CodeFixes}/MakeMemberStatic/AbstractMakeMemberStaticCodeFixProvider.cs (91%) rename src/{Features/Core/Portable/MakeClassAbstract => Analyzers/Core/CodeFixes/MakeTypeAbstract}/AbstractMakeTypeAbstractCodeFixProvider.cs (92%) rename src/{Features/Core/Portable => Analyzers/Core/CodeFixes}/UnsealClass/AbstractUnsealClassCodeFixProvider.cs (94%) rename src/{Features/VisualBasic/Portable => Analyzers/VisualBasic}/CodeFixes/AddExplicitCast/ArgumentFixer.vb (100%) rename src/{Features/VisualBasic/Portable => Analyzers/VisualBasic}/CodeFixes/AddExplicitCast/VisualBasicAddExplicitCastCodeFixProvider.vb (100%) rename src/{Features/VisualBasic/Portable => Analyzers/VisualBasic/CodeFixes}/AddObsoleteAttribute/VisualBasicAddObsoleteAttributeCodeFixProvider.vb (92%) rename src/{Features/VisualBasic/Portable => Analyzers/VisualBasic/CodeFixes}/AliasAmbiguousType/VisualBasicAliasAmbiguousTypeCodeFixProvider.vb (100%) rename src/{Features/VisualBasic/Portable => Analyzers/VisualBasic}/CodeFixes/Iterator/VisualBasicChangeToYieldCodeFixProvider.vb (90%) rename src/{Features/VisualBasic/Portable => Analyzers/VisualBasic}/CodeFixes/Iterator/VisualBasicConvertToIteratorCodeFixProvider.vb (95%) rename src/{Features/VisualBasic/Portable => Analyzers/VisualBasic/CodeFixes}/MakeTypeAbstract/VisualBasicMakeTypeAbstractCodeFixProvider.vb (100%) rename src/{Features/VisualBasic/Portable => Analyzers/VisualBasic/CodeFixes}/UnsealClass/VisualBasicUnsealClassCodeFixProvider.vb (96%) rename src/{EditorFeatures/VisualBasicTest/Diagnostics => Analyzers/VisualBasic/Tests}/AddExplicitCast/AddExplicitCastTests.vb (99%) rename src/{EditorFeatures/VisualBasicTest/Diagnostics => Analyzers/VisualBasic/Tests}/AddExplicitCast/AddExplicitCastTests_FixAllTests.vb (100%) delete mode 100644 src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/ArgumentGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/AttributeGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/CSharpCodeGenerationHelpers.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/CSharpCodeGenerationOptions.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/CSharpCodeGenerationPreferences.cs (95%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/CSharpCodeGenerationService.cs (99%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/CSharpCodeGenerationServiceFactory.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/CSharpDeclarationComparer.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/CSharpFlagsEnumGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/CSharpSyntaxGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/ConstructorGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/ConversionGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/DestructorGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/EnumMemberGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/EventGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/ExpressionGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/FieldGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/MethodGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/NamedTypeGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/NamespaceGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/OperatorGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/ParameterGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/PropertyGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/StatementGenerator.cs (100%) rename src/Workspaces/{CSharp/Portable => SharedUtilitiesAndExtensions/Workspace/CSharp}/CodeGeneration/TypeParameterGenerator.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/AbstractCodeGenerationService.cs (95%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs (99%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/AbstractFlagsEnumGenerator.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/CodeGenerationContext.cs (99%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/CodeGenerationDestination.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/CodeGenerationHelpers.cs (99%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/CodeGenerationOperatorKind.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/CodeGenerationOptions.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/CodeGenerationSymbolFactory.cs (99%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/CodeGenerator.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/ICodeGenerationService.cs (98%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/INamedTypeSymbolExtensions.cs (100%) rename src/Workspaces/{Core/Portable/Shared/Extensions => SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration}/ITypeGenerator.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/LiteralSpecialValues.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/NullableSyntaxAnnotation.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs (98%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs (98%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationArrayTypeSymbol.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationAttributeData.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationConstructedMethodSymbol.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationConstructedNamedTypeSymbol.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationConstructorInfo.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs (96%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs (95%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationDestructorInfo.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationDestructorSymbol.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationEventInfo.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs (97%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationFieldInfo.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs (97%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationMethodInfo.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs (98%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs (98%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationNamespaceInfo.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs (95%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationNamespaceSymbol.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs (98%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs (97%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationPointerTypeSymbol.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationPropertyInfo.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs (97%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationSymbol.cs (88%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationTypeParameterSymbol.cs (100%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs (98%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/SyntaxAnnotationExtensions.cs (52%) rename src/Workspaces/{Core/Portable => SharedUtilitiesAndExtensions/Workspace/Core}/CodeGeneration/TypeGenerator.cs (100%) rename src/Workspaces/{Core/Portable/Shared => SharedUtilitiesAndExtensions/Workspace/Core}/Extensions/ArrayExtensions.cs (100%) rename src/Workspaces/{Core/Portable/Editing => SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/ImportAdder}/ImportAdderService.cs (100%) diff --git a/src/Features/CSharp/Portable/CodeFixes/AddExplicitCast/AddExplicitCastCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/AddExplicitCast/AddExplicitCastCodeFixProvider.cs similarity index 100% rename from src/Features/CSharp/Portable/CodeFixes/AddExplicitCast/AddExplicitCastCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/AddExplicitCast/AddExplicitCastCodeFixProvider.cs diff --git a/src/Features/CSharp/Portable/CodeFixes/AddExplicitCast/ArgumentFixer.cs b/src/Analyzers/CSharp/CodeFixes/AddExplicitCast/ArgumentFixer.cs similarity index 100% rename from src/Features/CSharp/Portable/CodeFixes/AddExplicitCast/ArgumentFixer.cs rename to src/Analyzers/CSharp/CodeFixes/AddExplicitCast/ArgumentFixer.cs diff --git a/src/Features/CSharp/Portable/CodeFixes/AddExplicitCast/AttributeArgumentFixer.cs b/src/Analyzers/CSharp/CodeFixes/AddExplicitCast/AttributeArgumentFixer.cs similarity index 100% rename from src/Features/CSharp/Portable/CodeFixes/AddExplicitCast/AttributeArgumentFixer.cs rename to src/Analyzers/CSharp/CodeFixes/AddExplicitCast/AttributeArgumentFixer.cs diff --git a/src/Features/CSharp/Portable/CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs similarity index 91% rename from src/Features/CSharp/Portable/CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs index a400321dc60b8..71054f95f8ead 100644 --- a/src/Features/CSharp/Portable/CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs @@ -14,6 +14,7 @@ using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Formatting; using Microsoft.CodeAnalysis.Host.Mef; @@ -80,7 +81,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) if (symbol.IsOverride || symbol.ImplicitInterfaceImplementations().Any()) { - context.RegisterCodeFix(new MyCodeAction(FeaturesResources.Explicitly_inherit_documentation, + context.RegisterCodeFix(new MyCodeAction(CSharpCodeFixesResources.Explicitly_inherit_documentation, c => FixAsync(context.Document, diagnostic, c)), context.Diagnostics); } } @@ -99,7 +100,12 @@ protected override async Task FixAllAsync(Document document, ImmutableArray comment. var xmlSpaceAfterTripleSlash = Token(leading: TriviaList(DocumentationCommentExterior("///")), SyntaxKind.XmlTextLiteralToken, text: " ", valueText: " ", trailing: default); @@ -128,10 +134,10 @@ protected override async Task FixAllAsync(Document document, ImmutableArray> createChangedDocument) - : base(title, createChangedDocument, equivalenceKey: nameof(FeaturesResources.Explicitly_inherit_documentation)) + : base(title, createChangedDocument, equivalenceKey: nameof(CSharpCodeFixesResources.Explicitly_inherit_documentation)) { } } diff --git a/src/Features/CSharp/Portable/AddObsoleteAttribute/CSharpAddObsoleteAttributeCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/AddObsoleteAttribute/CSharpAddObsoleteAttributeCodeFixProvider.cs similarity index 94% rename from src/Features/CSharp/Portable/AddObsoleteAttribute/CSharpAddObsoleteAttributeCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/AddObsoleteAttribute/CSharpAddObsoleteAttributeCodeFixProvider.cs index 0bc03fa881700..9725a9d8aaad7 100644 --- a/src/Features/CSharp/Portable/AddObsoleteAttribute/CSharpAddObsoleteAttributeCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/AddObsoleteAttribute/CSharpAddObsoleteAttributeCodeFixProvider.cs @@ -30,7 +30,7 @@ internal class CSharpAddObsoleteAttributeCodeFixProvider [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] public CSharpAddObsoleteAttributeCodeFixProvider() - : base(CSharpSyntaxFacts.Instance, CSharpFeaturesResources.Add_Obsolete) + : base(CSharpSyntaxFacts.Instance, CSharpCodeFixesResources.Add_Obsolete) { } } diff --git a/src/Features/CSharp/Portable/AliasAmbiguousType/CSharpAliasAmbiguousTypeCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/AliasAmbiguousType/CSharpAliasAmbiguousTypeCodeFixProvider.cs similarity index 100% rename from src/Features/CSharp/Portable/AliasAmbiguousType/CSharpAliasAmbiguousTypeCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/AliasAmbiguousType/CSharpAliasAmbiguousTypeCodeFixProvider.cs diff --git a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems index 33e4b824c2eee..f0c1f8f9d08b0 100644 --- a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems +++ b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems @@ -16,11 +16,30 @@ + + + + + + + + + + + + + + + + + + + @@ -83,4 +102,4 @@ - + \ No newline at end of file diff --git a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixesResources.resx b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixesResources.resx index 54f625de05653..c6227ab8ded87 100644 --- a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixesResources.resx +++ b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixesResources.resx @@ -147,4 +147,41 @@ Fix_record_declaration + + Change return type from {0} to {1} + + + Hide base member + + + Add [Obsolete] + + + Explicitly inherit documentation + + + Unseal class '{0}' + + + Use interpolated verbatim string + + + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + + + Assign to '{0}' + + + Compare to '{0}' + + + Fix return type + + + Replace return with yield return + + + Declare as nullable + \ No newline at end of file diff --git a/src/Features/CSharp/Portable/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs similarity index 97% rename from src/Features/CSharp/Portable/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs index 37eda381c1831..ff841db75313d 100644 --- a/src/Features/CSharp/Portable/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs @@ -74,8 +74,8 @@ private static bool CanFix( var node = diagnostic.Location.FindNode(getInnermostNodeForTie: true, cancellationToken); var (left, right, titleFormat) = node switch { - BinaryExpressionSyntax binary => (binary.Left, binary.Right, CSharpFeaturesResources.Compare_to_0), - AssignmentExpressionSyntax assignment => (assignment.Left, assignment.Right, CSharpFeaturesResources.Assign_to_0), + BinaryExpressionSyntax binary => (binary.Left, binary.Right, CSharpCodeFixesResources.Compare_to_0), + AssignmentExpressionSyntax assignment => (assignment.Left, assignment.Right, CSharpCodeFixesResources.Assign_to_0), _ => default, }; @@ -171,7 +171,7 @@ protected override async Task FixAllAsync( } } - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(string title, Func> createChangedDocument) : base(title, createChangedDocument, nameof(CSharpDisambiguateSameVariableCodeFixProvider)) diff --git a/src/Features/CSharp/Portable/CodeFixes/FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs similarity index 96% rename from src/Features/CSharp/Portable/CodeFixes/FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs index 9a34aa77c5a5a..ea7f816af1c4f 100644 --- a/src/Features/CSharp/Portable/CodeFixes/FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs @@ -132,10 +132,10 @@ private static (TypeSyntax type, bool useTask) TryGetDeclarationTypeToFix(Syntax } } - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(Func> createChangedDocument) - : base(CSharpFeaturesResources.Fix_return_type, createChangedDocument, nameof(CSharpFeaturesResources.Fix_return_type)) + : base(CSharpCodeFixesResources.Fix_return_type, createChangedDocument, nameof(CSharpCodeFixesResources.Fix_return_type)) { } } diff --git a/src/Features/CSharp/Portable/CodeFixes/HideBase/HideBaseCodeFixProvider.AddNewKeywordAction.cs b/src/Analyzers/CSharp/CodeFixes/HideBase/HideBaseCodeFixProvider.AddNewKeywordAction.cs similarity index 82% rename from src/Features/CSharp/Portable/CodeFixes/HideBase/HideBaseCodeFixProvider.AddNewKeywordAction.cs rename to src/Analyzers/CSharp/CodeFixes/HideBase/HideBaseCodeFixProvider.AddNewKeywordAction.cs index b7e5b04f8a007..d63145094df67 100644 --- a/src/Features/CSharp/Portable/CodeFixes/HideBase/HideBaseCodeFixProvider.AddNewKeywordAction.cs +++ b/src/Analyzers/CSharp/CodeFixes/HideBase/HideBaseCodeFixProvider.AddNewKeywordAction.cs @@ -12,6 +12,13 @@ using Microsoft.CodeAnalysis.OrderModifiers; using Roslyn.Utilities; using Microsoft.CodeAnalysis.CSharp.LanguageServices; +using Microsoft.CodeAnalysis.Diagnostics; + +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using Microsoft.CodeAnalysis.Options; +#endif namespace Microsoft.CodeAnalysis.CSharp.CodeFixes.HideBase { @@ -22,7 +29,7 @@ private class AddNewKeywordAction : CodeActions.CodeAction private readonly Document _document; private readonly SyntaxNode _node; - public override string Title => CSharpFeaturesResources.Hide_base_member; + public override string Title => CSharpCodeFixesResources.Hide_base_member; public AddNewKeywordAction(Document document, SyntaxNode node) { @@ -34,19 +41,24 @@ protected override async Task GetChangedDocumentAsync(CancellationToke { var root = await _document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); - var newNode = await GetNewNodeAsync(_node, cancellationToken).ConfigureAwait(false); +#if CODE_STYLE + var options = _document.Project.AnalyzerOptions.GetAnalyzerOptionSet(_node.SyntaxTree, cancellationToken); +#else + var options = await _document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); +#endif + + var newNode = GetNewNode(_node, options); var newRoot = root.ReplaceNode(_node, newNode); return _document.WithSyntaxRoot(newRoot); } - private async Task GetNewNodeAsync(SyntaxNode node, CancellationToken cancellationToken) + private static SyntaxNode GetNewNode(SyntaxNode node, OptionSet options) { var syntaxFacts = CSharpSyntaxFacts.Instance; var modifiers = syntaxFacts.GetModifiers(node); var newModifiers = modifiers.Add(SyntaxFactory.Token(SyntaxKind.NewKeyword)); - var options = await _document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); var option = options.GetOption(CSharpCodeStyleOptions.PreferredModifierOrder); if (!CSharpOrderModifiersHelper.Instance.TryGetOrComputePreferredOrder(option.Value, out var preferredOrder) || !AbstractOrderModifiersHelpers.IsOrdered(preferredOrder, modifiers)) diff --git a/src/Features/CSharp/Portable/CodeFixes/HideBase/HideBaseCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/HideBase/HideBaseCodeFixProvider.cs similarity index 100% rename from src/Features/CSharp/Portable/CodeFixes/HideBase/HideBaseCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/HideBase/HideBaseCodeFixProvider.cs diff --git a/src/Features/CSharp/Portable/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs similarity index 97% rename from src/Features/CSharp/Portable/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs index 0a7ce09afd6ce..a2563be682c9e 100644 --- a/src/Features/CSharp/Portable/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/Iterator/CSharpAddYieldCodeFixProvider.cs @@ -220,10 +220,10 @@ protected override bool TryGetNode( return node != null; } - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(Document newDocument) - : base(CSharpFeaturesResources.Replace_return_with_yield_return, c => Task.FromResult(newDocument), nameof(CSharpFeaturesResources.Replace_return_with_yield_return)) + : base(CSharpCodeFixesResources.Replace_return_with_yield_return, c => Task.FromResult(newDocument), nameof(CSharpCodeFixesResources.Replace_return_with_yield_return)) { } } diff --git a/src/Features/CSharp/Portable/CodeFixes/Iterator/CSharpChangeToIEnumerableCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/Iterator/CSharpChangeToIEnumerableCodeFixProvider.cs similarity index 97% rename from src/Features/CSharp/Portable/CodeFixes/Iterator/CSharpChangeToIEnumerableCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/Iterator/CSharpChangeToIEnumerableCodeFixProvider.cs index 564d6224c5b4f..3976f1edfcf3a 100644 --- a/src/Features/CSharp/Portable/CodeFixes/Iterator/CSharpChangeToIEnumerableCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/Iterator/CSharpChangeToIEnumerableCodeFixProvider.cs @@ -111,7 +111,7 @@ protected override async Task GetCodeFixAsync(SyntaxNode root, Synta } return new MyCodeAction( - string.Format(CSharpFeaturesResources.Change_return_type_from_0_to_1, + string.Format(CSharpCodeFixesResources.Change_return_type_from_0_to_1, type.ToMinimalDisplayString(model, node.SpanStart), ienumerableGenericSymbol.ToMinimalDisplayString(model, node.SpanStart)), newDocument); } @@ -130,7 +130,7 @@ private static bool TryGetIEnumerableSymbols(SemanticModel model, out INamedType return true; } - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(string title, Document newDocument) : base(title, c => Task.FromResult(newDocument), title) diff --git a/src/Features/CSharp/Portable/MakeMemberStatic/CSharpMakeMemberStaticCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/MakeMemberStatic/CSharpMakeMemberStaticCodeFixProvider.cs similarity index 100% rename from src/Features/CSharp/Portable/MakeMemberStatic/CSharpMakeMemberStaticCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/MakeMemberStatic/CSharpMakeMemberStaticCodeFixProvider.cs diff --git a/src/Features/CSharp/Portable/CodeFixes/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixProvider.cs similarity index 96% rename from src/Features/CSharp/Portable/CodeFixes/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixProvider.cs index 5954268d1726a..b760f98b3f513 100644 --- a/src/Features/CSharp/Portable/CodeFixes/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixProvider.cs @@ -117,12 +117,12 @@ private static SyntaxNode TryGetStatementToFix(SyntaxNode node) return null; } - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(Func> createChangedDocument) - : base(CSharpFeaturesResources.Add_await, + : base(CSharpCodeFixesResources.Add_await, createChangedDocument, - CSharpFeaturesResources.Add_await) + CSharpCodeFixesResources.Add_await) { } } diff --git a/src/Features/CSharp/Portable/MakeTypeAbstract/CSharpMakeTypeAbstractCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/MakeTypeAbstract/CSharpMakeTypeAbstractCodeFixProvider.cs similarity index 100% rename from src/Features/CSharp/Portable/MakeTypeAbstract/CSharpMakeTypeAbstractCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/MakeTypeAbstract/CSharpMakeTypeAbstractCodeFixProvider.cs diff --git a/src/Features/CSharp/Portable/CodeFixes/Nullable/CSharpDeclareAsNullableCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/Nullable/CSharpDeclareAsNullableCodeFixProvider.cs similarity index 99% rename from src/Features/CSharp/Portable/CodeFixes/Nullable/CSharpDeclareAsNullableCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/Nullable/CSharpDeclareAsNullableCodeFixProvider.cs index a332643629287..de155222a06f4 100644 --- a/src/Features/CSharp/Portable/CodeFixes/Nullable/CSharpDeclareAsNullableCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/Nullable/CSharpDeclareAsNullableCodeFixProvider.cs @@ -383,10 +383,10 @@ private static bool IsExpressionSupported(SyntaxNode node) SyntaxKind.VariableDeclarator); } - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(Func> createChangedDocument, string equivalenceKey) - : base(CSharpFeaturesResources.Declare_as_nullable, + : base(CSharpCodeFixesResources.Declare_as_nullable, createChangedDocument, equivalenceKey) { diff --git a/src/Features/CSharp/Portable/UnsealClass/CSharpUnsealClassCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UnsealClass/CSharpUnsealClassCodeFixProvider.cs similarity index 93% rename from src/Features/CSharp/Portable/UnsealClass/CSharpUnsealClassCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/UnsealClass/CSharpUnsealClassCodeFixProvider.cs index 7f91482a7b1bd..b0592a5065bd6 100644 --- a/src/Features/CSharp/Portable/UnsealClass/CSharpUnsealClassCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UnsealClass/CSharpUnsealClassCodeFixProvider.cs @@ -26,6 +26,6 @@ public CSharpUnsealClassCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(CS0509); - protected override string TitleFormat => CSharpFeaturesResources.Unseal_class_0; + protected override string TitleFormat => CSharpCodeFixesResources.Unseal_class_0; } } diff --git a/src/Features/CSharp/Portable/CodeFixes/UseInterpolatedVerbatimString/CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseInterpolatedVerbatimString/CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs similarity index 93% rename from src/Features/CSharp/Portable/CodeFixes/UseInterpolatedVerbatimString/CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/UseInterpolatedVerbatimString/CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs index fbeabc2b41b9e..318aada38042b 100644 --- a/src/Features/CSharp/Portable/CodeFixes/UseInterpolatedVerbatimString/CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseInterpolatedVerbatimString/CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs @@ -77,10 +77,10 @@ private static void AddEdits( editor.ReplaceNode(verbatimInterpolated, interpolatedVerbatim); } - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(Func> createChangedDocument) - : base(FeaturesResources.Use_interpolated_verbatim_string, createChangedDocument, nameof(FeaturesResources.Use_interpolated_verbatim_string)) + : base(CSharpCodeFixesResources.Use_interpolated_verbatim_string, createChangedDocument, nameof(CSharpCodeFixesResources.Use_interpolated_verbatim_string)) { } } diff --git a/src/Features/CSharp/Portable/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs similarity index 99% rename from src/Features/CSharp/Portable/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs rename to src/Analyzers/CSharp/CodeFixes/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs index 19dbb99b310eb..87cafd3879c74 100644 --- a/src/Features/CSharp/Portable/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs @@ -89,7 +89,12 @@ protected override async Task FixAllAsync( var root = editor.OriginalRoot; var currentRoot = root.TrackNodes(nodesToTrack); +#if CODE_STYLE + var options = document.Project.AnalyzerOptions.GetAnalyzerOptionSet(root.SyntaxTree, cancellationToken); +#else var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); +#endif + var languageVersion = semanticModel.SyntaxTree.Options.LanguageVersion(); var makeStaticIfPossible = languageVersion >= LanguageVersion.CSharp8 && options.GetOption(CSharpCodeStyleOptions.PreferStaticLocalFunction).Value; diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.cs.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.cs.xlf index b4bd6f97098b0..5b21c414295ac 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.cs.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.cs.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' Přidejte položku this. + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' Převést typeof na nameof + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments Předat zachycené proměnné jako argumenty @@ -47,6 +92,21 @@ Odebrat nedosažitelný kód + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. Upozornění: Když se do deklarace místní funkce přidají parametry, může to vytvořit neplatný kód. diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.de.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.de.xlf index 0d85bfecf1d2f..bb484f8849c05 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.de.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.de.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' "this." hinzufügen + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' "typeof" in "nameof" konvertieren + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments Erfasste Variablen als Argumente übergeben @@ -47,6 +92,21 @@ Nicht erreichbaren Code entfernen + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. Warnung: Das Hinzufügen von Parametern zur Deklaration einer lokalen Funktion kann zu ungültigem Code führen. diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.es.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.es.xlf index 8f24b3d4e4dc5..9ec84cd78b28a 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.es.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.es.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' Agregar "this." + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' Convertir "typeof" en "nameof" + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments Pasar variables capturadas como argumentos @@ -47,6 +92,21 @@ Quitar código inaccesible + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. Advertencia: Agregar parámetros a la declaración de función local puede generar código no válido. diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.fr.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.fr.xlf index 8f1d73924d5be..19330d3b0a98a 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.fr.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.fr.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' Ajouter 'this.' + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' Convertir 'typeof' en 'nameof' + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments Passer les variables capturées en tant qu'arguments @@ -47,6 +92,21 @@ Supprimer le code inaccessible + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. Avertissement : L'ajout de paramètres à la déclaration de fonction locale peut produire du code non valide. diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.it.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.it.xlf index b0da312c5c7f2..cc96c18c15e11 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.it.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.it.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' Aggiungi 'this.' + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' Convertire 'typeof' in 'nameof' + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments Passa le variabili catturate come argomenti @@ -47,6 +92,21 @@ Rimuovi il codice non eseguibile + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. Avviso: l'aggiunta di parametri alla dichiarazione di funzione locale potrebbe produrre codice non valido. diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ja.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ja.xlf index ab333aa152467..826b42be612ce 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ja.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ja.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' this' を追加します。 + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' 'typeof' を 'nameof' に変換します + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments キャプチャした変数を引数として渡す @@ -47,6 +92,21 @@ 到達できないコードを削除します + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. 警告: ローカル関数の宣言にパラメーターを追加すると、無効なコードが生成される可能性があります。 diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ko.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ko.xlf index 3b6d930ce1c96..997f46c279fbd 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ko.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ko.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' this'를 추가합니다. + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' 'typeof'를 'nameof'로 변환 + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments 캡처된 변수를 인수로 전달 @@ -47,6 +92,21 @@ 접근할 수 없는 코드 제거 + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. 경고: 로컬 함수 선언에 매개 변수를 추가할 경우 잘못된 코드가 생성될 수 있습니다. diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.pl.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.pl.xlf index 83dee6c13ad3e..08b8a20f1118f 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.pl.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.pl.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' Dodaj „this.” + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' Konwertuj element „typeof” na element „nameof” + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments Przekaż przechwycone zmienne jako argumenty @@ -47,6 +92,21 @@ Usuń nieosiągalny kod + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. Ostrzeżenie: Dodanie parametrów do deklaracji funkcji lokalnej może prowadzić do powstania nieprawidłowego kodu. diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.pt-BR.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.pt-BR.xlf index 81e92c9b10e2e..5cbf71ff65bea 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.pt-BR.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.pt-BR.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' Adicionar 'isso.' + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' Converter 'typeof' em 'nameof' + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments Passar variáveis capturadas como argumentos @@ -47,6 +92,21 @@ Remover código inacessível + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. Aviso: a adição de parâmetros à declaração de função local pode produzir um código inválido. diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ru.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ru.xlf index 2dab8e4f8a874..055a397d319f2 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ru.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.ru.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' Добавьте "this". + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' Преобразовать "typeof" в "nameof" + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments Передача зафиксированных переменных в качестве аргументов @@ -47,6 +92,21 @@ Удалить недостижимый код + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. Предупреждение! Добавление параметров в объявление локальной функции может привести к недопустимому коду. diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.tr.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.tr.xlf index a784768adf623..7fb336a75e211 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.tr.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.tr.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' this' ekleyin. + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' 'Typeof' metodunu 'nameof' metoduna dönüştürün + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments Yakalanan değişkenleri bağımsız değişken olarak geçir @@ -47,6 +92,21 @@ Erişilemeyen kodları kaldır + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. Uyarı: Yerel işlev bildirimine parametre eklendiğinde geçersiz kod üretilebilir. diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.zh-Hans.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.zh-Hans.xlf index 68faaf57ca381..5fab137a6b777 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.zh-Hans.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.zh-Hans.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' 添加 "this." + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' 将 "typeof" 转换为 "nameof" + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments 以参数形式传入捕获的变量 @@ -47,6 +92,21 @@ 删除无法访问的代码 + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. 警告: 将参数添加到本地函数声明可能产生无效的代码。 diff --git a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.zh-Hant.xlf b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.zh-Hant.xlf index ae9f4b85d4b63..db682c1597cb0 100644 --- a/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.zh-Hant.xlf +++ b/src/Analyzers/CSharp/CodeFixes/xlf/CSharpCodeFixesResources.zh-Hant.xlf @@ -2,21 +2,66 @@ + + Add [Obsolete] + Add [Obsolete] + + + + Add 'await' + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + Add 'this.' 新增 'this.' + + Assign to '{0}' + Assign to '{0}' + + + + Change return type from {0} to {1} + Change return type from {0} to {1} + + + + Compare to '{0}' + Compare to '{0}' + + Convert 'typeof' to 'nameof' 將 'typeof' 轉換為 'nameof' + + Declare as nullable + Declare as nullable + + + + Explicitly inherit documentation + Explicitly inherit documentation + + Fix_record_declaration Fix_record_declaration + + Fix return type + Fix return type + + + + Hide base member + Hide base member + + Pass in captured variables as arguments 以引數形式傳入擷取到的變數 @@ -47,6 +92,21 @@ 移除執行不到的程式碼 + + Replace return with yield return + Replace return with yield return + + + + Unseal class '{0}' + Unseal class '{0}' + + + + Use interpolated verbatim string + Use interpolated verbatim string + + Warning: Adding parameters to local function declaration may produce invalid code. 警告: 新增參數到區域函式宣告可能會產生無效的程式碼。 diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/AddExplicitCast/AddExplicitCastTests.cs b/src/Analyzers/CSharp/Tests/AddExplicitCast/AddExplicitCastTests.cs similarity index 98% rename from src/EditorFeatures/CSharpTest/Diagnostics/AddExplicitCast/AddExplicitCastTests.cs rename to src/Analyzers/CSharp/Tests/AddExplicitCast/AddExplicitCastTests.cs index c959df4927171..2799ac663f41a 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/AddExplicitCast/AddExplicitCastTests.cs +++ b/src/Analyzers/CSharp/Tests/AddExplicitCast/AddExplicitCastTests.cs @@ -2475,7 +2475,7 @@ public Test(string s, Base b, int i, params object[] list) : this(d : (Derived)b } }"; await TestInRegularAndScriptAsync(initialMarkup, expect_0, index: 0, - title: string.Format(FeaturesResources.Convert_type_to_0, "Derived")); + title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived")); var expect_1 = @" @@ -2494,7 +2494,7 @@ public Test(string s, Base b, int i, params object[] list) : this(d : (Derived2) } }"; await TestInRegularAndScriptAsync(initialMarkup, expect_1, index: 1, - title: string.Format(FeaturesResources.Convert_type_to_0, "Derived2")); + title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2")); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddExplicitCast)] @@ -2540,7 +2540,7 @@ public Test(string s, Base b, int i, params object[] list) : this(d : (Derived)b } }"; await TestInRegularAndScriptAsync(initialMarkup, expect_0, index: 0, - title: string.Format(FeaturesResources.Convert_type_to_0, "Derived")); + title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived")); var expect_1 = @" @@ -2559,7 +2559,7 @@ public Test(string s, Base b, int i, params object[] list) : this(d : (Derived2) } }"; await TestInRegularAndScriptAsync(initialMarkup, expect_1, index: 1, - title: string.Format(FeaturesResources.Convert_type_to_0, "Derived2")); + title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2")); } @@ -2693,7 +2693,7 @@ void M() } }"; await TestInRegularAndScriptAsync(initialMarkup, expect_0, index: 0, - title: string.Format(FeaturesResources.Convert_type_to_0, "Derived")); + title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived")); var expect_1 = @" @@ -2715,7 +2715,7 @@ void M() } }"; await TestInRegularAndScriptAsync(initialMarkup, expect_1, index: 1, - title: string.Format(FeaturesResources.Convert_type_to_0, "Derived2")); + title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2")); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddExplicitCast)] @@ -2772,7 +2772,7 @@ void M() } }"; await TestInRegularAndScriptAsync(initialMarkup, expect_0, index: 0, - title: string.Format(FeaturesResources.Convert_type_to_0, "string")); + title: string.Format(CodeFixesResources.Convert_type_to_0, "string")); var expect_1 = @" @@ -2797,7 +2797,7 @@ void M() } }"; await TestInRegularAndScriptAsync(initialMarkup, expect_1, index: 1, - title: string.Format(FeaturesResources.Convert_type_to_0, "Derived")); + title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived")); var expect_2 = @" @@ -2822,7 +2822,7 @@ void M() } }"; await TestInRegularAndScriptAsync(initialMarkup, expect_2, index: 2, - title: string.Format(FeaturesResources.Convert_type_to_0, "Derived2")); + title: string.Format(CodeFixesResources.Convert_type_to_0, "Derived2")); } [Fact, Trait(Traits.Feature, Traits.Features.CodeActionsAddExplicitCast)] diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/AddExplicitCast/AddExplicitCastTests_FixAllTests.cs b/src/Analyzers/CSharp/Tests/AddExplicitCast/AddExplicitCastTests_FixAllTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/Diagnostics/AddExplicitCast/AddExplicitCastTests_FixAllTests.cs rename to src/Analyzers/CSharp/Tests/AddExplicitCast/AddExplicitCastTests_FixAllTests.cs diff --git a/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems b/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems index 2aa0e218be626..b40c50a32715d 100644 --- a/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems +++ b/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems @@ -9,6 +9,8 @@ Microsoft.CodeAnalysis.CSharp.Analyzers.UnitTests + + diff --git a/src/Analyzers/Core/Analyzers/AnalyzersResources.resx b/src/Analyzers/Core/Analyzers/AnalyzersResources.resx index d1259d23235ef..a39e2e3a3e5df 100644 --- a/src/Analyzers/Core/Analyzers/AnalyzersResources.resx +++ b/src/Analyzers/Core/Analyzers/AnalyzersResources.resx @@ -352,4 +352,4 @@ Simplify LINQ expression - + \ No newline at end of file diff --git a/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs similarity index 89% rename from src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs rename to src/Analyzers/Core/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs index 8b32808fe75a2..dc24abf81f8a9 100644 --- a/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs @@ -82,7 +82,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) if (potentialConversionTypes.Length == 1) { context.RegisterCodeFix(new MyCodeAction( - FeaturesResources.Add_explicit_cast, + CodeFixesResources.Add_explicit_cast, c => FixAsync(context.Document, context.Diagnostics.First(), c)), context.Diagnostics); return; @@ -100,34 +100,21 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) _ => Task.FromResult(document.WithSyntaxRoot(ApplyFix(root, targetNode, conversionType))))); } - ReportTelemetryIfNecessary(potentialConversionTypes); - - context.RegisterCodeFix(new CodeAction.CodeActionWithNestedActions( - FeaturesResources.Add_explicit_cast, +#pragma warning disable RS0005 // Do not use generic 'CodeAction.Create' to create 'CodeAction' + context.RegisterCodeFix(CodeAction.Create( + CodeFixesResources.Add_explicit_cast, actions.ToImmutable(), isInlinable: false), context.Diagnostics); +#pragma warning restore RS0005 // Do not use generic 'CodeAction.Create' to create 'CodeAction' } private static string GetSubItemName(SemanticModel semanticModel, int position, ITypeSymbol conversionType) { return string.Format( - FeaturesResources.Convert_type_to_0, + CodeFixesResources.Convert_type_to_0, conversionType.ToMinimalDisplayString(semanticModel, position)); } - private static void ReportTelemetryIfNecessary(ImmutableArray<(TExpressionSyntax node, ITypeSymbol type)> potentialConversionTypes) - { - if (potentialConversionTypes.Length > MaximumConversionOptions) - { - // If the number of potential conversion types is larger than options we could show, report telemetry - Logger.Log(FunctionId.CodeFixes_AddExplicitCast, - KeyValueLogMessage.Create(m => - { - m["NumberOfCandidates"] = potentialConversionTypes.Length; - })); - } - } - protected ImmutableArray<(TExpressionSyntax, ITypeSymbol)> FilterValidPotentialConversionTypes( SemanticModel semanticModel, ArrayBuilder<(TExpressionSyntax node, ITypeSymbol type)> mutablePotentialConversionTypes) @@ -195,7 +182,7 @@ await editor.ApplyExpressionLevelSemanticEditsAsync( cancellationToken).ConfigureAwait(false); } - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(string title, Func> createChangedDocument) : base(title, createChangedDocument, equivalenceKey: title) diff --git a/src/Features/Core/Portable/CodeFixes/AddExplicitCast/Fixer.cs b/src/Analyzers/Core/CodeFixes/AddExplicitCast/Fixer.cs similarity index 100% rename from src/Features/Core/Portable/CodeFixes/AddExplicitCast/Fixer.cs rename to src/Analyzers/Core/CodeFixes/AddExplicitCast/Fixer.cs diff --git a/src/Features/Core/Portable/CodeFixes/AddExplicitCast/InheritanceDistanceComparer.cs b/src/Analyzers/Core/CodeFixes/AddExplicitCast/InheritanceDistanceComparer.cs similarity index 100% rename from src/Features/Core/Portable/CodeFixes/AddExplicitCast/InheritanceDistanceComparer.cs rename to src/Analyzers/Core/CodeFixes/AddExplicitCast/InheritanceDistanceComparer.cs diff --git a/src/Features/Core/Portable/AddObsoleteAttribute/AbstractAddObsoleteAttributeCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/AddObsoleteAttribute/AbstractAddObsoleteAttributeCodeFixProvider.cs similarity index 98% rename from src/Features/Core/Portable/AddObsoleteAttribute/AbstractAddObsoleteAttributeCodeFixProvider.cs rename to src/Analyzers/Core/CodeFixes/AddObsoleteAttribute/AbstractAddObsoleteAttributeCodeFixProvider.cs index 3d8a78d4c50c4..b4bd6be309ed4 100644 --- a/src/Features/Core/Portable/AddObsoleteAttribute/AbstractAddObsoleteAttributeCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/AddObsoleteAttribute/AbstractAddObsoleteAttributeCodeFixProvider.cs @@ -98,7 +98,7 @@ protected override async Task FixAllAsync( } } - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(string title, Func> createChangedDocument) : base(title, createChangedDocument, title) diff --git a/src/Features/Core/Portable/AliasAmbiguousType/AbstractAliasAmbiguousTypeCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/AliasAmbiguousType/AbstractAliasAmbiguousTypeCodeFixProvider.cs similarity index 89% rename from src/Features/Core/Portable/AliasAmbiguousType/AbstractAliasAmbiguousTypeCodeFixProvider.cs rename to src/Analyzers/Core/CodeFixes/AliasAmbiguousType/AbstractAliasAmbiguousTypeCodeFixProvider.cs index ece6c991a3617..0fce4d443c171 100644 --- a/src/Features/Core/Portable/AliasAmbiguousType/AbstractAliasAmbiguousTypeCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/AliasAmbiguousType/AbstractAliasAmbiguousTypeCodeFixProvider.cs @@ -10,11 +10,9 @@ using Microsoft.CodeAnalysis.AddImport; using Microsoft.CodeAnalysis.CodeActions; using Microsoft.CodeAnalysis.CodeFixes; -using Microsoft.CodeAnalysis.CodeGeneration; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.LanguageServices; using Microsoft.CodeAnalysis.Shared.Extensions; -using static Microsoft.CodeAnalysis.CodeActions.CodeAction; namespace Microsoft.CodeAnalysis.AliasAmbiguousType { @@ -44,8 +42,8 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) { var addImportService = document.GetRequiredLanguageService(); var syntaxGenerator = document.GetRequiredLanguageService(); - var codeGenerator = document.GetRequiredLanguageService(); var compilation = semanticModel.Compilation; + var options = await AddImportPlacementOptions.FromDocumentAsync(document, cancellationToken).ConfigureAwait(false); var codeActionsBuilder = ImmutableArray.CreateBuilder(symbolInfo.CandidateSymbols.Length); @@ -61,8 +59,10 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) })); } - var groupingTitle = string.Format(FeaturesResources.Alias_ambiguous_type_0, diagnosticNode.ToString()); - var groupingCodeAction = new CodeActionWithNestedActions(groupingTitle, codeActionsBuilder.ToImmutable(), isInlinable: true); + var groupingTitle = string.Format(CodeFixesResources.Alias_ambiguous_type_0, diagnosticNode.ToString()); +#pragma warning disable RS0005 // Do not use generic 'CodeAction.Create' to create 'CodeAction' + var groupingCodeAction = CodeAction.Create(groupingTitle, codeActionsBuilder.ToImmutable(), isInlinable: true); +#pragma warning restore RS0005 // Do not use generic 'CodeAction.Create' to create 'CodeAction' context.RegisterCodeFix(groupingCodeAction, context.Diagnostics.First()); } } @@ -75,7 +75,7 @@ private static bool SymbolCandidatesContainsSupportedSymbols(SymbolInfo symbolIn symbolInfo.CandidateSymbols.All(symbol => symbol.IsKind(SymbolKind.NamedType) && symbol.GetArity() == 0); - private class MyCodeAction : DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(string title, Func> createChangedDocument) : base(title, createChangedDocument, equivalenceKey: title) diff --git a/src/Analyzers/Core/CodeFixes/CodeFixes.projitems b/src/Analyzers/Core/CodeFixes/CodeFixes.projitems index 971c8d54931eb..fa25f72d257e9 100644 --- a/src/Analyzers/Core/CodeFixes/CodeFixes.projitems +++ b/src/Analyzers/Core/CodeFixes/CodeFixes.projitems @@ -16,10 +16,18 @@ + + + + + + + + @@ -34,6 +42,7 @@ + diff --git a/src/Analyzers/Core/CodeFixes/CodeFixesResources.resx b/src/Analyzers/Core/CodeFixes/CodeFixesResources.resx index 9857123d0b852..3c0e61872ce16 100644 --- a/src/Analyzers/Core/CodeFixes/CodeFixesResources.resx +++ b/src/Analyzers/Core/CodeFixes/CodeFixesResources.resx @@ -153,4 +153,19 @@ Add blank line after block + + Make class 'abstract' + + + Make static + + + Add explicit cast + + + Alias ambiguous type '{0}' + + + Convert type to '{0}' + \ No newline at end of file diff --git a/src/Features/Core/Portable/CodeFixes/Iterator/AbstractIteratorCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/Iterator/AbstractIteratorCodeFixProvider.cs similarity index 100% rename from src/Features/Core/Portable/CodeFixes/Iterator/AbstractIteratorCodeFixProvider.cs rename to src/Analyzers/Core/CodeFixes/Iterator/AbstractIteratorCodeFixProvider.cs diff --git a/src/Features/Core/Portable/MakeMemberStatic/AbstractMakeMemberStaticCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/MakeMemberStatic/AbstractMakeMemberStaticCodeFixProvider.cs similarity index 91% rename from src/Features/Core/Portable/MakeMemberStatic/AbstractMakeMemberStaticCodeFixProvider.cs rename to src/Analyzers/Core/CodeFixes/MakeMemberStatic/AbstractMakeMemberStaticCodeFixProvider.cs index 9e1ebb32365e3..0c6e2d1b26f31 100644 --- a/src/Features/Core/Portable/MakeMemberStatic/AbstractMakeMemberStaticCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/MakeMemberStatic/AbstractMakeMemberStaticCodeFixProvider.cs @@ -51,10 +51,10 @@ protected sealed override Task FixAllAsync(Document document, ImmutableArray> createChangedDocument) - : base(FeaturesResources.Make_member_static, createChangedDocument, nameof(AbstractMakeMemberStaticCodeFixProvider)) + : base(CodeFixesResources.Make_member_static, createChangedDocument, nameof(AbstractMakeMemberStaticCodeFixProvider)) { } } diff --git a/src/Features/Core/Portable/MakeClassAbstract/AbstractMakeTypeAbstractCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/MakeTypeAbstract/AbstractMakeTypeAbstractCodeFixProvider.cs similarity index 92% rename from src/Features/Core/Portable/MakeClassAbstract/AbstractMakeTypeAbstractCodeFixProvider.cs rename to src/Analyzers/Core/CodeFixes/MakeTypeAbstract/AbstractMakeTypeAbstractCodeFixProvider.cs index 357c93d403cf8..75c8067315b4f 100644 --- a/src/Features/Core/Portable/MakeClassAbstract/AbstractMakeTypeAbstractCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/MakeTypeAbstract/AbstractMakeTypeAbstractCodeFixProvider.cs @@ -48,10 +48,10 @@ protected sealed override Task FixAllAsync(Document document, ImmutableArray> createChangedDocument) - : base(FeaturesResources.Make_class_abstract, createChangedDocument, FeaturesResources.Make_class_abstract) + : base(CodeFixesResources.Make_class_abstract, createChangedDocument, CodeFixesResources.Make_class_abstract) { } } diff --git a/src/Features/Core/Portable/UnsealClass/AbstractUnsealClassCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UnsealClass/AbstractUnsealClassCodeFixProvider.cs similarity index 94% rename from src/Features/Core/Portable/UnsealClass/AbstractUnsealClassCodeFixProvider.cs rename to src/Analyzers/Core/CodeFixes/UnsealClass/AbstractUnsealClassCodeFixProvider.cs index 15ddf33896e86..d0f0843212cf1 100644 --- a/src/Features/Core/Portable/UnsealClass/AbstractUnsealClassCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UnsealClass/AbstractUnsealClassCodeFixProvider.cs @@ -62,8 +62,8 @@ private static async Task UnsealDeclarationsAsync( var document = solution.GetDocument(documentId); var root = await document.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); - var generator = SyntaxGenerator.GetGenerator(document); - var editor = new SyntaxEditor(root, generator); + var editor = new SyntaxEditor(root, document.Project.Solution.Workspace.Services); + var generator = editor.Generator; foreach (var syntaxReference in syntaxReferences) { @@ -84,7 +84,7 @@ private static async Task UnsealDeclarationsAsync( return solution; } - private sealed class MyCodeAction : CodeAction.SolutionChangeAction + private sealed class MyCodeAction : CustomCodeActions.SolutionChangeAction { public MyCodeAction(string title, Func> createChangedSolution) : base(title, createChangedSolution, title) diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.cs.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.cs.xlf index f513160bcca78..f1d46eaa8a487 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.cs.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.cs.xlf @@ -17,11 +17,26 @@ Přidat výchozí malá a velká písmena + + Add explicit cast + Add explicit cast + + Add file header Přidat hlavičku souboru + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} Opravit porušení názvu: {0} @@ -32,6 +47,16 @@ Opravit všechny výskyty v + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines Odebrat nadbytečné prázdné řádky diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.de.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.de.xlf index 6c1c949498e92..7051f2740563b 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.de.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.de.xlf @@ -17,11 +17,26 @@ Standardfall hinzufügen + + Add explicit cast + Add explicit cast + + Add file header Dateiheader hinzufügen + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} Namensverletzung beheben: {0} @@ -32,6 +47,16 @@ Alle Vorkommen korrigieren in + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines Zusätzliche Leerzeilen entfernen diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.es.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.es.xlf index 116cdf3341129..f469e799bbad0 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.es.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.es.xlf @@ -17,11 +17,26 @@ Agregar caso predeterminado + + Add explicit cast + Add explicit cast + + Add file header Agregar encabezado de archivo + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} Corregir infracción de nombre: {0} @@ -32,6 +47,16 @@ Corregir todas las repeticiones de + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines Quitar líneas en blanco adicionales diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.fr.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.fr.xlf index 999860c862be7..1b3ce6953fcb4 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.fr.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.fr.xlf @@ -17,11 +17,26 @@ Ajouter une instruction case par défaut + + Add explicit cast + Add explicit cast + + Add file header Ajouter un en-tête de fichier + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} Corrigez la violation de nom : {0} @@ -32,6 +47,16 @@ Corriger toutes les occurrences dans + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines Supprimer les lignes vides supplémentaires diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.it.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.it.xlf index 285347878befa..6f36a4b5bc264 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.it.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.it.xlf @@ -17,11 +17,26 @@ Aggiungi case predefinito + + Add explicit cast + Add explicit cast + + Add file header Aggiungi intestazione del file + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} Correggi violazione del nome: {0} @@ -32,6 +47,16 @@ Correggi tutte le occorrenze in + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines Rimuovere le righe vuote aggiuntive diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ja.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ja.xlf index e4ef801ccad9a..195db67931daa 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ja.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ja.xlf @@ -17,11 +17,26 @@ 既定のケースの追加 + + Add explicit cast + Add explicit cast + + Add file header ファイル ヘッダーの追加 + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} 名前の違反を修正します: {0} @@ -32,6 +47,16 @@ 次の場所のすべての出現箇所を修正します + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines 余分な空白行を削除する diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ko.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ko.xlf index e174524f20fe7..c21ec38737e9c 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ko.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ko.xlf @@ -17,11 +17,26 @@ Default Case 추가 + + Add explicit cast + Add explicit cast + + Add file header 파일 헤더 추가 + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} 이름 위반 수정: {0} @@ -32,6 +47,16 @@ 다음 위치에서 모든 발생 수정 + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines 여분의 빈 줄 제거 diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.pl.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.pl.xlf index 6a4a2b355e4b2..50e53701d06f4 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.pl.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.pl.xlf @@ -17,11 +17,26 @@ Dodaj przypadek domyślny + + Add explicit cast + Add explicit cast + + Add file header Dodaj nagłówek pliku + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} Napraw naruszenie nazwy: {0} @@ -32,6 +47,16 @@ Popraw wszystkie wystąpienia w + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines Usuń dodatkowe puste wiersze diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.pt-BR.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.pt-BR.xlf index 35a026587a205..ce6563944f78f 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.pt-BR.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.pt-BR.xlf @@ -17,11 +17,26 @@ Adicionar caso padrão + + Add explicit cast + Add explicit cast + + Add file header Adicionar cabeçalho de arquivo + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} Corrigir Violação de Nome: {0} @@ -32,6 +47,16 @@ Corrigir todas as ocorrências em + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines Remover as linhas em branco extras diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ru.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ru.xlf index 24244e45814d7..da43079f786d4 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ru.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.ru.xlf @@ -17,11 +17,26 @@ Добавить вариант по умолчанию + + Add explicit cast + Add explicit cast + + Add file header Добавить заголовок файла + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} Устраните нарушение имени: {0} @@ -32,6 +47,16 @@ Исправить все случаи в + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines Удалите лишние пустые строки diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.tr.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.tr.xlf index bb01059ece2fc..78761eaa4d24f 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.tr.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.tr.xlf @@ -17,11 +17,26 @@ Varsayılan durum ekle + + Add explicit cast + Add explicit cast + + Add file header Dosya üst bilgisi ekle + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} Ad İhlalini Düzelt: {0} @@ -32,6 +47,16 @@ Tüm oluşumları şurada düzelt: + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines Fazladan boş satırları kaldır diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.zh-Hans.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.zh-Hans.xlf index 103cd6f3e2692..b06f3de0d2d11 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.zh-Hans.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.zh-Hans.xlf @@ -17,11 +17,26 @@ 添加默认事例 + + Add explicit cast + Add explicit cast + + Add file header 添加文件头 + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} 解决名称冲突: {0} @@ -32,6 +47,16 @@ 修复以下对象中的所有实例: + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines 删除多余的空白行 diff --git a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.zh-Hant.xlf b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.zh-Hant.xlf index c8e0aaecad5ca..a9ebe5d8148d2 100644 --- a/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.zh-Hant.xlf +++ b/src/Analyzers/Core/CodeFixes/xlf/CodeFixesResources.zh-Hant.xlf @@ -17,11 +17,26 @@ 新增預設案例 + + Add explicit cast + Add explicit cast + + Add file header 新增檔案標頭 + + Alias ambiguous type '{0}' + Alias ambiguous type '{0}' + + + + Convert type to '{0}' + Convert type to '{0}' + + Fix Name Violation: {0} 修正名稱違規: {0} @@ -32,6 +47,16 @@ 修正所有出現之處於 + + Make class 'abstract' + Make class 'abstract' + + + + Make static + Make static + + Remove extra blank lines 移除額外的空白行 diff --git a/src/Features/VisualBasic/Portable/CodeFixes/AddExplicitCast/ArgumentFixer.vb b/src/Analyzers/VisualBasic/CodeFixes/AddExplicitCast/ArgumentFixer.vb similarity index 100% rename from src/Features/VisualBasic/Portable/CodeFixes/AddExplicitCast/ArgumentFixer.vb rename to src/Analyzers/VisualBasic/CodeFixes/AddExplicitCast/ArgumentFixer.vb diff --git a/src/Features/VisualBasic/Portable/CodeFixes/AddExplicitCast/VisualBasicAddExplicitCastCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/AddExplicitCast/VisualBasicAddExplicitCastCodeFixProvider.vb similarity index 100% rename from src/Features/VisualBasic/Portable/CodeFixes/AddExplicitCast/VisualBasicAddExplicitCastCodeFixProvider.vb rename to src/Analyzers/VisualBasic/CodeFixes/AddExplicitCast/VisualBasicAddExplicitCastCodeFixProvider.vb diff --git a/src/Features/VisualBasic/Portable/AddObsoleteAttribute/VisualBasicAddObsoleteAttributeCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/AddObsoleteAttribute/VisualBasicAddObsoleteAttributeCodeFixProvider.vb similarity index 92% rename from src/Features/VisualBasic/Portable/AddObsoleteAttribute/VisualBasicAddObsoleteAttributeCodeFixProvider.vb rename to src/Analyzers/VisualBasic/CodeFixes/AddObsoleteAttribute/VisualBasicAddObsoleteAttributeCodeFixProvider.vb index e82b885f413d5..1495980978a11 100644 --- a/src/Features/VisualBasic/Portable/AddObsoleteAttribute/VisualBasicAddObsoleteAttributeCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/AddObsoleteAttribute/VisualBasicAddObsoleteAttributeCodeFixProvider.vb @@ -23,7 +23,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.AddObsoleteAttribute Public Sub New() - MyBase.New(VisualBasicSyntaxFacts.Instance, VBFeaturesResources.Add_Obsolete) + MyBase.New(VisualBasicSyntaxFacts.Instance, VisualBasicCodeFixesResources.Add_Obsolete) End Sub End Class End Namespace diff --git a/src/Features/VisualBasic/Portable/AliasAmbiguousType/VisualBasicAliasAmbiguousTypeCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/AliasAmbiguousType/VisualBasicAliasAmbiguousTypeCodeFixProvider.vb similarity index 100% rename from src/Features/VisualBasic/Portable/AliasAmbiguousType/VisualBasicAliasAmbiguousTypeCodeFixProvider.vb rename to src/Analyzers/VisualBasic/CodeFixes/AliasAmbiguousType/VisualBasicAliasAmbiguousTypeCodeFixProvider.vb diff --git a/src/Features/VisualBasic/Portable/CodeFixes/Iterator/VisualBasicChangeToYieldCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/Iterator/VisualBasicChangeToYieldCodeFixProvider.vb similarity index 90% rename from src/Features/VisualBasic/Portable/CodeFixes/Iterator/VisualBasicChangeToYieldCodeFixProvider.vb rename to src/Analyzers/VisualBasic/CodeFixes/Iterator/VisualBasicChangeToYieldCodeFixProvider.vb index 6e6f5bca36e8a..17be22a9ab349 100644 --- a/src/Features/VisualBasic/Portable/CodeFixes/Iterator/VisualBasicChangeToYieldCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/Iterator/VisualBasicChangeToYieldCodeFixProvider.vb @@ -47,10 +47,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator End Function Private Class MyCodeAction - Inherits CodeAction.DocumentChangeAction + Inherits CustomCodeActions.DocumentChangeAction Public Sub New(newDocument As Document) - MyBase.New(VBFeaturesResources.Replace_Return_with_Yield, Function(c) Task.FromResult(newDocument), NameOf(VBFeaturesResources.Replace_Return_with_Yield)) + MyBase.New(VisualBasicCodeFixesResources.Replace_Return_with_Yield, Function(c) Task.FromResult(newDocument), NameOf(VisualBasicCodeFixesResources.Replace_Return_with_Yield)) End Sub End Class End Class diff --git a/src/Features/VisualBasic/Portable/CodeFixes/Iterator/VisualBasicConvertToIteratorCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/Iterator/VisualBasicConvertToIteratorCodeFixProvider.vb similarity index 95% rename from src/Features/VisualBasic/Portable/CodeFixes/Iterator/VisualBasicConvertToIteratorCodeFixProvider.vb rename to src/Analyzers/VisualBasic/CodeFixes/Iterator/VisualBasicConvertToIteratorCodeFixProvider.vb index 38b0605e9848b..25db980a3388e 100644 --- a/src/Features/VisualBasic/Portable/CodeFixes/Iterator/VisualBasicConvertToIteratorCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/Iterator/VisualBasicConvertToIteratorCodeFixProvider.vb @@ -91,7 +91,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator If methodStatementNode IsNot Nothing AndAlso Not methodStatementNode.Modifiers.Any(SyntaxKind.IteratorKeyword) Then root = AddIteratorKeywordToMethod(root, methodStatementNode) Return New MyCodeAction( - String.Format(VBFeaturesResources.Convert_0_to_Iterator, methodStatementNode.Identifier), + String.Format(VisualBasicCodeFixesResources.Convert_0_to_Iterator, methodStatementNode.Identifier), document.WithSyntaxRoot(root)) End If Case SyntaxKind.MultiLineFunctionLambdaExpression @@ -99,7 +99,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator If lambdaNode IsNot Nothing AndAlso Not lambdaNode.SubOrFunctionHeader.Modifiers.Any(SyntaxKind.IteratorKeyword) Then root = AddIteratorKeywordToLambda(root, lambdaNode) Return New MyCodeAction( - String.Format(VBFeaturesResources.Convert_0_to_Iterator, lambdaNode.SubOrFunctionHeader.GetTypeDisplayName()), + String.Format(VisualBasicCodeFixesResources.Convert_0_to_Iterator, lambdaNode.SubOrFunctionHeader.GetTypeDisplayName()), document.WithSyntaxRoot(root)) End If Case Else @@ -137,7 +137,7 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.Iterator End Function Private Class MyCodeAction - Inherits CodeAction.DocumentChangeAction + Inherits CustomCodeActions.DocumentChangeAction Public Sub New(title As String, newDocument As Document) MyBase.New(title, Function(c) Task.FromResult(newDocument), title) diff --git a/src/Features/VisualBasic/Portable/MakeTypeAbstract/VisualBasicMakeTypeAbstractCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/MakeTypeAbstract/VisualBasicMakeTypeAbstractCodeFixProvider.vb similarity index 100% rename from src/Features/VisualBasic/Portable/MakeTypeAbstract/VisualBasicMakeTypeAbstractCodeFixProvider.vb rename to src/Analyzers/VisualBasic/CodeFixes/MakeTypeAbstract/VisualBasicMakeTypeAbstractCodeFixProvider.vb diff --git a/src/Features/VisualBasic/Portable/UnsealClass/VisualBasicUnsealClassCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/UnsealClass/VisualBasicUnsealClassCodeFixProvider.vb similarity index 96% rename from src/Features/VisualBasic/Portable/UnsealClass/VisualBasicUnsealClassCodeFixProvider.vb rename to src/Analyzers/VisualBasic/CodeFixes/UnsealClass/VisualBasicUnsealClassCodeFixProvider.vb index 3251514ad7e82..f56b78851705c 100644 --- a/src/Features/VisualBasic/Portable/UnsealClass/VisualBasicUnsealClassCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/UnsealClass/VisualBasicUnsealClassCodeFixProvider.vb @@ -23,6 +23,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UnsealClass Public Overrides ReadOnly Property FixableDiagnosticIds As ImmutableArray(Of String) = ImmutableArray.Create(BC30299) - Protected Overrides ReadOnly Property TitleFormat As String = VBFeaturesResources.Make_0_inheritable + Protected Overrides ReadOnly Property TitleFormat As String = VisualBasicCodeFixesResources.Make_0_inheritable End Class End Namespace diff --git a/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixes.projitems b/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixes.projitems index 2882f7ce4c4e4..917b1bda5b7b1 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixes.projitems +++ b/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixes.projitems @@ -15,9 +15,16 @@ + + + + + + + @@ -30,6 +37,7 @@ + diff --git a/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixesResources.resx b/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixesResources.resx index 55cf90dc087a5..ce337e1ef8f63 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixesResources.resx +++ b/src/Analyzers/VisualBasic/CodeFixes/VisualBasicCodeFixesResources.resx @@ -129,4 +129,16 @@ Simplify object creation + + Add <Obsolete> + + + Convert {0} to Iterator + + + Make '{0}' inheritable + + + Replace 'Return' with 'Yield + \ No newline at end of file diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.cs.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.cs.xlf index 84601eed62114..7d459d7230421 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.cs.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.cs.xlf @@ -7,16 +7,36 @@ Přidejte položku Me. + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' Převést GetType na NameOf + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports Odebrat nepotřebné importy + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation Zjednodušit vytváření objektů diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.de.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.de.xlf index faa2d2fbc9306..4dcd262217d23 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.de.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.de.xlf @@ -7,16 +7,36 @@ "Me." hinzufügen + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' "GetType" in "NameOf" konvertieren + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports Unnötige Import-Direktiven entfernen + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation Objekterstellung vereinfachen diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.es.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.es.xlf index 54c6b14762674..ee3bb962cdaf4 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.es.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.es.xlf @@ -7,16 +7,36 @@ Agregar "Me." + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' Convertir "GetType" en "NameOf" + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports Quitar instrucciones Import innecesarias + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation Simplificar la creación de objetos diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.fr.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.fr.xlf index 8584f5b3e86dc..c13c35e4233f1 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.fr.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.fr.xlf @@ -7,16 +7,36 @@ Ajouter 'Me.' + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' Convertir 'GetType' en 'NameOf' + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports Supprimer les importations superflues + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation Simplifier la création d’objets diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.it.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.it.xlf index 67b10955fea03..e2f454f38403a 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.it.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.it.xlf @@ -7,16 +7,36 @@ Aggiungi 'Me.' + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' Convertire 'GetType' in 'NameOf' + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports Rimuovi Import non necessari + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation Semplificare la creazione di oggetti diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ja.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ja.xlf index 26edc1d2dd6f9..4fedbe676ed57 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ja.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ja.xlf @@ -7,16 +7,36 @@ Me' を追加します。 + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' 'GetType' を 'NameOf' に変換します + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports 不要なインポートの削除 + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation オブジェクトの作成を簡略化 diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ko.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ko.xlf index a201d73df723c..bc96be94a15ab 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ko.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ko.xlf @@ -7,16 +7,36 @@ Me'를 추가하세요. + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' 'GetType'을 'NameOf'로 변환 + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports 불필요한 Imports 제거 + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation 개체 만들기 간소화 diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.pl.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.pl.xlf index bfdf2192dc0ba..7d42c04f2765a 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.pl.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.pl.xlf @@ -7,16 +7,36 @@ Dodaj „mnie”. + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' Konwertuj element „GetType” na element „NameOf” + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports Usuń niepotrzebne importy + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation Upraszczanie tworzenia obiektu diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.pt-BR.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.pt-BR.xlf index 2120c17d3b82c..c3c71fba1689e 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.pt-BR.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.pt-BR.xlf @@ -7,16 +7,36 @@ Adicionar 'Me.' + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' Converter 'GetType' em 'NameOf' + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports Remover Importações Desnecessárias + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation Simplifique a criação de objetos diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ru.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ru.xlf index 4d8d6ac6363a6..4d21b318e9b85 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ru.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.ru.xlf @@ -7,16 +7,36 @@ Добавьте "Me". + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' Преобразовать "GetType" в "NameOf" + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports Удалить ненужные импорты + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation Упрощение создания объектов diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.tr.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.tr.xlf index 814c8d6d6b6ef..e16cd9c3d36a2 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.tr.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.tr.xlf @@ -7,16 +7,36 @@ Me' ekleyin. + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' 'GetType' metodunu 'NameOf' metoduna dönüştürün + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports Gereksiz İçeri Aktarmaları Kaldır + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation Nesne oluşturmayı basitleştir diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.zh-Hans.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.zh-Hans.xlf index 8e9c0c2dc3775..d1a99eb2ee707 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.zh-Hans.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.zh-Hans.xlf @@ -7,16 +7,36 @@ 添加 "Me." + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' 将 "GetType" 转换为 "NameOf" + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports 删除不必要的导入 + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation 简化对象创建 diff --git a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.zh-Hant.xlf b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.zh-Hant.xlf index 7f22ec3062619..cb2c1f91f3bce 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.zh-Hant.xlf +++ b/src/Analyzers/VisualBasic/CodeFixes/xlf/VisualBasicCodeFixesResources.zh-Hant.xlf @@ -7,16 +7,36 @@ 新增 'Me.' + + Add <Obsolete> + Add <Obsolete> + + + + Convert {0} to Iterator + Convert {0} to Iterator + + Convert 'GetType' to 'NameOf' 將 'GetType' 轉換為 'NameOf' + + Make '{0}' inheritable + Make '{0}' inheritable + + Remove Unnecessary Imports 移除不必要的匯入 + + Replace 'Return' with 'Yield + Replace 'Return' with 'Yield + + Simplify object creation 簡化物件建立 diff --git a/src/EditorFeatures/VisualBasicTest/Diagnostics/AddExplicitCast/AddExplicitCastTests.vb b/src/Analyzers/VisualBasic/Tests/AddExplicitCast/AddExplicitCastTests.vb similarity index 99% rename from src/EditorFeatures/VisualBasicTest/Diagnostics/AddExplicitCast/AddExplicitCastTests.vb rename to src/Analyzers/VisualBasic/Tests/AddExplicitCast/AddExplicitCastTests.vb index 0a7006780d35f..daaf165d1f54b 100644 --- a/src/EditorFeatures/VisualBasicTest/Diagnostics/AddExplicitCast/AddExplicitCastTests.vb +++ b/src/Analyzers/VisualBasic/Tests/AddExplicitCast/AddExplicitCastTests.vb @@ -2959,10 +2959,10 @@ Class Program End Class End Class" Await TestInRegularAndScriptAsync(initialMarkup, String.Format(expect_format, "Derived"), index:=0, - title:=String.Format(FeaturesResources.Convert_type_to_0, "Derived")) + title:=String.Format(CodeFixesResources.Convert_type_to_0, "Derived")) Await TestInRegularAndScriptAsync(initialMarkup, String.Format(expect_format, "Derived2"), index:=1, - title:=String.Format(FeaturesResources.Convert_type_to_0, "Derived2")) + title:=String.Format(CodeFixesResources.Convert_type_to_0, "Derived2")) End Function @@ -3025,10 +3025,10 @@ Class Program End Class End Class" Await TestInRegularAndScriptAsync(initialMarkup, String.Format(expect_format, "Derived"), index:=0, - title:=String.Format(FeaturesResources.Convert_type_to_0, "Derived")) + title:=String.Format(CodeFixesResources.Convert_type_to_0, "Derived")) Await TestInRegularAndScriptAsync(initialMarkup, String.Format(expect_format, "Derived2"), index:=1, - title:=String.Format(FeaturesResources.Convert_type_to_0, "Derived2")) + title:=String.Format(CodeFixesResources.Convert_type_to_0, "Derived2")) End Function @@ -3220,13 +3220,13 @@ Class Program End Class" Await TestInRegularAndScriptAsync(initialMarkup, String.Format(expect_format, "CStr(b)"), index:=0, - title:=String.Format(FeaturesResources.Convert_type_to_0, "String")) + title:=String.Format(CodeFixesResources.Convert_type_to_0, "String")) Await TestInRegularAndScriptAsync(initialMarkup, String.Format(expect_format, "CType(b, Derived)"), index:=1, - title:=String.Format(FeaturesResources.Convert_type_to_0, "Derived")) + title:=String.Format(CodeFixesResources.Convert_type_to_0, "Derived")) Await TestInRegularAndScriptAsync(initialMarkup, String.Format(expect_format, "CType(b, Derived2)"), index:=2, - title:=String.Format(FeaturesResources.Convert_type_to_0, "Derived2")) + title:=String.Format(CodeFixesResources.Convert_type_to_0, "Derived2")) End Function diff --git a/src/EditorFeatures/VisualBasicTest/Diagnostics/AddExplicitCast/AddExplicitCastTests_FixAllTests.vb b/src/Analyzers/VisualBasic/Tests/AddExplicitCast/AddExplicitCastTests_FixAllTests.vb similarity index 100% rename from src/EditorFeatures/VisualBasicTest/Diagnostics/AddExplicitCast/AddExplicitCastTests_FixAllTests.vb rename to src/Analyzers/VisualBasic/Tests/AddExplicitCast/AddExplicitCastTests_FixAllTests.vb diff --git a/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems b/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems index 74d64f96eef64..9d44e1576f130 100644 --- a/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems +++ b/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems @@ -10,6 +10,8 @@ + + diff --git a/src/Features/CSharp/Portable/CSharpFeaturesResources.resx b/src/Features/CSharp/Portable/CSharpFeaturesResources.resx index f044789c39656..99f8a8bc3e28a 100644 --- a/src/Features/CSharp/Portable/CSharpFeaturesResources.resx +++ b/src/Features/CSharp/Portable/CSharpFeaturesResources.resx @@ -126,10 +126,6 @@ Invert if - - Add 'await' - {Locked="await"} "await" is a C# keyword and should not be localized. - Add 'await' and 'ConfigureAwait(false)' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -170,12 +166,6 @@ Autoselect disabled due to potential range variable declaration. - - Declare as nullable - - - Fix return type - Simplify name '{0}' @@ -248,12 +238,6 @@ Make {0} return Task instead of void. - - Change return type from {0} to {1} - - - Replace return with yield return - Generate explicit conversion operator in '{0}' @@ -435,9 +419,6 @@ The name '{0}' does not exist in the current context. - - Hide base member - Remove 'new' modifier @@ -513,9 +494,6 @@ Allow unsafe code in this project - - Add [Obsolete] - Convert to method @@ -545,9 +523,6 @@ Introduce 'using' statement {Locked="using"} "using" is a C# keyword and should not be localized. - - Unseal class '{0}' - Make 'ref struct' {Locked="ref"}{Locked="struct"} "ref" and "struct" are C# keywords and should not be localized. @@ -586,12 +561,6 @@ Convert to verbatim string - - Assign to '{0}' - - - Compare to '{0}' - Apply preferred 'using' placement preferences 'using' is a C# keyword and should not be localized @@ -681,4 +650,8 @@ Apply 'var' preferences + + Add 'await' + {Locked="await"} "await" is a C# keyword and should not be localized. + \ No newline at end of file diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf index 85c8bbbd044d4..a2a63388c075c 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf @@ -4,7 +4,7 @@ Add 'await' - Přidat await + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ Přiřadit parametry out (při spuštění) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - Přiřadit k {0} - - Autoselect disabled due to potential pattern variable declaration. Automatický výběr je zakázaný kvůli možné deklaraci proměnné vzoru. @@ -167,11 +162,6 @@ Změnit na přetypování - - Compare to '{0}' - Porovnat s {0} - - Convert to method Převést na metodu @@ -207,21 +197,11 @@ Převést na doslovný řetězec - - Declare as nullable - Deklarovat jako s možnou hodnotou null - - Enable nullable reference types in project Povolit v projektu typy odkazů s možnou hodnotou null - - Fix return type - Opravit návratový typ - - Inline temporary variable Dočasná vložená proměnná @@ -277,11 +257,6 @@ Zjednodušit všechny výskyty - - Unseal class '{0}' - Rozpečetit třídu {0} - - Use recursive patterns Použít rekurzivní vzory @@ -487,16 +462,6 @@ Nastavit, že {0} má místo hodnoty typu Void vracet hodnotu Task - - Change return type from {0} to {1} - Změnit typ návratové hodnoty z: {0} na: {1} - - - - Replace return with yield return - Nahradit příkaz return příkazem yield return - - Generate explicit conversion operator in '{0}' Generovat explicitní operátor převodu v {0} @@ -737,11 +702,6 @@ Název {0} v aktuálním kontextu neexistuje. - - Hide base member - Skrýt základního člena - - Properties Vlastnosti @@ -847,11 +807,6 @@ Invertovat if - - Add [Obsolete] - Přidat [Obsolete] - - Use '{0}' Použít {0} diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf index c12082919f2b8..931af921e0572 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf @@ -4,7 +4,7 @@ Add 'await' - "await" hinzufügen + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ out-Parameter zuweisen (beim Start) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - "{0}" zuweisen - - Autoselect disabled due to potential pattern variable declaration. Automatische Auswahl aufgrund einer potenziellen Mustervariablendeklaration deaktiviert. @@ -167,11 +162,6 @@ In "cast" ändern - - Compare to '{0}' - Mit "{0}" vergleichen - - Convert to method In Methode konvertieren @@ -207,21 +197,11 @@ In ausführliche Zeichenfolge konvertieren - - Declare as nullable - Als für NULL-Werte zulässig deklarieren - - Enable nullable reference types in project Nullwerte zulassende Verweistypen im Projekt aktivieren - - Fix return type - Rückgabetyp korrigieren - - Inline temporary variable Inline temporär variabel @@ -277,11 +257,6 @@ Alle Vorkommen vereinfachen - - Unseal class '{0}' - Versiegelung der Klasse "{0}" aufheben - - Use recursive patterns Verwenden rekursiver Muster @@ -487,16 +462,6 @@ "{0}" in Rückgabeaufgabe umwandeln, statt leer zu lassen. - - Change return type from {0} to {1} - Rückgabetyp von "{0}" in "{1}" ändern - - - - Replace return with yield return - "return" durch "yield return" ersetzen - - Generate explicit conversion operator in '{0}' Expliziten Konversionsoperator in '{0}' generieren @@ -737,11 +702,6 @@ Der Name "{0}" ist im aktuellen Kontext nicht vorhanden. - - Hide base member - Basismember ausblenden - - Properties Eigenschaften @@ -847,11 +807,6 @@ "If" umkehren - - Add [Obsolete] - Hinzufügen [veraltet] - - Use '{0}' "{0}" verwenden diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf index 80ab9c22659f4..22afeae81b95b 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf @@ -4,7 +4,7 @@ Add 'await' - Agregar "await" + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ Asignar parámetros "out" (al inicio) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - Asignar a "{0}" - - Autoselect disabled due to potential pattern variable declaration. La selección automática se ha deshabilitado debido a una posible declaración de variable de patrón. @@ -167,11 +162,6 @@ Cambiar a cast - - Compare to '{0}' - Comparar con "{0}" - - Convert to method Convertir al método @@ -207,21 +197,11 @@ Convertir en cadena textual - - Declare as nullable - Declara como que acepta valores NULL - - Enable nullable reference types in project Habilitar tipos de referencia que aceptan valores NULL en el proyecto - - Fix return type - Corregir tipo de valor devuelto - - Inline temporary variable Variable temporal en línea @@ -277,11 +257,6 @@ Simplificar todas las repeticiones - - Unseal class '{0}' - Quitar el sello de la clase "{0}" - - Use recursive patterns Usar patrones recursivos @@ -487,16 +462,6 @@ Hacer que {0} devuelva Tarea en lugar de void. - - Change return type from {0} to {1} - Cambiar el tipo de valor devuelto de {0} a {1} - - - - Replace return with yield return - Reemplazar return por yield return - - Generate explicit conversion operator in '{0}' Generar operador de conversión explícito en '{0}' @@ -737,11 +702,6 @@ El nombre '{0}' no existe en el contexto actual. - - Hide base member - Ocultar miembro base - - Properties Propiedades @@ -847,11 +807,6 @@ Invertir If - - Add [Obsolete] - Agregar [obsoleto] - - Use '{0}' Usar "{0}" diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf index 01e211a5331a2..43e9f8d7566b7 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf @@ -4,7 +4,7 @@ Add 'await' - Ajouter 'await' + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ Assigner des paramètres 'out' (au début) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - Affecter à '{0}' - - Autoselect disabled due to potential pattern variable declaration. Sélection automatique désactivée en raison d'une déclaration de variable de modèle éventuelle. @@ -167,11 +162,6 @@ Changer en cast - - Compare to '{0}' - Comparer à '{0}' - - Convert to method Convertir en méthode @@ -207,21 +197,11 @@ Convertir en chaîne verbatim - - Declare as nullable - Déclarer comme nullable - - Enable nullable reference types in project Activer les types de référence nullables dans le projet - - Fix return type - Corriger le type de retour - - Inline temporary variable Variable temporaire inline @@ -277,11 +257,6 @@ Simplifier toutes les occurrences - - Unseal class '{0}' - Classe unsealed '{0}' - - Use recursive patterns Utiliser des modèles récursifs @@ -487,16 +462,6 @@ {0} doit retourner Task au lieu de void. - - Change return type from {0} to {1} - Changer le type de retour de {0} en {1} - - - - Replace return with yield return - Remplacer return par yield return - - Generate explicit conversion operator in '{0}' Générer l’opérateur de conversion explicite dans « {0} » @@ -737,11 +702,6 @@ Le nom '{0}' n'existe pas dans le contexte actuel. - - Hide base member - Masquer le membre de base - - Properties Propriétés @@ -847,11 +807,6 @@ Inverser si - - Add [Obsolete] - Ajouter [obsolète] - - Use '{0}' Utiliser '{0}' diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf index b9c2e6a6c5a2b..af173240fc50a 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf @@ -4,7 +4,7 @@ Add 'await' - Aggiungi 'await' + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ Assegnare parametri 'out' (all'inizio) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - Assegna a '{0}' - - Autoselect disabled due to potential pattern variable declaration. La selezione automatica è disabilitata a causa di una potenziale dichiarazione della variabile di criterio. @@ -167,11 +162,6 @@ Cambia in cast - - Compare to '{0}' - Confronta con '{0}' - - Convert to method Converti in metodo @@ -207,21 +197,11 @@ Converti in stringa verbatim - - Declare as nullable - Dichiara come nullable - - Enable nullable reference types in project Abilita tipi riferimento nullable nel progetto - - Fix return type - Correggi il tipo restituito - - Inline temporary variable Variabile temporanea inline @@ -277,11 +257,6 @@ Semplifica tutte le occorrenze - - Unseal class '{0}' - Rimuovi seal dalla classe '{0}' - - Use recursive patterns Usa criteri ricorsivi @@ -487,16 +462,6 @@ Fa in modo che {0} restituisca Task invece di void. - - Change return type from {0} to {1} - Modifica il tipo restituito da {0} in {1} - - - - Replace return with yield return - Sostituisce return con yield return - - Generate explicit conversion operator in '{0}' Genera l'operatore di conversione esplicito in '{0}' @@ -737,11 +702,6 @@ Il nome '{0}' non esiste nel contesto corrente. - - Hide base member - Nascondi il membro di base - - Properties Proprietà @@ -847,11 +807,6 @@ Inverti if - - Add [Obsolete] - Aggiungi [obsoleto] - - Use '{0}' Usa '{0}' diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf index 1f9b8b637eaff..63e42fbdfe60e 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf @@ -4,7 +4,7 @@ Add 'await' - 'await' の追加 + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ 'out' パラメーターの割り当て (開始時) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - "{0}" に割り当て - - Autoselect disabled due to potential pattern variable declaration. パターン変数宣言の可能性があるため、自動選択は無効になっています。 @@ -167,11 +162,6 @@ キャストに変更 - - Compare to '{0}' - "{0}" と比較 - - Convert to method メソッドに変換 @@ -207,21 +197,11 @@ 逐語的文字列に変換する - - Declare as nullable - Null 許容型として宣言する - - Enable nullable reference types in project プロジェクトで null 許容参照型を有効にする - - Fix return type - 戻り値の型の修正 - - Inline temporary variable インラインの一時変数 @@ -277,11 +257,6 @@ すべての出現箇所を簡素化します - - Unseal class '{0}' - クラス '{0}' のシールを解除 - - Use recursive patterns 再帰パターンを使用する @@ -487,16 +462,6 @@ {0} が void ではなくタスクを返すようにします。 - - Change return type from {0} to {1} - 戻り値の型を {0} から {1} に変更する - - - - Replace return with yield return - 戻り値を 'yield' の戻り値に置き換える - - Generate explicit conversion operator in '{0}' 明示的な変換演算子を '{0}' に生成します @@ -737,11 +702,6 @@ 名前 '{0}' は、現在のコンテキストに存在しません。 - - Hide base member - 基本メンバーを非表示にします - - Properties プロパティ @@ -847,11 +807,6 @@ if を反転する - - Add [Obsolete] - 追加 [廃止] - - Use '{0}' '{0}' を使用します diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf index 1de66d4ea5304..f98b61f0d4b8e 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf @@ -4,7 +4,7 @@ Add 'await' - 'await' 추가 + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ 'out' 매개 변수 할당(시작 시) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - '{0}'에 할당 - - Autoselect disabled due to potential pattern variable declaration. 잠재적인 패턴 변수 선언으로 인해 자동 선택을 사용하지 않도록 설정했습니다. @@ -167,11 +162,6 @@ 캐스트로 변경 - - Compare to '{0}' - '{0}'과(와) 비교 - - Convert to method 메서드로 변환 @@ -207,21 +197,11 @@ 축자 문자열로 변환 - - Declare as nullable - Nullable로 선언 - - Enable nullable reference types in project 프로젝트에서 null 허용 참조 형식 사용 - - Fix return type - 반환 형식 수정 - - Inline temporary variable 인라인 임시 변수 @@ -277,11 +257,6 @@ 모든 항목 단순화 - - Unseal class '{0}' - '{0}' 클래스 봉인 해제 - - Use recursive patterns 재귀 패턴 사용 @@ -487,16 +462,6 @@ {0}에서 void 대신 Task를 반환하도록 설정합니다. - - Change return type from {0} to {1} - 반환 형식을 {0}에서 {1}(으)로 변경 - - - - Replace return with yield return - return을 yield return으로 바꾸기 - - Generate explicit conversion operator in '{0}' '{0}'에서 명시적 변환 연산자 생성 @@ -737,11 +702,6 @@ 이름 '{0}'이(가) 현재 컨텍스트에 없습니다. - - Hide base member - 기본 멤버 숨기기 - - Properties 속성 @@ -847,11 +807,6 @@ if 반전 - - Add [Obsolete] - [Obsolete] 추가 - - Use '{0}' '{0}' 사용 diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf index fa44f615f1c3b..19ac497d5fe4f 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf @@ -4,7 +4,7 @@ Add 'await' - Dodaj operator „await” + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ Przypisz parametry „out” (na początku) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - Przypisz do „{0}” - - Autoselect disabled due to potential pattern variable declaration. Automatyczne wybieranie zostało wyłączone z powodu możliwej deklaracji zmiennej wzorca. @@ -167,11 +162,6 @@ Zmień na rzutowanie - - Compare to '{0}' - Porównaj z „{0}” - - Convert to method Konwertuj na metodę @@ -207,21 +197,11 @@ Konwertuj na ciąg dosłowny - - Declare as nullable - Zadeklaruj jako dopuszczający wartość null - - Enable nullable reference types in project Włącz typy referencyjne dopuszczające wartości null w projekcie - - Fix return type - Napraw zwracany typ - - Inline temporary variable Wstawiona zmienna tymczasowa @@ -277,11 +257,6 @@ Uprość wszystkie wystąpienia - - Unseal class '{0}' - Odpieczętuj klasę „{0}” - - Use recursive patterns Używanie wzorców rekursywnych @@ -487,16 +462,6 @@ Ustaw element {0}, aby zwracał zadanie zamiast elementu void. - - Change return type from {0} to {1} - Zmień zwracany typ z {0} na {1} - - - - Replace return with yield return - Zamień instrukcję return na instrukcję yield return - - Generate explicit conversion operator in '{0}' Generuj operator jawnej konwersji w elemencie „{0}” @@ -737,11 +702,6 @@ Nazwa „{0}” nie istnieje w bieżącym kontekście. - - Hide base member - Ukryj składową bazową - - Properties Właściwości @@ -847,11 +807,6 @@ Odwróć instrukcję if - - Add [Obsolete] - Dodaj [przestarzałe] - - Use '{0}' Użyj elementu „{0}” diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf index 7007a8aa54150..17e96e2ef6d9a 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf @@ -4,7 +4,7 @@ Add 'await' - Adicionar 'await' + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ Atribuir parâmetros 'out' (no início) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - Atribuir a '{0}' - - Autoselect disabled due to potential pattern variable declaration. Seleção automática desabilitada devido a uma possível declaração de variável de padrão. @@ -167,11 +162,6 @@ Alterar para conversão - - Compare to '{0}' - Comparar a '{0}' - - Convert to method Converter em método @@ -207,21 +197,11 @@ Converter para cadeia de caracteres verbatim - - Declare as nullable - Declarar como anulável - - Enable nullable reference types in project Habilitar os tipos de referência anuláveis no projeto - - Fix return type - Corrigir o tipo de retorno - - Inline temporary variable Variável temporária embutida @@ -277,11 +257,6 @@ Simplificar todas as ocorrências - - Unseal class '{0}' - Desselar a classe '{0}' - - Use recursive patterns Usar padrões recursivos @@ -487,16 +462,6 @@ Fazer com que {0} retorne Tarefa em vez de nulo. - - Change return type from {0} to {1} - Alterar tipo de retorno de {0} para {1} - - - - Replace return with yield return - Substituir return por yield return - - Generate explicit conversion operator in '{0}' Gerar um operador de conversão explícita em '{0}' @@ -737,11 +702,6 @@ O nome '{0}' não existe no contexto atual. - - Hide base member - Ocultar o membro base - - Properties Propriedades @@ -847,11 +807,6 @@ Inverter If - - Add [Obsolete] - Adicionar [Obsolete] - - Use '{0}' Usar '{0}' diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf index b2a6c537e66e3..f896a2388e2dd 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf @@ -4,7 +4,7 @@ Add 'await' - Добавить "await" + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ Присвоение значений параметров "out" (при запуске) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - Назначить "{0}" - - Autoselect disabled due to potential pattern variable declaration. Автовыбор отключен из-за возможного объявления переменной шаблона. @@ -167,11 +162,6 @@ Изменить на приведение - - Compare to '{0}' - Сравнить с "{0}" - - Convert to method Преобразовать в метод @@ -207,21 +197,11 @@ Преобразовать в строку verbatim - - Declare as nullable - Объявить как тип, допускающий значения null - - Enable nullable reference types in project Включить типы ссылок, допускающие значение NULL, в проекте - - Fix return type - Исправить тип возвращаемых значений - - Inline temporary variable Встроенная временная переменная @@ -277,11 +257,6 @@ Упростить все вхождения - - Unseal class '{0}' - Распечатать класс "{0}" - - Use recursive patterns Использовать рекурсивные шаблоны @@ -487,16 +462,6 @@ Сделать {0} задачей возврата вместо void. - - Change return type from {0} to {1} - Изменить тип возврата с {0} на {1} - - - - Replace return with yield return - Заменить тип возврата на yield - - Generate explicit conversion operator in '{0}' Создать явный оператор преобразования в "{0}" @@ -737,11 +702,6 @@ Имя "{0}" не существует в текущем контексте. - - Hide base member - Скрыть базовый член - - Properties Свойства @@ -847,11 +807,6 @@ Инвертировать оператор if - - Add [Obsolete] - Добавить [устарело] - - Use '{0}' Использовать "{0}" diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf index 0c473c063dddf..50888aa59f794 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf @@ -4,7 +4,7 @@ Add 'await' - 'await' ekleyin + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ 'out' parametreleri ata (başlangıçta) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - '{0}' öğesine ata - - Autoselect disabled due to potential pattern variable declaration. Otomatik seçim, olası desen değişkeni bildirimi nedeniyle devre dışı bırakıldı. @@ -167,11 +162,6 @@ Tür dönüştürme olarak değiştir - - Compare to '{0}' - '{0}' ile karşılaştır - - Convert to method Yönteme dönüştür @@ -207,21 +197,11 @@ Düz metin dizesine dönüştür - - Declare as nullable - Olarak null olabilecek ilan - - Enable nullable reference types in project Projedeki null atanabilir başvuru türlerini etkinleştir - - Fix return type - Dönüş türünü düzelt - - Inline temporary variable Satır içi geçici değişken @@ -277,11 +257,6 @@ Tüm yinelemeleri basitleştir - - Unseal class '{0}' - '{0}' sınıfının mührünü aç - - Use recursive patterns Özyinelemeli desenler kullan @@ -487,16 +462,6 @@ {0} öğesi boşluk yerine Görev döndürsün. - - Change return type from {0} to {1} - Dönüş türünü {0} değerinden {1} olarak değiştir - - - - Replace return with yield return - Dönüşü, bırakma dönüşüyle değiştir - - Generate explicit conversion operator in '{0}' '{0}' içinde açık dönüşüm işleci oluştur @@ -737,11 +702,6 @@ '{0}' adı geçerli bağlamda yok. - - Hide base member - Temel üyeyi gizle - - Properties Özellikler @@ -847,11 +807,6 @@ if ifadesini tersine çevir - - Add [Obsolete] - Ekle [Eski] - - Use '{0}' '{0}' kullan diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf index 6c100501b63c1..b233668990881 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf @@ -4,7 +4,7 @@ Add 'await' - 添加 "await" + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ 为 "out" 赋值 (在开始处) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - 赋值给 "{0}" - - Autoselect disabled due to potential pattern variable declaration. 由于可能出现模式变量声明,已禁用自动选择。 @@ -167,11 +162,6 @@ 更改为强制转换 - - Compare to '{0}' - 与 "{0}" 比较 - - Convert to method 转换为方法 @@ -207,21 +197,11 @@ 转换为逐字字符串 - - Declare as nullable - 声明成可为 null - - Enable nullable reference types in project 在项目中启用可为 null 的引用类型 - - Fix return type - 修复返回类型 - - Inline temporary variable 内联临时变量 @@ -277,11 +257,6 @@ 简化所有事件 - - Unseal class '{0}' - Unseal 类 "{0}" - - Use recursive patterns 使用递归模式 @@ -487,16 +462,6 @@ 使 {0} 返回 Task,而不是 void。 - - Change return type from {0} to {1} - 将返回类型由 {0} 改为 {1} - - - - Replace return with yield return - 用 yield return 替代 return - - Generate explicit conversion operator in '{0}' 在“{0}”中生成显示转换运算符 @@ -737,11 +702,6 @@ 当前上下文中不存在名称“{0}”。 - - Hide base member - 隐藏基成员 - - Properties 属性 @@ -847,11 +807,6 @@ 反转 if - - Add [Obsolete] - 添加 [Obsolete] - - Use '{0}' 使用 "{0}" diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf index f496739b07296..e7502d139273d 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf @@ -4,7 +4,7 @@ Add 'await' - 新增 'await' + Add 'await' {Locked="await"} "await" is a C# keyword and should not be localized. @@ -147,11 +147,6 @@ 指派 'out' 參數 (開始時) {Locked="out"} "out" is a C# keyword and should not be localized. - - Assign to '{0}' - 指派給 '{0}' - - Autoselect disabled due to potential pattern variable declaration. 因為潛在的範圍變數宣告,所以停用了自動選取。 @@ -167,11 +162,6 @@ 變更為 'cast' - - Compare to '{0}' - 與 '{0}' 比較 - - Convert to method 轉換為方法 @@ -207,21 +197,11 @@ 轉換為逐字字串 - - Declare as nullable - 宣告為可為 Null - - Enable nullable reference types in project 在專案中啟用可為 Null 的參考類型 - - Fix return type - 修正傳回型別 - - Inline temporary variable 內嵌暫存變數 @@ -277,11 +257,6 @@ 簡化所有項目 - - Unseal class '{0}' - 為類別 '{0}' 解密 - - Use recursive patterns 使用遞迴模式 @@ -487,16 +462,6 @@ 使 {0} 傳回 Task 而不是 void。 - - Change return type from {0} to {1} - 將傳回類型從 {0} 變更為 {1} - - - - Replace return with yield return - 使用 yield return 取代 return - - Generate explicit conversion operator in '{0}' 在 '{0}' 中產生明確轉換運算子 @@ -737,11 +702,6 @@ 目前內容中沒有名稱 '{0}'。 - - Hide base member - 隱藏基底成員 - - Properties 屬性 @@ -847,11 +807,6 @@ 反轉 if - - Add [Obsolete] - 新增 [Obsolete] - - Use '{0}' 使用 '{0}' diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index 41b1e6733cf0b..3c65b32517715 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -987,9 +987,6 @@ This version used in: {2} project {0} - - Use interpolated verbatim string - Fix typo '{0}' @@ -1158,9 +1155,6 @@ This version used in: {2} indexer - - Alias ambiguous type '{0}' - Warning: Collection was modified during iteration. @@ -1439,9 +1433,6 @@ This version used in: {2} Implement '{0}' explicitly - - Make static - TODO "TODO" is an indication that there is work still to be done. @@ -1952,9 +1943,6 @@ If the "H" format specifier is used without other custom format specifiers, it's Create and assign remaining as properties - - Add explicit cast - Example: Singular form when we want to show an example, but only have one to show. @@ -2757,9 +2745,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of <infer> - - Convert type to '{0}' - from metadata @@ -2778,9 +2763,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Property reference cannot be updated - - Make class 'abstract' - Inline '{0}' @@ -2942,9 +2924,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Miscellaneous Files - - Explicitly inherit documentation - Silent @@ -3211,4 +3190,4 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Sort Imports or usings - + \ No newline at end of file diff --git a/src/Features/Core/Portable/ImplementAbstractClass/AbstractImplementAbstractClassCodeFixProvider.cs b/src/Features/Core/Portable/ImplementAbstractClass/AbstractImplementAbstractClassCodeFixProvider.cs index 7ced21bcb6e74..6c475f8fd7d8d 100644 --- a/src/Features/Core/Portable/ImplementAbstractClass/AbstractImplementAbstractClassCodeFixProvider.cs +++ b/src/Features/Core/Portable/ImplementAbstractClass/AbstractImplementAbstractClassCodeFixProvider.cs @@ -71,7 +71,7 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) private static string GetCodeActionId(string assemblyName, string abstractTypeFullyQualifiedName, string through = "") => FeaturesResources.Implement_abstract_class + ";" + assemblyName + ";" + abstractTypeFullyQualifiedName + ";" + through; - private class MyCodeAction : CodeAction.DocumentChangeAction + private class MyCodeAction : CustomCodeActions.DocumentChangeAction { public MyCodeAction(string title, Func> createChangedDocument, string id) : base(title, createChangedDocument, id) diff --git a/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs b/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs index f0fff28719459..448d83a0fd3b0 100644 --- a/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs +++ b/src/Features/Core/Portable/UseAutoProperty/AbstractUseAutoPropertyCodeFixProvider.cs @@ -342,13 +342,21 @@ private static bool IsWrittenToOutsideOfConstructorOrProperty( private class UseAutoPropertyCodeAction : CustomCodeActions.SolutionChangeAction { - public UseAutoPropertyCodeAction(string title, Func> createChangedSolution, CodeActionPriority priority) + public UseAutoPropertyCodeAction(string title, Func> createChangedSolution +#if !CODE_STYLE // 'CodeActionPriority' is not a public API, hence not supported in CodeStyle layer. + , CodeActionPriority priority +#endif + ) : base(title, createChangedSolution, title) { +#if !CODE_STYLE // 'CodeActionPriority' is not a public API, hence not supported in CodeStyle layer. Priority = priority; +#endif } +#if !CODE_STYLE // 'CodeActionPriority' is not a public API, hence not supported in CodeStyle layer. internal override CodeActionPriority Priority { get; } +#endif } } } diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index 5fd5033967618..ab80d944a718e 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -50,11 +50,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Přidat atribut DebuggerDisplay {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - Přidat explicitní přetypování - - Add member name Přidat název členu @@ -570,11 +565,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Převést na řazenou kolekci členů - - Convert type to '{0}' - Převést typ na {0} - - Could not find portable PDB on disk or embedded. Na disku nebo vloženém disku se nepovedlo najít přenosný soubor PDB. @@ -695,11 +685,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Explicitně implementované metody záznamů musí mít názvy parametrů, které odpovídají kompilátorem vygenerovanému ekvivalentu {0}. - - Explicitly inherit documentation - Explicitně dědit dokumentaci - - Extract base class... Extrahovat základní třídu... @@ -1045,16 +1030,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn JSON issue: {0} - - Make class 'abstract' - Nastavit třídu jako abstract - - - - Make static - Nastavit jako statickou - - Invert conditional Převrátit podmínku @@ -2910,11 +2885,6 @@ Pozitivní kontrolní výrazy zpětného vyhledávání s nulovou délkou se obv Používat text výrazu pro lambda výrazy - - Use interpolated verbatim string - Použít interpolovaný doslovný řetězec - - Value: Hodnota: @@ -4890,11 +4860,6 @@ Tato verze se používá zde: {2}. indexer - - Alias ambiguous type '{0}' - Alias nejednoznačného typu {0} - - Warning: Collection was modified during iteration. Upozornění: Během iterace se kolekce změnila. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index 226519d25c171..a37e19fd09152 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -50,11 +50,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d DebuggerDisplay-Attribut hinzufügen {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - Explizite Umwandlung hinzufügen - - Add member name Membername hinzufügen @@ -570,11 +565,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d In Tupel konvertieren - - Convert type to '{0}' - Typ in "{0}" konvertieren - - Could not find portable PDB on disk or embedded. Die portierbare PDB-Datei wurde nicht auf dem Datenträger oder eingebettet gefunden. @@ -695,11 +685,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Explizit implementierte Methoden von Datensätzen müssen Parameternamen aufweisen, die mit dem vom Compiler generierten Äquivalent "{0}" übereinstimmen. - - Explicitly inherit documentation - Dokumentation explizit erben - - Extract base class... Basisklasse extrahieren... @@ -1045,16 +1030,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d JSON issue: {0} - - Make class 'abstract' - Klasse als "abstract" festlegen - - - - Make static - Als statisch festlegen - - Invert conditional Bedingten Operator umkehren @@ -2910,11 +2885,6 @@ Positive Lookbehindassertionen mit Nullbreite werden normalerweise am Anfang reg Ausdruckskörper für Lambdaausdrücke verwenden - - Use interpolated verbatim string - Interpolierte ausführliche Zeichenfolge verwenden - - Value: Wert: @@ -4890,11 +4860,6 @@ Diese Version wird verwendet in: {2} Indexer - - Alias ambiguous type '{0}' - Nicht eindeutiger Aliastyp "{0}" - - Warning: Collection was modified during iteration. Warnung: Die Sammlung wurde bei der Iteration geändert. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index 3a948000364b2..9b42edfc6db9c 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -50,11 +50,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Agregar atributo de "DebuggerDisplay" {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - Agregar conversión explícita - - Add member name Agregar nombre de miembro @@ -570,11 +565,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Convertir a tupla - - Convert type to '{0}' - Convertir tipo en "{0}" - - Could not find portable PDB on disk or embedded. No se pudo encontrar el archivo PDB portátil en el disco o incrustado. @@ -695,11 +685,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Los métodos de registros implementados explícitamente deben tener nombres de parámetro que coincidan con el equivalente generado por el programa "{0}" - - Explicitly inherit documentation - Heredar explícitamente la documentación - - Extract base class... Extraer clase base... @@ -1045,16 +1030,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa JSON issue: {0} - - Make class 'abstract' - Convertir la clase en "abstract" - - - - Make static - Hacer estático - - Invert conditional Invertir condicional @@ -2910,11 +2885,6 @@ Las aserciones de búsqueda retrasada (lookbehind) positivas de ancho cero se us Usar órgano de expresión para expresiones lambda - - Use interpolated verbatim string - Utilizar cadenas verbatim interpoladas - - Value: Valor: @@ -4890,11 +4860,6 @@ Esta versión se utiliza en: {2} indizador - - Alias ambiguous type '{0}' - Tipo de alias ambiguo "{0}" - - Warning: Collection was modified during iteration. Advertencia: la colección se modificó durante la iteración. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index d2ee7c45cf50b..9b7317fcb1dd1 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -50,11 +50,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Ajouter l'attribut 'DebuggerDisplay' {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - Ajouter un cast explicite - - Add member name Ajouter le nom du membre @@ -570,11 +565,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Convertir en tuple - - Convert type to '{0}' - Convertir le type en '{0}' - - Could not find portable PDB on disk or embedded. PDB portable introuvable sur le disque ou incorporé. @@ -695,11 +685,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Les méthodes d'enregistrement implémentées explicitement doivent avoir des noms de paramètres qui correspondent à l'équivalent « {0} » généré par le compilateur. - - Explicitly inherit documentation - Hériter explicitement de la documentation - - Extract base class... Extraire la classe de base... @@ -1045,16 +1030,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai JSON issue: {0} - - Make class 'abstract' - Rendre la classe 'abstract' - - - - Make static - Rendre statique - - Invert conditional Inverser un élément conditionnel @@ -2910,11 +2885,6 @@ Les assertions arrière positives de largeur nulle sont généralement utilisée Utiliser le corps d'expression pour les expressions lambda - - Use interpolated verbatim string - Utiliser une chaîne verbatim interpolée - - Value: Valeur : @@ -4890,11 +4860,6 @@ Version utilisée dans : {2} indexeur - - Alias ambiguous type '{0}' - Alias de type ambigu : '{0}' - - Warning: Collection was modified during iteration. Avertissement : La collection a été modifiée durant l'itération. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index 455443fce332d..f4e7e08e57f10 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -50,11 +50,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Aggiungi l'attributo 'DebuggerDisplay' {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - Aggiungi cast esplicito - - Add member name Aggiungi nome del membro @@ -570,11 +565,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Converti in tupla - - Convert type to '{0}' - Converti il tipo in '{0}' - - Could not find portable PDB on disk or embedded. Impossibile trovare PDB portabile su disco o incorporato. @@ -695,11 +685,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa I metodi dei record implementati in modo esplicito devono avere nomi di parametro corrispondenti all'equivalente generato dal compilatore '{0}' - - Explicitly inherit documentation - Eredita esplicitamente la documentazione - - Extract base class... Estrai classe di base... @@ -1045,16 +1030,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa JSON issue: {0} - - Make class 'abstract' - Rendi la classe 'abstract' - - - - Make static - Imposta come statici - - Invert conditional Inverti espressione condizionale @@ -2910,11 +2885,6 @@ Le asserzioni lookbehind positive di larghezza zero vengono usate in genere all' Usa il corpo dell'espressione per le espressioni lambda - - Use interpolated verbatim string - Usa stringa verbatim interpolata - - Value: Valore: @@ -4890,11 +4860,6 @@ Questa versione è usata {2} indicizzatore - - Alias ambiguous type '{0}' - Tipo di alias '{0}' ambiguo - - Warning: Collection was modified during iteration. Avviso: la raccolta è stata modificata durante l'iterazione. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index ea39b7008256a..321fb21e52af9 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -50,11 +50,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 'DebuggerDisplay' 属性の追加 {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - 明示的なキャストの追加 - - Add member name メンバー名を追加します @@ -570,11 +565,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma タプルに変換 - - Convert type to '{0}' - 型を '{0}' に変換 - - Could not find portable PDB on disk or embedded. ポータブル PDB がディスクまたは埋め込みで見つかりませんでした。 @@ -695,11 +685,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 明示的に実装されたレコードのメソッドには、コンパイラ生成と同等の '{0}' と一致するパラメーター名が必要です - - Explicitly inherit documentation - ドキュメントを明示的に継承する - - Extract base class... 基底クラスの抽出... @@ -1045,16 +1030,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma JSON issue: {0} - - Make class 'abstract' - クラスを 'abstract' にしてください - - - - Make static - 静的にする - - Invert conditional 条件を反転します @@ -2910,11 +2885,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of ラムダ式に式本体を使用する - - Use interpolated verbatim string - 挿入された逐語的文字列を使用します - - Value: 値: @@ -4890,11 +4860,6 @@ This version used in: {2} インデクサー - - Alias ambiguous type '{0}' - エイリアスのあいまいな型 '{0}' - - Warning: Collection was modified during iteration. 警告: 反復処理中にコレクションが変更されました。 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index 65b3282185426..0dc2664e593fe 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -50,11 +50,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 'DebuggerDisplay' 특성을 추가합니다. {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - 명시적 캐스트 추가 - - Add member name 멤버 이름 추가 @@ -570,11 +565,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 튜플로 변환 - - Convert type to '{0}' - 형식을 '{0}'(으)로 변환 - - Could not find portable PDB on disk or embedded. 디스크 또는 포함에서 이식 가능한 PDB를 찾을 수 없습니다. @@ -695,11 +685,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 명시적으로 구현된 레코드 메서드에는 컴파일러에서 생성된 것과 일치하는 매개 변수 이름 '{0}'이 있어야 합니다. - - Explicitly inherit documentation - 명시적으로 상속 문서 - - Extract base class... 기본 클래스 추출... @@ -1045,16 +1030,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma JSON issue: {0} - - Make class 'abstract' - 'abstract' 클래스 만들기 - - - - Make static - 정적으로 만들기 - - Invert conditional 조건 반전 @@ -2910,11 +2885,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 람다 식에 식 본문 사용 - - Use interpolated verbatim string - 보간된 축자 문자열 사용 - - Value: 값: @@ -4890,11 +4860,6 @@ This version used in: {2} 인덱서 - - Alias ambiguous type '{0}' - 별칭 모호한 형식 '{0}' - - Warning: Collection was modified during iteration. 경고: 반복 중 컬렉션이 수정되었습니다. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index 1b29d30dc64db..1546d752d724c 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -50,11 +50,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Dodaj atrybut "DebuggerDisplay" {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - Dodaj rzutowanie jawne - - Add member name Dodaj nazwę składowej @@ -570,11 +565,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Konwertuj na spójną kolekcję - - Convert type to '{0}' - Konwertuj typ na „{0}” - - Could not find portable PDB on disk or embedded. Nie można odnaleźć przenośnego pliku PDB na dysku lub w trybie osadzonym. @@ -695,11 +685,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Jawnie zaimplementowane metody rekordów muszą mieć nazwy parametrów pasujące do wygenerowanego odpowiednika kompilatora "{0}" - - Explicitly inherit documentation - Wyraźnie dziedziczona dokumentacja - - Extract base class... Wyodrębnij klasę bazową... @@ -1045,16 +1030,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k JSON issue: {0} - - Make class 'abstract' - Ustaw specyfikator „abstract” dla klasy - - - - Make static - Ustaw jako statyczne - - Invert conditional Odwróć warunkowe @@ -2910,11 +2885,6 @@ Pozytywne asercje wsteczne o zerowej szerokości są zwykle używane na początk Użyj treści wyrażenia dla wyrażeń lambda - - Use interpolated verbatim string - Użyj interpolowanego ciągu dosłownego wyrażenia - - Value: Wartość: @@ -4890,11 +4860,6 @@ Ta wersja jest używana wersja: {2} indeksator - - Alias ambiguous type '{0}' - Niejednoznaczny typ aliasu „{0}” - - Warning: Collection was modified during iteration. Ostrzeżenie: kolekcja została zmodyfikowana podczas iteracji. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index 487b33031fcaf..37a14ce6d5b10 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -50,11 +50,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Adicionar atributo 'DebuggerDisplay' {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - Adicionar conversão explícita - - Add member name Adicionar o nome do membro @@ -570,11 +565,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Converter a tupla - - Convert type to '{0}' - Converter o tipo em '{0}' - - Could not find portable PDB on disk or embedded. Não foi possível encontrar PDB portátil no disco ou incorporado. @@ -695,11 +685,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Métodos explicitamente implementados de registros devem ter nomes de parâmetro que correspondem ao compilador gerado '{0}' equivalente - - Explicitly inherit documentation - Herdar explicitamente a documentação - - Extract base class... Extrair a classe base... @@ -1045,16 +1030,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess JSON issue: {0} - - Make class 'abstract' - Tornar a classe 'abstract' - - - - Make static - Tornar estático - - Invert conditional Inverter condicional @@ -2910,11 +2885,6 @@ As declarações de lookbehind positivas de largura zero normalmente são usadas Usar corpo da expressão para expressões lambda - - Use interpolated verbatim string - Usar cadeia de caracteres verbatim interpolada - - Value: Valor: @@ -4890,11 +4860,6 @@ Essa versão é usada no: {2} indexador - - Alias ambiguous type '{0}' - Tipo de alias ambíguo '{0}' - - Warning: Collection was modified during iteration. Aviso: a coleção foi modificada durante a iteração. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index 66948a7297ce7..cafaa827d9ff0 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -50,11 +50,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Добавить атрибут "DebuggerDisplay" {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - Добавить явное приведение - - Add member name Добавить имя элемента @@ -570,11 +565,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Преобразовать в кортеж - - Convert type to '{0}' - Преобразовать тип в "{0}" - - Could not find portable PDB on disk or embedded. Не удалось найти переносимый PDB-файл на диске или во внедренном источнике. @@ -695,11 +685,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Явно реализованные методы записей должны иметь имена параметров, соответствующие компилятору, созданному эквивалентом '{0}' - - Explicitly inherit documentation - Явно наследовать документацию - - Extract base class... Извлечь базовый класс... @@ -1045,16 +1030,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma JSON issue: {0} - - Make class 'abstract' - Сделать класс абстрактным - - - - Make static - Сделать статическим - - Invert conditional Инвертировать условный оператор @@ -2910,11 +2885,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Использовать тело выражения для лямбда-выражений - - Use interpolated verbatim string - Использовать интерполированную буквальную строку - - Value: Значение: @@ -4890,11 +4860,6 @@ This version used in: {2} индексатор - - Alias ambiguous type '{0}' - Неоднозначный тип псевдонима "{0}" - - Warning: Collection was modified during iteration. Внимание! Коллекция изменена во время итерации. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index d3018db78b3f1..6155cd516283b 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -50,11 +50,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be 'DebuggerDisplay' özniteliği ekle {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - Açık tür dönüştürme ekle - - Add member name Üye adı Ekle @@ -570,11 +565,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Başlığa dönüştür - - Convert type to '{0}' - Türü '{0}' olarak dönüştür - - Could not find portable PDB on disk or embedded. Diskte veya gömülü olarak taşınabilir PDB bulunamadı. @@ -695,11 +685,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Açık olarak uygulanan kayıt yöntemlerinin derleyici tarafından oluşturulan '{0}' eşdeğeri ile eşleşen parametre adlarına sahip olması gerekir - - Explicitly inherit documentation - Belgeleri açıkça devral - - Extract base class... Temel sınıfı ayıkla... @@ -1045,16 +1030,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be JSON issue: {0} - - Make class 'abstract' - Sınıfı 'abstract' yap - - - - Make static - Statik yap - - Invert conditional Koşullu öğeyi ters çevir @@ -2910,11 +2885,6 @@ Sıfır genişlikli pozitif geri yönlü onaylamalar genellikle normal ifadeleri Lambda ifadeleri için ifade vücut kullanımı - - Use interpolated verbatim string - Enterpolasyonlu kelimesi kelimesine dizeyi kullanın - - Value: Değer: @@ -4890,11 +4860,6 @@ Bu sürüm şurada kullanılır: {2} dizin oluşturucu - - Alias ambiguous type '{0}' - Diğer ad belirsiz '{0}' türünde - - Warning: Collection was modified during iteration. Uyarı: Yineleme sırasında koleksiyon değiştirildi. diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index a0c4ec25789a1..6bda647863b68 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -50,11 +50,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 添加 "DebuggerDisplay" 属性 {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - 添加显式转换 - - Add member name 添加成员名称 @@ -570,11 +565,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 转换为元组 - - Convert type to '{0}' - 将类型转换为“{0}” - - Could not find portable PDB on disk or embedded. 在磁盘或嵌入源上找不到可移植 PDB。 @@ -695,11 +685,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 记录的显示实施方法参数名必须匹配编辑器生成的等效“{0}” - - Explicitly inherit documentation - 显式继承文档 - - Extract base class... 提取基类... @@ -1045,16 +1030,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma JSON issue: {0} - - Make class 'abstract' - 将类设置为 "abstract" - - - - Make static - 设为静态 - - Invert conditional 反转条件 @@ -2910,11 +2885,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 对 lambda 表达式使用表达式正文 - - Use interpolated verbatim string - 使用内插的逐字字符串 - - Value: 值: @@ -4890,11 +4860,6 @@ This version used in: {2} 索引器 - - Alias ambiguous type '{0}' - 别名多义类型“{0}” - - Warning: Collection was modified during iteration. 警告: 迭代期间已修改集合。 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index b99c88ed17b96..749e2f38be94f 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -50,11 +50,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 新增 'DebuggerDisplay' 屬性 {Locked="DebuggerDisplay"} "DebuggerDisplay" is a BCL class and should not be localized. - - Add explicit cast - 新增明確轉換 - - Add member name 新增成員名稱 @@ -570,11 +565,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 轉換為元組 - - Convert type to '{0}' - 將類型轉換為 '{0}' - - Could not find portable PDB on disk or embedded. 磁碟或內嵌上找不到可攜式 PDB。 @@ -695,11 +685,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 記錄的明確實作方法,必須有參數名稱符合編譯器產生的相等 '{0}' - - Explicitly inherit documentation - 明確繼承文件 - - Extract base class... 擷取基底類別... @@ -1045,16 +1030,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma JSON issue: {0} - - Make class 'abstract' - 將類別設為 'abstract' - - - - Make static - 使其變成靜態 - - Invert conditional 反轉條件 @@ -2910,11 +2885,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of 使用 Lambda 運算式的運算式主體 - - Use interpolated verbatim string - 使用插入的逐字字串 - - Value: 值: @@ -4890,11 +4860,6 @@ This version used in: {2} 索引子 - - Alias ambiguous type '{0}' - 別名不明確類型 '{0}' - - Warning: Collection was modified during iteration. 警告: 集合已於反覆運算期間被修改 diff --git a/src/Features/VisualBasic/Portable/VBFeaturesResources.resx b/src/Features/VisualBasic/Portable/VBFeaturesResources.resx index 1dcbc463afa9d..6401f8be7bef7 100644 --- a/src/Features/VisualBasic/Portable/VBFeaturesResources.resx +++ b/src/Features/VisualBasic/Portable/VBFeaturesResources.resx @@ -962,12 +962,6 @@ Sub(<parameterList>) <statement> Make {0} an Async Function. - - Convert {0} to Iterator - - - Replace 'Return' with 'Yield - Use the correct control variable @@ -1207,9 +1201,6 @@ Sub(<parameterList>) <statement> Convert to 'For' - - Add <Obsolete> - Add missing Imports {Locked="Import"} @@ -1222,9 +1213,6 @@ Sub(<parameterList>) <statement> Introduce 'Using' statement {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - Apply Me qualification preferences {Locked="Me"} "Me" is a VB keyword and should not be localized. diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf index d2e2a67c7f45f..f6e4557c7e016 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf @@ -12,11 +12,6 @@ Přidat Await a ConfigureAwait(false) - - Add <Obsolete> - Přidat <Obsolete> - - Add missing Imports Přidat chybějící Importy @@ -97,11 +92,6 @@ Zavést příkaz Using {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - Nastavit dědičnost pro {0} - - Make private field ReadOnly when possible Pokud je to možné, nastavit privátní pole jako ReadOnly @@ -1502,16 +1492,6 @@ Sub(<seznam_parametrů>) <výraz> Převeď {0} na asynchronní funkci Async. - - Convert {0} to Iterator - Převést {0} na iterátor - - - - Replace 'Return' with 'Yield - Nahradit příkaz Return příkazem Yield - - Use the correct control variable Použít správnou řídicí proměnnou diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf index ad3347120f439..7a3e6e359856b 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf @@ -12,11 +12,6 @@ "Await" und "ConfigureAwait(false)" hinzufügen - - Add <Obsolete> - <Veraltet> hinzufügen - - Add missing Imports Fehlende Importe hinzufügen @@ -97,11 +92,6 @@ Using-Anweisung einführen {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - "{0}" als vererbbar festlegen - - Make private field ReadOnly when possible Privates Feld nach Möglichkeit als "ReadOnly" festlegen @@ -1502,16 +1492,6 @@ Sub(<Parameterliste>) <Ausdruck> "{0}" in eine Async-Funktion umwandeln. - - Convert {0} to Iterator - {0} in Iterator konvertieren - - - - Replace 'Return' with 'Yield - "Return" durch "Yield" ersetzen - - Use the correct control variable Richtige Steuervariable verwenden diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf index 07a349d500ac5..58e9346e68928 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf @@ -12,11 +12,6 @@ Agregar await y "ConfigureAwait(false)" - - Add <Obsolete> - Agregar <obsoleto> - - Add missing Imports Agregar instancias de Import que faltan @@ -97,11 +92,6 @@ Introducir instrucción "Using" {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - Hacer "{0}" heredable - - Make private field ReadOnly when possible Hacer que el campo privado sea ReadOnly cuando sea posible @@ -1502,16 +1492,6 @@ Sub(<listaDeParámetros>) <instrucción>wo laopo fuke Convertir {0} en una función Async. - - Convert {0} to Iterator - Convertir {0} en Iterador - - - - Replace 'Return' with 'Yield - Reemplazar "Return" por "Yield - - Use the correct control variable Utilizar la variable de control correcta diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf index a78971dde3458..91fb24b0c5606 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf @@ -12,11 +12,6 @@ Ajouter Await et 'ConfigureAwait(false)' - - Add <Obsolete> - Ajouter <Obsolete> - - Add missing Imports Ajouter les Import manquants @@ -97,11 +92,6 @@ Introduire l'instruction 'Using' {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - Rendre '{0}' héritable - - Make private field ReadOnly when possible Rendre le champ privé ReadOnly quand cela est possible @@ -1502,16 +1492,6 @@ Sub(<parameterList>) <statement> Faire de {0} une fonction Async. - - Convert {0} to Iterator - Convertir {0} en itérateur - - - - Replace 'Return' with 'Yield - Remplacer 'Return' par 'Yield - - Use the correct control variable Utiliser la variable de contrôle correcte diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf index b4e6165ea2dd0..580c90ca4e2f2 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf @@ -12,11 +12,6 @@ Aggiungi Await a 'ConfigureAwait(false)' - - Add <Obsolete> - Aggiungi <Obsolete> - - Add missing Imports Aggiungi Import mancanti @@ -97,11 +92,6 @@ Introduci istruzioni 'Using' {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - Imposta '{0}' come ereditabile - - Make private field ReadOnly when possible Imposta il campo privato come ReadOnly quando possibile @@ -1502,16 +1492,6 @@ Sub(<elencoParametri>) <istruzione> Trasformare {0} in una funzione asincrona. - - Convert {0} to Iterator - Converti {0} in iteratore - - - - Replace 'Return' with 'Yield - Sostituisci 'Return' con 'Yield' - - Use the correct control variable Usa la variabile di controllo corretta diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf index 5ed260cb3630e..426bf77248393 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf @@ -12,11 +12,6 @@ Await と 'ConfigureAwait(false)' の追加 - - Add <Obsolete> - <Obsolete> の追加 - - Add missing Imports 欠落している Import の追加 @@ -97,11 +92,6 @@ ’Using’ ステートメントの導入 {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - '{0}' を継承可能にします - - Make private field ReadOnly when possible 可能な場合、プライベート フィールドを ReadOnly にする @@ -1502,16 +1492,6 @@ Sub(<parameterList>) <statement> {0} を Async Function にします。 - - Convert {0} to Iterator - {0} を反復子に変換 - - - - Replace 'Return' with 'Yield - Return' を 'Yield' に置き換える - - Use the correct control variable 正しい制御変数を使用する diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf index 40af68794a182..4110a392c769e 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf @@ -12,11 +12,6 @@ Await 및 'ConfigureAwait(false)' 추가 - - Add <Obsolete> - <Obsolete> 추가 - - Add missing Imports 누락된 Imports 추가 @@ -97,11 +92,6 @@ 'Using' 문 지정 {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - '{0}'을(를) 상속 가능으로 지정 - - Make private field ReadOnly when possible 가능한 경우 프라이빗 필드를 ReadOnly로 만들기 @@ -1502,16 +1492,6 @@ Sub(<parameterList>) <statement> {0}을(를) 비동기 함수로 설정합니다. - - Convert {0} to Iterator - 반복기로 {0} 변환 - - - - Replace 'Return' with 'Yield - Return'을 'Yield'로 바꾸기 - - Use the correct control variable 올바른 제어 변수 사용 diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf index 39329a5c74db4..5af7bb87b27bf 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf @@ -12,11 +12,6 @@ Dodaj operator Await i wywołanie „ConfigureAwait(false)” - - Add <Obsolete> - Dodaj oznaczenie <Obsolete> - - Add missing Imports Dodaj brakujące instrukcje Imports @@ -97,11 +92,6 @@ Wprowadź instrukcję „Using” {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - Ustaw element „{0}” jako dziedziczony - - Make private field ReadOnly when possible Ustaw pole prywatne jako ReadOnly, gdy to możliwe @@ -1502,16 +1492,6 @@ Sub(<listaParametrów>) <instrukcja> Ustaw funkcję {0} jako funkcję asynchroniczną. - - Convert {0} to Iterator - Konwertuj element {0} na iterator - - - - Replace 'Return' with 'Yield - Zamień instrukcję „Return” na instrukcję „Yield” - - Use the correct control variable Użyj poprawnej zmiennej sterującej diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf index 960458d1bff70..514993ed05af8 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf @@ -12,11 +12,6 @@ Adicionar Await e 'ConfigureAwait(false)' - - Add <Obsolete> - Adicionar <Obsolete> - - Add missing Imports Adicionar Importações ausentes @@ -97,11 +92,6 @@ Apresente a instrução 'Using' {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - Alterar '{0}' para herdável - - Make private field ReadOnly when possible Fazer com que o campo privado seja ReadOnly quando possível @@ -1502,16 +1492,6 @@ Sub(<parameterList>) <statement> Tornar {0} uma Função Assíncrona. - - Convert {0} to Iterator - Converter {0} para Iterador - - - - Replace 'Return' with 'Yield - Substituir "Return" por "Yield" - - Use the correct control variable Usar a variável de controle correta diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf index 7dbd767442ed9..dba4fcffec49b 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf @@ -12,11 +12,6 @@ Добавить Await и "ConfigureAwait(false)" - - Add <Obsolete> - Добавить <Obsolete> - - Add missing Imports Добавить отсутствующий оператор Imports @@ -97,11 +92,6 @@ Ввести оператор "Using" {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - Сделать "{0}" наследуемым - - Make private field ReadOnly when possible Сделать закрытое поле доступным для чтения (ReadOnly), если это возможно @@ -1502,16 +1492,6 @@ Sub(<parameterList>) <statement> Сделать {0} асинхронной функцией. - - Convert {0} to Iterator - Преобразовать {0} в итератор - - - - Replace 'Return' with 'Yield - Замените "Return" на "Yield - - Use the correct control variable Используйте правильную переменную элемента управления diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf index 268ada03192eb..abf4d30bbea34 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf @@ -12,11 +12,6 @@ Await ve 'ConfigureAwait(false)' ekle - - Add <Obsolete> - <Obsolete> ekle - - Add missing Imports Eksik Import'ları ekle @@ -97,11 +92,6 @@ 'Using' deyimi ekle {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - '{0}' öğesini devralınabilir hale getir - - Make private field ReadOnly when possible Mümkün olduğunda özel alanı ReadOnly yap @@ -1502,16 +1492,6 @@ Sub(<parameterList>) <statement> {0} öğesini bir Zaman Uyumsuz İşlev yap. - - Convert {0} to Iterator - {0} öğesini Yineleyici'ye dönüştür - - - - Replace 'Return' with 'Yield - Return' değerini 'Yield' ile değiştir - - Use the correct control variable Doğru denetim değişkenini kullanın diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf index 7a4acca09dff7..0a6736f2ace75 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf @@ -12,11 +12,6 @@ 添加 Await 和 “ConfigureAwait(false)” - - Add <Obsolete> - 添加 <Obsolete> - - Add missing Imports 添加缺少的 Import @@ -97,11 +92,6 @@ 引入 “Using” 语句 {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - 使 "{0}" 可继承 - - Make private field ReadOnly when possible 尽可能将私有字段设为 ReadOnly @@ -1502,16 +1492,6 @@ Sub(<parameterList>) <statement> 使 {0} 为异步函数。 - - Convert {0} to Iterator - 将{0}转换为迭代器 - - - - Replace 'Return' with 'Yield - 将 "Return" 替换为 "Yield - - Use the correct control variable 使用正确的控制变量 diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf index a7e38ee503a33..ed4a839652931 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf @@ -12,11 +12,6 @@ 新增 Await 及 'ConfigureAwait(false)' - - Add <Obsolete> - 新增 <已淘汰> - - Add missing Imports 新增缺少的 Import @@ -97,11 +92,6 @@ 引入 'Using' 陳述式 {Locked="Using"} "Using" is a VB keyword and should not be localized. - - Make '{0}' inheritable - 將 '{0}' 設為可繼承 - - Make private field ReadOnly when possible 盡可能地將私人欄位設為 ReadOnly @@ -1502,16 +1492,6 @@ Sub(<parameterList>) <statement> 讓 {0} 成為非同步函式。 - - Convert {0} to Iterator - 將 {0} 轉換為 Iterator - - - - Replace 'Return' with 'Yield - 以 'Yield' 取代 'Return' - - Use the correct control variable 使用正確的控制變數 diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs deleted file mode 100644 index e69f2ba59a96f..0000000000000 --- a/src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.Shared.Extensions -{ - internal static class IListExtensions - { - public static int IndexOf(this IList list, Func predicate) - { - Contract.ThrowIfNull(list); - Contract.ThrowIfNull(predicate); - - for (var i = 0; i < list.Count; i++) - { - if (predicate(list[i])) - { - return i; - } - } - - return -1; - } - } -} diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs index 816b43f8e4ad7..dfd06aa29ec10 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs @@ -55,27 +55,6 @@ public static bool CompatibleSignatureToDelegate(this IMethodSymbol method, INam return true; } - /// - /// Returns the methodSymbol and any partial parts. - /// - public static ImmutableArray GetAllMethodSymbolsOfPartialParts(this IMethodSymbol method) - { - if (method.PartialDefinitionPart != null) - { - Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); - return ImmutableArray.Create(method, method.PartialDefinitionPart); - } - else if (method.PartialImplementationPart != null) - { - Debug.Assert(!Equals(method.PartialImplementationPart, method)); - return ImmutableArray.Create(method.PartialImplementationPart, method); - } - else - { - return ImmutableArray.Create(method); - } - } - public static IMethodSymbol RenameTypeParameters(this IMethodSymbol method, ImmutableArray newNames) { if (method.TypeParameters.Select(t => t.Name).SequenceEqual(newNames)) diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs index 5071112465fb2..abf45b793acf9 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs @@ -25,17 +25,6 @@ namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class ISymbolExtensions { - public static DeclarationModifiers GetSymbolModifiers(this ISymbol symbol) - { - return new DeclarationModifiers( - isStatic: symbol.IsStatic, - isAbstract: symbol.IsAbstract, - isUnsafe: symbol.RequiresUnsafeModifier(), - isVirtual: symbol.IsVirtual, - isOverride: symbol.IsOverride, - isSealed: symbol.IsSealed); - } - /// /// Checks a given symbol for browsability based on its declaration location, attributes /// explicitly limiting browsability, and whether showing of advanced members is enabled. diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs index 1ceb1db50bb73..84e5de00012ef 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs @@ -16,24 +16,6 @@ namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class SourceTextExtensions { - /// - /// Returns the leading whitespace of the line located at the specified position in the given snapshot. - /// - public static string GetLeadingWhitespaceOfLineAtPosition(this SourceText text, int position) - { - Contract.ThrowIfNull(text); - - var line = text.Lines.GetLineFromPosition(position); - var linePosition = line.GetFirstNonWhitespacePosition(); - if (!linePosition.HasValue) - { - return line.ToString(); - } - - var lineText = line.ToString(); - return lineText.Substring(0, linePosition.Value - line.Start); - } - public static void GetLineAndOffset(this SourceText text, int position, out int lineNumber, out int offset) { var line = text.Lines.GetLineFromPosition(position); diff --git a/src/Workspaces/Core/Portable/WorkspacesResources.resx b/src/Workspaces/Core/Portable/WorkspacesResources.resx index 06deb5218f886..15180f35cddfa 100644 --- a/src/Workspaces/Core/Portable/WorkspacesResources.resx +++ b/src/Workspaces/Core/Portable/WorkspacesResources.resx @@ -129,36 +129,9 @@ Cycle detected in extensions - - Destination type must be a {0}, but given one is {1}. - - - Destination type must be a {0} or a {1}, but given one is {2}. - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - Could not find location to generation symbol into. - - - No location provided to add statements to. - - - Destination location was not in source. - - - Destination location was from a different tree. - Node is of the wrong type. - - Location must be null or from source. - Duplicate source file '{0}' in project '{1}' @@ -309,12 +282,6 @@ Cannot generate code for unsupported operator '{0}' - - Invalid number of parameters for binary operator. - - - Invalid number of parameters for unary operator. - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf index 778c4b26985b7..976b6bf7c4770 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf @@ -52,11 +52,6 @@ DateTimeKind musí být Utc - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Cílový typ musí být {0}, {1}, {2} nebo {3}, ale zadaný typ je {4}. - - Document does not support syntax trees Dokument nepodporuje stromy syntaxe. @@ -137,51 +132,11 @@ V rozšířeních se zjistil cyklus. - - Destination type must be a {0}, but given one is {1}. - Cílový typ musí být {0}, ale zadaný typ je {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Cílový typ musí být {0} nebo {1}, ale zadaný typ je {2}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Cílový typ musí být {0}, {1} nebo {2}, ale zadaný typ je {3}. - - - - Could not find location to generation symbol into. - Nenašlo se umístění, do kterého by se vygeneroval symbol. - - - - No location provided to add statements to. - Není zadané žádné umístění, kam by se daly přidávat příkazy. - - - - Destination location was not in source. - Cílové umístění není ve zdroji. - - - - Destination location was from a different tree. - Cílové umístění pochází z jiného stromu. - - Node is of the wrong type. Uzel je chybného typu. - - Location must be null or from source. - Umístění musí být null nebo ze zdroje. - - Duplicate source file '{0}' in project '{1}' Duplicitní zdrojový soubor {0} v projektu {1} @@ -452,16 +407,6 @@ Nejde generovat kód pro nepodporovaný operátor {0}. - - Invalid number of parameters for binary operator. - Neplatný počet parametrů pro binární operátor - - - - Invalid number of parameters for unary operator. - Neplatný počet parametrů pro unární operátor - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Nejde otevřít projekt {0}, protože přípona souboru {1} není přidružená k jazyku. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf index 3b33ebc674923..a4f8bf615ef1a 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf @@ -52,11 +52,6 @@ "DateTimeKind" muss UTC sein. - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Der Zieltyp muss "{0}", "{1}", "{2}" oder "{3}" lauten. Es wurde jedoch "{4}" angegeben. - - Document does not support syntax trees Das Dokument unterstützt keine Syntaxstrukturen. @@ -137,51 +132,11 @@ Zyklus in Erweiterungen entdeckt - - Destination type must be a {0}, but given one is {1}. - Zieltyp muss {0} sein. Es wurde jedoch {1} angegeben. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Zieltyp muss {0} oder {1} sein. Es wurde jedoch {2} angegeben. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Zieltyp muss {0}, {1} oder {2} sein. Es wurde jedoch {3} angegeben. - - - - Could not find location to generation symbol into. - Konnte keinen Ort finden, in den das Symbol generiert werden kann. - - - - No location provided to add statements to. - Kein Ort angegeben, zu dem Anweisungen hinzugefügt werden. - - - - Destination location was not in source. - Zielort war nicht in Quelle. - - - - Destination location was from a different tree. - Zielort stammt aus anderem Baum. - - Node is of the wrong type. Knoten hat den falschen Typ. - - Location must be null or from source. - Ort muss null oder von Quelle sein. - - Duplicate source file '{0}' in project '{1}' Doppelte Quelldatei "{0}" in Projekt "{1}" @@ -452,16 +407,6 @@ Kann keinen Code für nicht unterstützten Operator "{0}" generieren - - Invalid number of parameters for binary operator. - Ungültige Parameteranzahl für binären Operator. - - - - Invalid number of parameters for unary operator. - Ungültige Parameteranzahl für unären Operator. - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Projekt "{0}" kann nicht geöffnet werden, da die Dateierweiterung "{1}" keiner Sprache zugeordnet ist. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf index 28f0516522f55..c476ae51972df 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf @@ -52,11 +52,6 @@ DateTimeKind debe ser Utc - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - El tipo de destino debe ser una instancia de {0}, {1}, {2} o {3}, pero el proporcionado es {4}. - - Document does not support syntax trees El documento no admite árboles de sintaxis @@ -137,51 +132,11 @@ Detectado ciclo en extensiones - - Destination type must be a {0}, but given one is {1}. - El tipo de destino debe ser un {0}, pero el proporcionado es {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - El tipo de destino debe ser un {0} o un {1}, pero el proporcionado es {2}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - El tipo de destino debe ser un {0}, {1} o {2}, pero el proporcionado es {3}. - - - - Could not find location to generation symbol into. - No se pudo encontrar una ubicación en la que generar un símbolo. - - - - No location provided to add statements to. - No se ha proporcionado ubicación a la que agregar instrucciones. - - - - Destination location was not in source. - La ubicación de destino no estaba en el código fuente. - - - - Destination location was from a different tree. - La ubicación de destino era de otro árbol. - - Node is of the wrong type. El nodo es del tipo erróneo. - - Location must be null or from source. - La ubicación debe ser null o del código fuente. - - Duplicate source file '{0}' in project '{1}' Archivo de código fuente '{0}' duplicado en el proyecto '{1}' @@ -452,16 +407,6 @@ No se puede generar código para el operador no compatible '{0}' - - Invalid number of parameters for binary operator. - Número de parámetros no válido para el operador binario. - - - - Invalid number of parameters for unary operator. - Número de parámetros no válido para el operador unario. - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. No se puede abrir el proyecto '{0}' porque la extensión de archivo '{1}' no está asociada a un lenguaje. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf index b28c49f5e07d0..198c24f7a56c4 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf @@ -52,11 +52,6 @@ DateTimeKind doit être UTC - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Le type de destination doit être {0}, {1}, {2} ou {3}, mais le type spécifié est {4}. - - Document does not support syntax trees Le document ne prend pas en charge les arborescences de syntaxe @@ -137,51 +132,11 @@ Cycle détecté dans les extensions - - Destination type must be a {0}, but given one is {1}. - Le type de destination doit être un {0}, mais le type donné est {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Le type de destination doit être un {0} ou un {1}, mais le type donné est {2}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Le type de destination doit être un {0}, {1} ou {2}, mais le type donné est {3}. - - - - Could not find location to generation symbol into. - L'emplacement dans lequel générer le symbole est introuvable. - - - - No location provided to add statements to. - Aucun emplacement n'a été fourni pour l'ajout d'instructions. - - - - Destination location was not in source. - L'emplacement de destination n'était pas dans la source. - - - - Destination location was from a different tree. - L'emplacement de destination provient d'une arborescence différente. - - Node is of the wrong type. Le type de nœud est incorrect. - - Location must be null or from source. - L'emplacement doit être null ou dans la source. - - Duplicate source file '{0}' in project '{1}' Dupliquer le fichier source '{0}' dans le projet '{1}' @@ -452,16 +407,6 @@ Impossible de générer du code pour l'opérateur non pris en charge '{0}' - - Invalid number of parameters for binary operator. - Nombre de paramètres non valide pour l'opérateur binaire. - - - - Invalid number of parameters for unary operator. - Nombre de paramètres non valide pour l'opérateur unaire. - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Impossible d'ouvrir le projet '{0}', car l'extension de fichier '{1}' n'est pas associée à un langage. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf index 833722dc62843..6c08647a92158 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf @@ -52,11 +52,6 @@ Il valore di DateTimeKind deve essere Utc - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Il tipo di destinazione deve essere {0}, {1}, {2} o {3}, ma quello specificato è {4}. - - Document does not support syntax trees Il documento non supporta alberi di sintassi @@ -137,51 +132,11 @@ È stato rilevato un ciclo nelle estensioni - - Destination type must be a {0}, but given one is {1}. - Il tipo di destinazione deve essere {0}, ma quello specificato è {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Il tipo di destinazione deve essere {0} o {1}, ma quello specificato è {2}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Il tipo di destinazione deve essere {0}, {1} o {2}, ma quello specificato è {3}. - - - - Could not find location to generation symbol into. - Non è stata trovata la posizione in cui generare il simbolo. - - - - No location provided to add statements to. - Non sono state specificate posizioni in cui aggiungere istruzioni. - - - - Destination location was not in source. - La posizione di destinazione non è inclusa nell'origine. - - - - Destination location was from a different tree. - La posizione di destinazione è in un albero diverso. - - Node is of the wrong type. Il tipo del nodo è errato. - - Location must be null or from source. - La posizione deve essere Null o derivare dall'origine. - - Duplicate source file '{0}' in project '{1}' File di origine '{0}' duplicato nel progetto '{1}' @@ -452,16 +407,6 @@ Non è possibile generare il codice per l'operatore '{0}' non supportato - - Invalid number of parameters for binary operator. - Il numero di parametri per l'operatore binario non è valido. - - - - Invalid number of parameters for unary operator. - Il numero di parametri per l'operatore unario non è valido. - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Non è possibile aprire il progetto '{0}' perché l'estensione di file '{1}' non è associata a un linguaggio. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf index 055f08def46cc..1d5921e0ca513 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf @@ -52,11 +52,6 @@ DateTimeKind は Utc にする必要があります - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - ターゲットの型は {0}、{1}、{2}、または {3} である必要がありますが、{4} が指定されています。 - - Document does not support syntax trees ドキュメントでは構文ツリーがサポートされません @@ -137,51 +132,11 @@ 拡張機能で循環が検出されました - - Destination type must be a {0}, but given one is {1}. - ターゲットの型は {0} である必要がありますが、{1} が指定されています。 - - - - Destination type must be a {0} or a {1}, but given one is {2}. - ターゲットの型は {0} または {1} である必要がありますが、{2} が指定されています。 - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - ターゲットの型は {0}、{1}、または {2} である必要がありますが、{3} が指定されています。 - - - - Could not find location to generation symbol into. - シンボルの生成先が見つかりませんでした。 - - - - No location provided to add statements to. - ステートメントを追加する場所がありません。 - - - - Destination location was not in source. - 追加先の場所は、ソース内ではありません。 - - - - Destination location was from a different tree. - ターゲットの場所は、別のツリーでした。 - - Node is of the wrong type. ノードの種類が正しくありません。 - - Location must be null or from source. - 場所は Null であるか、ソースからでなければなりません。 - - Duplicate source file '{0}' in project '{1}' プロジェクト '{1}' でソース ファイル '{0}' が重複しています @@ -452,16 +407,6 @@ サポートされない演算子 '{0}' のコードは生成できません - - Invalid number of parameters for binary operator. - 二項演算子のパラメーターの数が無効です。 - - - - Invalid number of parameters for unary operator. - 単項演算子のパラメーターの数が無効です。 - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. ファイルの拡張子 '{1}' が言語に関連付けられていないため、プロジェクト '{0}' を開くことができません。 diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf index 27fe20e964e11..9d973075e113c 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf @@ -52,11 +52,6 @@ DateTimeKind는 UTC여야 합니다. - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - 대상 형식은 {0}, {1}, {2} 또는 {3}이어야 하지만 지정된 대상 형식은 {4}입니다. - - Document does not support syntax trees 문서가 구문 트리를 지원하지 않음 @@ -137,51 +132,11 @@ 확장에서 순환 발견 - - Destination type must be a {0}, but given one is {1}. - 대상 형식은 {0}이어야 하지만 지정된 형식은 {1}입니다. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - 대상 형식은 {0} 또는 {1}이어야 하지만 지정된 형식은 {2}입니다. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - 대상 형식은 {0}, {1} 또는 {2}이어야 하지만 지정된 형식은 {3}입니다. - - - - Could not find location to generation symbol into. - 기호를 생성할 위치를 찾을 수 없습니다. - - - - No location provided to add statements to. - 문을 추가할 위치가 제공되지 않았습니다. - - - - Destination location was not in source. - 대상 위치가 소스에 없습니다. - - - - Destination location was from a different tree. - 다른 트리에서 온 대상 위치입니다. - - Node is of the wrong type. 잘못된 형식의 노드입니다. - - Location must be null or from source. - 위치는 null이거나 소스에 있어야 합니다. - - Duplicate source file '{0}' in project '{1}' '{1}' 프로젝트에서 중복된 '{0}' 소스 파일입니다. @@ -452,16 +407,6 @@ 지원되지 않는 '{0}' 연산자에 대한 코드를 생성할 수 없습니다. - - Invalid number of parameters for binary operator. - 이진 연산자에 대해 잘못된 매개 변수 수입니다. - - - - Invalid number of parameters for unary operator. - 단항 연산자에 대해 잘못된 매개 변수 수입니다. - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. '{1}' 파일 확장명이 언어에 연결되어 있지 않아 '{0}' 프로젝트를 열 수 없습니다. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf index bf6c1799e126d..f29f635432c97 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf @@ -52,11 +52,6 @@ Element DateTimeKind musi mieć wartość Utc - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Typ docelowy musi być elementem {0}, {1}, {2} lub {3}, ale podano element {4}. - - Document does not support syntax trees Dokument nie obsługuje drzew składni @@ -137,51 +132,11 @@ W rozszerzeniach wykryto cykl - - Destination type must be a {0}, but given one is {1}. - Typ docelowy musi być elementem {0}, ale podano element {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Typ docelowy musi być elementem {0} lub {1}, ale podano element {2}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Typ docelowy musi być elementem {0}, {1} lub {2}, ale podano element {3}. - - - - Could not find location to generation symbol into. - Nie można znaleźć lokalizacji do wygenerowania symbolu. - - - - No location provided to add statements to. - Nie podano lokalizacji, do których można dodać instrukcje. - - - - Destination location was not in source. - Lokalizacja docelowa nie znajdowała się w źródle. - - - - Destination location was from a different tree. - Lokalizacja docelowa pochodziła z innego drzewa. - - Node is of the wrong type. Węzeł ma nieprawidłowy typ. - - Location must be null or from source. - Lokalizacja musi mieć wartość null lub pochodzić ze źródła. - - Duplicate source file '{0}' in project '{1}' Zduplikowany plik źródłowy „{0}” w projekcie „{1}” @@ -452,16 +407,6 @@ Nie można wygenerować kodu dla nieobsługiwanego operatora „{0}” - - Invalid number of parameters for binary operator. - Nieprawidłowa liczba parametrów operatora binarnego. - - - - Invalid number of parameters for unary operator. - Nieprawidłowa liczba parametrów operatora jednoargumentowego. - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Nie można otworzyć projektu „{0}”, ponieważ rozszerzenie pliku „{1}” nie jest skojarzone z językiem. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf index 4079e600970ba..0debb02a468f1 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf @@ -52,11 +52,6 @@ DateTimeKind deve ser Utc - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - O tipo de destino precisa ser {0}, {1}, {2} ou {3}, mas o tipo fornecido é {4}. - - Document does not support syntax trees O documento não dá suporte a árvores de sintaxe @@ -137,51 +132,11 @@ Ciclo detectado em extensões - - Destination type must be a {0}, but given one is {1}. - O tipo de destino deve ser um {0}, mas o tipo fornecido é {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - O tipo de destino deve ser um {0} ou um {1}, mas o tipo fornecido é {2}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - O tipo de destino deve ser um {0}, {1} ou {2}, mas o tipo fornecido é {3}. - - - - Could not find location to generation symbol into. - Não foi possível encontrar o local para o símbolo de geração. - - - - No location provided to add statements to. - Nenhum local fornecido para o qual adicionar instruções. - - - - Destination location was not in source. - Local de destino não estava na origem. - - - - Destination location was from a different tree. - Local de destino era de uma árvore diferente. - - Node is of the wrong type. O nó é do tipo errado. - - Location must be null or from source. - Local deve ser nulo ou da fonte. - - Duplicate source file '{0}' in project '{1}' Arquivo de origem duplicado "{0}" no projeto "{1}" @@ -452,16 +407,6 @@ Não é possível gerar código para operador não suportado "{0}" - - Invalid number of parameters for binary operator. - Número inválido de parâmetros para o operador binário. - - - - Invalid number of parameters for unary operator. - Número inválido de parâmetros para o operador unário. - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Não é possível abrir o projeto "{0}" porque a extensão de arquivo "{1}" não está associada a um idioma. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf index f84d7e5a5fce0..a15d12cd10569 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf @@ -52,11 +52,6 @@ Параметр DateTimeKind должен содержать время и дату в формате UTC - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Конечный тип должен быть {0}, {1}, {2} или {3}, но указан {4}. - - Document does not support syntax trees Документ не поддерживает синтаксические деревья. @@ -137,51 +132,11 @@ В выражениях обнаружен цикл - - Destination type must be a {0}, but given one is {1}. - Конечный тип должен быть {0}, но указан {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Конечный тип должен быть {0} или {1}, но указан {2}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Конечный тип должен быть {0}, {1} или {2}, но указан {3}. - - - - Could not find location to generation symbol into. - Не удалось найти расположение для создания символа. - - - - No location provided to add statements to. - Для добавления операторов не было указано расположение. - - - - Destination location was not in source. - Целевое расположение не найдено в источнике. - - - - Destination location was from a different tree. - Целевое расположение находилось в другом дереве. - - Node is of the wrong type. Узел имеет неверный тип. - - Location must be null or from source. - Расположение должно иметь значение Null или источника. - - Duplicate source file '{0}' in project '{1}' Дублирование исходного файла "{0}" в проекте "{1}" @@ -452,16 +407,6 @@ Невозможно сформировать код для неподдерживаемого оператора "{0}" - - Invalid number of parameters for binary operator. - Недопустимое число параметров для бинарного оператора. - - - - Invalid number of parameters for unary operator. - Недопустимое число параметров для унарного оператора. - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Не удается открыть проект "{0}", так как расширение файла "{1}" не связано с языком. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf index 134a34cbdb11b..2e6aea73cea58 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf @@ -52,11 +52,6 @@ DateTimeKind Utc olmalıdır - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Hedef tür bir {0}, {1}, {2} veya {3} olmalı, ancak {4} belirtildi. - - Document does not support syntax trees Belge, söz dizimi ağaçlarını desteklemiyor @@ -137,51 +132,11 @@ Uzantılarda döngü algılandı - - Destination type must be a {0}, but given one is {1}. - Hedef tür bir {0} olmalı, ancak {1} belirtildi. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Hedef tür bir {0} veya {1} olmalı, ancak {2} belirtildi. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Hedef tür bir {0}, {1} veya {2} olmalı, ancak {3} belirtildi. - - - - Could not find location to generation symbol into. - Sembolün üretileceği konum bulunamadı. - - - - No location provided to add statements to. - Deyimlerin ekleneceği konum sağlanmadı. - - - - Destination location was not in source. - Hedef konum kaynakta değildi. - - - - Destination location was from a different tree. - Hedef konum farklı bir ağaçtandı. - - Node is of the wrong type. Düğüm yanlış türde. - - Location must be null or from source. - Konum boş veya kaynağa ait olmalıdır. - - Duplicate source file '{0}' in project '{1}' '{1}' projesinde yinelenen kaynak dosyası '{0}' @@ -452,16 +407,6 @@ Desteklenmeyen operatör '{0}' için kod üretilemiyor - - Invalid number of parameters for binary operator. - İkili operatör için parametre sayısı geçersiz. - - - - Invalid number of parameters for unary operator. - Birli operatör için parametre sayısı geçersiz. - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Dosya uzantısı '{1}' bir dil ile ilişkili olmadığı için '{0}' projesi açılamıyor. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf index d7f065176dd1f..2b3834b392764 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf @@ -52,11 +52,6 @@ DateTimeKind 必须是 Utc - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - 目标类型必须是 {0}、{1}、{2} 或 {3},但给定类型是 {4}。 - - Document does not support syntax trees 文档不支持语法树 @@ -137,51 +132,11 @@ 在扩展中检测到循环 - - Destination type must be a {0}, but given one is {1}. - 目标类型必须是 {0},但给定类型是 {1}。 - - - - Destination type must be a {0} or a {1}, but given one is {2}. - 目标类型必须是 {0} 或 {1},但给定类型是 {2}。 - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - 目标类型必须是 {0}、{1} 或 {2},但给定类型是 {3}。 - - - - Could not find location to generation symbol into. - 找不到符号生成到的位置。 - - - - No location provided to add statements to. - 未提供语句要添加到的位置。 - - - - Destination location was not in source. - 目标位置不在源中。 - - - - Destination location was from a different tree. - 目标位置来自不同的树。 - - Node is of the wrong type. 节点类型不正确。 - - Location must be null or from source. - 位置必须为 null 或来自源。 - - Duplicate source file '{0}' in project '{1}' 项目“{1}”中源文件“{0}”重复 @@ -452,16 +407,6 @@ 无法为不受支持的运算符“{0}”生成代码 - - Invalid number of parameters for binary operator. - 参数数目对二元运算符无效。 - - - - Invalid number of parameters for unary operator. - 参数数目对一元运算符无效。 - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. 无法打开项目“{0}”, 因为文件扩展名“{1}”没有与某种语言关联。 diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf index 939d15173014c..fdf0efabef1d5 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf @@ -52,11 +52,6 @@ DateTimeKind 必須是 Utc - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - 目的地類型必須是 {0}、{1}、{2} 或 {3},但提供的類型是 {4}。 - - Document does not support syntax trees 文件不支援語法樹 @@ -137,51 +132,11 @@ 在擴充功能中偵測到循環 - - Destination type must be a {0}, but given one is {1}. - 目的地類型必須是 {0},但提供的是 {1}。 - - - - Destination type must be a {0} or a {1}, but given one is {2}. - 目的地類型必須是 {0} 或 {1},但提供的是 {2}。 - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - 目的地類型必須是 {0}、{1} 或 {2},但提供的是 {3}。 - - - - Could not find location to generation symbol into. - 找不到產生符號目的地位置。 - - - - No location provided to add statements to. - 未提供加入陳述式的位置。 - - - - Destination location was not in source. - 目的地位置不在來源中。 - - - - Destination location was from a different tree. - 目的地位置來自不同的樹狀目錄。 - - Node is of the wrong type. 節點類型不正確。 - - Location must be null or from source. - 位置必須是 null 或源自來源。 - - Duplicate source file '{0}' in project '{1}' 複製專案 '{1}' 中的原始程式檔 '{0}' @@ -452,16 +407,6 @@ 無法產生不受支援之運算子 '{0}' 的程式碼 - - Invalid number of parameters for binary operator. - 二元運算子的參數數目無效。 - - - - Invalid number of parameters for unary operator. - 一元運算子的參數數目無效。 - - Cannot open project '{0}' because the file extension '{1}' is not associated with a language. 無法開啟專案 '{0}',因為副檔名 '{1}' 未與語言相關聯。 diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs index 34d3c61dd7f1a..923f603901323 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs @@ -3,6 +3,8 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Immutable; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.LanguageServices; @@ -10,6 +12,27 @@ namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class IMethodSymbolExtensions { + /// + /// Returns the methodSymbol and any partial parts. + /// + public static ImmutableArray GetAllMethodSymbolsOfPartialParts(this IMethodSymbol method) + { + if (method.PartialDefinitionPart != null) + { + Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); + return ImmutableArray.Create(method, method.PartialDefinitionPart); + } + else if (method.PartialImplementationPart != null) + { + Debug.Assert(!Equals(method.PartialImplementationPart, method)); + return ImmutableArray.Create(method.PartialImplementationPart, method); + } + else + { + return ImmutableArray.Create(method); + } + } + /// /// Returns true for void returning methods with two parameters, where /// the first parameter is of type and the second diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs index d90f5d03d5f67..ccae323b36542 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs @@ -12,10 +12,27 @@ using Microsoft.CodeAnalysis.Shared.Utilities; using Roslyn.Utilities; +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else +using Microsoft.CodeAnalysis.Editing; +#endif + namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class ISymbolExtensions { + public static DeclarationModifiers GetSymbolModifiers(this ISymbol symbol) + { + return new DeclarationModifiers( + isStatic: symbol.IsStatic, + isAbstract: symbol.IsAbstract, + isUnsafe: symbol.RequiresUnsafeModifier(), + isVirtual: symbol.IsVirtual, + isOverride: symbol.IsOverride, + isSealed: symbol.IsSealed); + } + public static string ToNameDisplayString(this ISymbol symbol) => symbol.ToDisplayString(SymbolDisplayFormats.NameFormat); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs index 0a3dd965b3f54..b9695d23e8e1a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs @@ -62,5 +62,21 @@ public static bool TryRemoveFirst(this IList list, Func(this IList list, Func predicate) + { + Contract.ThrowIfNull(list); + Contract.ThrowIfNull(predicate); + + for (var i = 0; i < list.Count; i++) + { + if (predicate(list[i])) + { + return i; + } + } + + return -1; + } } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs index 6f39379e5a29e..89325f2535625 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs @@ -5,11 +5,30 @@ using System; using System.Threading; using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class SourceTextExtensions { + /// + /// Returns the leading whitespace of the line located at the specified position in the given snapshot. + /// + public static string GetLeadingWhitespaceOfLineAtPosition(this SourceText text, int position) + { + Contract.ThrowIfNull(text); + + var line = text.Lines.GetLineFromPosition(position); + var linePosition = line.GetFirstNonWhitespacePosition(); + if (!linePosition.HasValue) + { + return line.ToString(); + } + + var lineText = line.ToString(); + return lineText.Substring(0, linePosition.Value - line.Start); + } + public static bool OverlapsHiddenPosition( this SourceText text, TextSpan span, Func isPositionHidden, CancellationToken cancellationToken) { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems index f4ccbf505feb8..c50917f98c57d 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems @@ -9,6 +9,31 @@ Microsoft.CodeAnalysis.CSharp.Shared + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/ArgumentGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ArgumentGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/ArgumentGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ArgumentGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/AttributeGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/AttributeGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/AttributeGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/AttributeGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationHelpers.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationHelpers.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationHelpers.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationHelpers.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationOptions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationOptions.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationOptions.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationOptions.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationPreferences.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationPreferences.cs similarity index 95% rename from src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationPreferences.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationPreferences.cs index b82d4859e943d..a3bf3a4467dd6 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationPreferences.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationPreferences.cs @@ -8,9 +8,14 @@ using Microsoft.CodeAnalysis.CodeGeneration; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; -using Microsoft.CodeAnalysis.Options; using Roslyn.Utilities; +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; +#endif + namespace Microsoft.CodeAnalysis.CSharp.CodeGeneration { internal sealed class CSharpCodeGenerationPreferences : CodeGenerationPreferences diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationService.cs similarity index 99% rename from src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationService.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationService.cs index 71ca665e7f620..2e88507378078 100644 --- a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationService.cs @@ -15,11 +15,16 @@ using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageServices; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; +#endif + namespace Microsoft.CodeAnalysis.CSharp.CodeGeneration { internal partial class CSharpCodeGenerationService : AbstractCodeGenerationService diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationServiceFactory.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationServiceFactory.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationServiceFactory.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationServiceFactory.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpDeclarationComparer.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpDeclarationComparer.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/CSharpDeclarationComparer.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpDeclarationComparer.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpFlagsEnumGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpFlagsEnumGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/CSharpFlagsEnumGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpFlagsEnumGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpSyntaxGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpSyntaxGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/ConstructorGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ConstructorGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/ConstructorGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ConstructorGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/ConversionGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ConversionGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/ConversionGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ConversionGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/DestructorGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/DestructorGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/DestructorGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/DestructorGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/EnumMemberGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/EnumMemberGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/EnumMemberGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/EnumMemberGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/EventGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/EventGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/EventGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/EventGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/ExpressionGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ExpressionGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/ExpressionGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ExpressionGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/FieldGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/FieldGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/FieldGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/FieldGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/MethodGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/MethodGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/NamedTypeGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamedTypeGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/NamedTypeGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamedTypeGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/NamespaceGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamespaceGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/NamespaceGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamespaceGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/OperatorGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/OperatorGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/OperatorGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/OperatorGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/ParameterGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ParameterGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/ParameterGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ParameterGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/PropertyGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/PropertyGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/PropertyGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/PropertyGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/StatementGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/StatementGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/StatementGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/StatementGenerator.cs diff --git a/src/Workspaces/CSharp/Portable/CodeGeneration/TypeParameterGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/TypeParameterGenerator.cs similarity index 100% rename from src/Workspaces/CSharp/Portable/CodeGeneration/TypeParameterGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/TypeParameterGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs index 1b726becb9d2b..449d8c4fbae50 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs @@ -15,6 +15,13 @@ using Microsoft.CodeAnalysis.Host.Mef; using Roslyn.Utilities; +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; +#endif + + namespace Microsoft.CodeAnalysis.CSharp.AddImport { [ExportLanguageService(typeof(IAddImportsService), LanguageNames.CSharp), Shared] @@ -27,12 +34,10 @@ public CSharpAddImportsService() { } -#if !CODE_STYLE - public override bool PlaceImportsInsideNamespaces(Options.OptionSet optionSet) + public override bool PlaceImportsInsideNamespaces(OptionSet optionSet) { return optionSet.GetOption(CSharpCodeStyleOptions.PreferredUsingDirectivePlacement).Value == AddImportPlacement.InsideNamespace; } -#endif // C# doesn't have global imports. protected override ImmutableArray GetGlobalImports(Compilation compilation, SyntaxGenerator generator) diff --git a/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService.cs similarity index 95% rename from src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService.cs index ef33ce30a9c2d..180cac4cc6543 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService.cs @@ -12,12 +12,18 @@ using Microsoft.CodeAnalysis.AddImport; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.LanguageServices; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Simplification; using Roslyn.Utilities; +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; +#endif + + namespace Microsoft.CodeAnalysis.CodeGeneration { internal abstract partial class AbstractCodeGenerationService : ICodeGenerationService @@ -154,7 +160,7 @@ protected static void CheckDeclarationNode(SyntaxNode destinat if (destination is not TDeclarationNode) { throw new ArgumentException( - string.Format(WorkspacesResources.Destination_type_must_be_a_0_but_given_one_is_1, typeof(TDeclarationNode).Name, destination.GetType().Name), + string.Format(WorkspaceExtensionsResources.Destination_type_must_be_a_0_but_given_one_is_1, typeof(TDeclarationNode).Name, destination.GetType().Name), nameof(destination)); } } @@ -172,7 +178,7 @@ protected static void CheckDeclarationNode not TDeclarationNode2) { throw new ArgumentException( - string.Format(WorkspacesResources.Destination_type_must_be_a_0_or_a_1_but_given_one_is_2, + string.Format(WorkspaceExtensionsResources.Destination_type_must_be_a_0_or_a_1_but_given_one_is_2, typeof(TDeclarationNode1).Name, typeof(TDeclarationNode2).Name, destination.GetType().Name), nameof(destination)); } @@ -193,7 +199,7 @@ not TDeclarationNode2 and not TDeclarationNode3) { throw new ArgumentException( - string.Format(WorkspacesResources.Destination_type_must_be_a_0_1_or_2_but_given_one_is_3, + string.Format(WorkspaceExtensionsResources.Destination_type_must_be_a_0_1_or_2_but_given_one_is_3, typeof(TDeclarationNode1).Name, typeof(TDeclarationNode2).Name, typeof(TDeclarationNode3).Name, destination.GetType().Name), nameof(destination)); } @@ -211,7 +217,7 @@ not TDeclarationNode3 and not TDeclarationNode4) { throw new ArgumentException( - string.Format(WorkspacesResources.Destination_type_must_be_a_0_1_2_or_3_but_given_one_is_4, + string.Format(WorkspaceExtensionsResources.Destination_type_must_be_a_0_1_2_or_3_but_given_one_is_4, typeof(TDeclarationNode1).Name, typeof(TDeclarationNode2).Name, typeof(TDeclarationNode3).Name, typeof(TDeclarationNode4).Name, destination.GetType().Name), nameof(destination)); } @@ -229,7 +235,7 @@ private async Task GetEditAsync( if (destinationDeclaration == null) { - throw new ArgumentException(WorkspacesResources.Could_not_find_location_to_generation_symbol_into); + throw new ArgumentException(WorkspaceExtensionsResources.Could_not_find_location_to_generation_symbol_into); } var destinationTree = destinationDeclaration.SyntaxTree; @@ -245,7 +251,13 @@ private async Task GetEditAsync( if (context.AddImports) { var addImportsOptions = await AddImportPlacementOptions.FromDocumentAsync(newDocument, cancellationToken).ConfigureAwait(false); - newDocument = await ImportAdder.AddImportsFromSymbolAnnotationAsync(newDocument, addImportsOptions, cancellationToken).ConfigureAwait(false); + var importAdder = newDocument.GetRequiredLanguageService(); + newDocument = await importAdder.AddImportsAsync( + newDocument, + SpecializedCollections.SingletonEnumerable(currentRoot.FullSpan), + ImportAdderService.Strategy.AddImportsFromSymbolAnnotations, + addImportsOptions, + cancellationToken).ConfigureAwait(false); } return newDocument; @@ -470,17 +482,17 @@ protected static void CheckLocation(SyntaxNode destinationMember, [NotNull] Loca { if (location == null) { - throw new ArgumentException(WorkspacesResources.No_location_provided_to_add_statements_to); + throw new ArgumentException(WorkspaceExtensionsResources.No_location_provided_to_add_statements_to); } if (!location.IsInSource) { - throw new ArgumentException(WorkspacesResources.Destination_location_was_not_in_source); + throw new ArgumentException(WorkspaceExtensionsResources.Destination_location_was_not_in_source); } if (location.SourceTree != destinationMember.SyntaxTree) { - throw new ArgumentException(WorkspacesResources.Destination_location_was_from_a_different_tree); + throw new ArgumentException(WorkspaceExtensionsResources.Destination_location_was_from_a_different_tree); } } diff --git a/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs similarity index 99% rename from src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs index b3c34ae5a3963..8325c7ef813b1 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs @@ -80,7 +80,7 @@ private bool CanAddTo(SyntaxNode? destination, Solution solution, CancellationTo // If we are avoiding generating into files marked as generated (but are still regular files) // then check accordingly. This is distinct from the prior check in that we as a fallback // will generate into these files is we have no alternative. - if (checkGeneratedCode && document.IsGeneratedCode(cancellationToken)) + if (checkGeneratedCode && document.IsGeneratedCode(syntaxTree, cancellationToken)) { return false; } diff --git a/src/Workspaces/Core/Portable/CodeGeneration/AbstractFlagsEnumGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractFlagsEnumGenerator.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/AbstractFlagsEnumGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractFlagsEnumGenerator.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationContext.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationContext.cs similarity index 99% rename from src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationContext.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationContext.cs index f1be39d46f4c0..3162ef6cff9da 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationContext.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationContext.cs @@ -167,7 +167,7 @@ private static void CheckLocation(Location? location, string name) { if (location != null && !location.IsInSource) { - throw new ArgumentException(WorkspacesResources.Location_must_be_null_or_from_source, name); + throw new ArgumentException(WorkspaceExtensionsResources.Location_must_be_null_or_from_source, name); } } diff --git a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationDestination.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationDestination.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationDestination.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationDestination.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationHelpers.cs similarity index 99% rename from src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationHelpers.cs index 5194dbd5f5e1e..3877b049c3e78 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationHelpers.cs @@ -119,7 +119,7 @@ public static bool TryGetDocumentationComment( ISymbol symbol, string commentToken, [NotNullWhen(true)] out string? comment, CancellationToken cancellationToken = default) { var xml = symbol.GetDocumentationCommentXml(cancellationToken: cancellationToken); - if (string.IsNullOrEmpty(xml)) + if (RoslynString.IsNullOrEmpty(xml)) { comment = null; return false; @@ -167,7 +167,7 @@ public static IEnumerable GetMembers(INamedTypeSymbol namedType) } return f1.HasConstantValue - ? Comparer.Default.Compare(f1.ConstantValue, f2.ConstantValue) + ? Comparer.Default.Compare(f1.ConstantValue, f2.ConstantValue!) : f1.Name.CompareTo(f2.Name); }).ToList(); } diff --git a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationOperatorKind.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationOperatorKind.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationOperatorKind.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationOperatorKind.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationOptions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationOptions.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationOptions.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationOptions.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationPreferences.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationPreferences.cs index 3b36e4cff23a0..e85c1d81aafb2 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationPreferences.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationPreferences.cs @@ -7,6 +7,7 @@ using Roslyn.Utilities; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Editing; +using Microsoft.CodeAnalysis.Diagnostics; #if CODE_STYLE using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; @@ -34,18 +35,21 @@ public CodeGenerationPreferences(OptionSet options) public bool PlaceSystemNamespaceFirst => Options.GetOption(GenerationOptions.PlaceSystemNamespaceFirst, Language); -#if !CODE_STYLE public abstract CodeGenerationOptions GetOptions(CodeGenerationContext context); public static async Task FromDocumentAsync(Document document, CancellationToken cancellationToken) { var parseOptions = document.Project.ParseOptions; Contract.ThrowIfNull(parseOptions); - +#if CODE_STYLE + var tree = await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); + var documentOptions = document.Project.AnalyzerOptions.GetAnalyzerOptionSet(tree, cancellationToken); +#else var documentOptions = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); +#endif + var codeGenerationService = document.GetRequiredLanguageService(); return codeGenerationService.GetPreferences(parseOptions, documentOptions); } -#endif } } diff --git a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationSymbolFactory.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationSymbolFactory.cs similarity index 99% rename from src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationSymbolFactory.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationSymbolFactory.cs index 2ef60b41f806d..cfa882aede743 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationSymbolFactory.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationSymbolFactory.cs @@ -6,9 +6,14 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; -using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Shared.Extensions; +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else +using Microsoft.CodeAnalysis.Editing; +#endif + namespace Microsoft.CodeAnalysis.CodeGeneration { /// @@ -202,8 +207,8 @@ public static IMethodSymbol CreateOperatorSymbol( if (parameters.Length != expectedParameterCount) { var message = expectedParameterCount == 1 ? - WorkspacesResources.Invalid_number_of_parameters_for_unary_operator : - WorkspacesResources.Invalid_number_of_parameters_for_binary_operator; + WorkspaceExtensionsResources.Invalid_number_of_parameters_for_unary_operator : + WorkspaceExtensionsResources.Invalid_number_of_parameters_for_binary_operator; throw new ArgumentException(message, nameof(parameters)); } diff --git a/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerator.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/CodeGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerator.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/ICodeGenerationService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/ICodeGenerationService.cs similarity index 98% rename from src/Workspaces/Core/Portable/CodeGeneration/ICodeGenerationService.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/ICodeGenerationService.cs index 84b85e9e18d6d..b83d17069bbdf 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/ICodeGenerationService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/ICodeGenerationService.cs @@ -6,7 +6,13 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Options; + +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; +#endif + namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/INamedTypeSymbolExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/INamedTypeSymbolExtensions.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/INamedTypeSymbolExtensions.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/INamedTypeSymbolExtensions.cs diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/ITypeGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/ITypeGenerator.cs similarity index 100% rename from src/Workspaces/Core/Portable/Shared/Extensions/ITypeGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/ITypeGenerator.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/LiteralSpecialValues.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/LiteralSpecialValues.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/LiteralSpecialValues.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/LiteralSpecialValues.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/NullableSyntaxAnnotation.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/NullableSyntaxAnnotation.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/NullableSyntaxAnnotation.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/NullableSyntaxAnnotation.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs similarity index 98% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs index c040bccc0cdd0..d22dda6e7dceb 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs @@ -6,7 +6,12 @@ using System.Collections.Immutable; using System.Reflection.Metadata; + +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else using Microsoft.CodeAnalysis.Editing; +#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs similarity index 98% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs index afb4c096ccf9d..4599685e658f9 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs @@ -7,7 +7,12 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; + +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else using Microsoft.CodeAnalysis.Editing; +#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationArrayTypeSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationArrayTypeSymbol.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationArrayTypeSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationArrayTypeSymbol.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAttributeData.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAttributeData.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAttributeData.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAttributeData.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructedMethodSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructedMethodSymbol.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructedMethodSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructedMethodSymbol.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructedNamedTypeSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructedNamedTypeSymbol.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructedNamedTypeSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructedNamedTypeSymbol.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructorInfo.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructorInfo.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructorInfo.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructorInfo.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs similarity index 96% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs index c1aa5ebb8ea00..be6376ceae81d 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs @@ -5,7 +5,12 @@ #nullable disable using System.Collections.Immutable; + +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else using Microsoft.CodeAnalysis.Editing; +#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs similarity index 95% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs index e8d7d0eecc34e..b41e77f7259c1 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs @@ -5,7 +5,12 @@ #nullable disable using System.Collections.Immutable; + +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else using Microsoft.CodeAnalysis.Editing; +#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationDestructorInfo.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationDestructorInfo.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationDestructorInfo.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationDestructorInfo.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationDestructorSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationDestructorSymbol.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationDestructorSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationDestructorSymbol.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationEventInfo.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationEventInfo.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationEventInfo.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationEventInfo.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs similarity index 97% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs index 7b7949f8b12d3..efed6d2d9edc4 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs @@ -3,7 +3,12 @@ // See the LICENSE file in the project root for more information. using System.Collections.Immutable; + +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else using Microsoft.CodeAnalysis.Editing; +#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationFieldInfo.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationFieldInfo.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationFieldInfo.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationFieldInfo.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs similarity index 97% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs index ceb695c493def..e5b1f1d092ba8 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs @@ -5,7 +5,12 @@ #nullable disable using System.Collections.Immutable; + +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else using Microsoft.CodeAnalysis.Editing; +#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodInfo.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationMethodInfo.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodInfo.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationMethodInfo.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs similarity index 98% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs index f17a9dabd284c..c66f84eb97c5e 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs @@ -7,7 +7,12 @@ using System; using System.Collections.Immutable; using System.Diagnostics; + +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else using Microsoft.CodeAnalysis.Editing; +#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs similarity index 98% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs index 9176276d0b62e..544470cbb8caa 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs @@ -8,9 +8,14 @@ using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Editing; using Roslyn.Utilities; +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else +using Microsoft.CodeAnalysis.Editing; +#endif + namespace Microsoft.CodeAnalysis.CodeGeneration { internal class CodeGenerationNamedTypeSymbol : CodeGenerationAbstractNamedTypeSymbol diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceInfo.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceInfo.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceInfo.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceInfo.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs similarity index 95% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs index f8d25434497b1..4cf190debb603 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs @@ -5,7 +5,12 @@ #nullable disable using System.Collections.Immutable; + +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else using Microsoft.CodeAnalysis.Editing; +#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceSymbol.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceSymbol.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs similarity index 98% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs index 2e99829026b52..c5968021388e8 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs @@ -5,9 +5,14 @@ #nullable disable using System.Collections.Immutable; -using Microsoft.CodeAnalysis.Editing; using Roslyn.Utilities; +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else +using Microsoft.CodeAnalysis.Editing; +#endif + namespace Microsoft.CodeAnalysis.CodeGeneration { internal class CodeGenerationOperatorSymbol : CodeGenerationMethodSymbol diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs similarity index 97% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs index 5c24c75230aaa..87e5dabf4dd0b 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs @@ -5,7 +5,12 @@ #nullable disable using System.Collections.Immutable; + +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else using Microsoft.CodeAnalysis.Editing; +#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPointerTypeSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPointerTypeSymbol.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPointerTypeSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPointerTypeSymbol.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPropertyInfo.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertyInfo.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPropertyInfo.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertyInfo.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs similarity index 97% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs index 7909d1f0a6ca4..bef1da886c368 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs @@ -5,7 +5,12 @@ #nullable disable using System.Collections.Immutable; + +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else using Microsoft.CodeAnalysis.Editing; +#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationSymbol.cs similarity index 88% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationSymbol.cs index d120665f77ef4..bb8a7b16c9245 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationSymbol.cs @@ -9,9 +9,14 @@ using System.Globalization; using System.Runtime.CompilerServices; using System.Threading; -using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Shared.Extensions; +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else +using Microsoft.CodeAnalysis.Editing; +#endif + namespace Microsoft.CodeAnalysis.CodeGeneration { internal abstract class CodeGenerationSymbol : ISymbol @@ -64,12 +69,30 @@ private static CodeGenerationSymbol AddAnnotationsTo( { annotationsTable.TryGetValue(originalDefinition, out var originalAnnotations); - annotations = SyntaxAnnotationExtensions.CombineAnnotations(originalAnnotations, annotations); + annotations = CombineAnnotations(originalAnnotations, annotations); annotationsTable.Add(newDefinition, annotations); return newDefinition; } + private static SyntaxAnnotation[] CombineAnnotations( + SyntaxAnnotation[] originalAnnotations, + SyntaxAnnotation[] newAnnotations) + { + if (!originalAnnotations.IsNullOrEmpty()) + { + // Make a new array (that includes the new annotations) and copy the original + // annotations into it. + var finalAnnotations = newAnnotations; + Array.Resize(ref finalAnnotations, originalAnnotations.Length + newAnnotations.Length); + Array.Copy(originalAnnotations, 0, finalAnnotations, newAnnotations.Length, originalAnnotations.Length); + + return finalAnnotations; + } + + return newAnnotations; + } + public abstract SymbolKind Kind { get; } public string Language => "Code Generation Agnostic Language"; diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationTypeParameterSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationTypeParameterSymbol.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationTypeParameterSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationTypeParameterSymbol.cs diff --git a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs similarity index 98% rename from src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs index efaa88336e672..93a364de72e54 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs @@ -5,7 +5,12 @@ #nullable disable using System.Collections.Immutable; + +#if CODE_STYLE +using Microsoft.CodeAnalysis.Internal.Editing; +#else using Microsoft.CodeAnalysis.Editing; +#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/Core/Portable/CodeGeneration/SyntaxAnnotationExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/SyntaxAnnotationExtensions.cs similarity index 52% rename from src/Workspaces/Core/Portable/CodeGeneration/SyntaxAnnotationExtensions.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/SyntaxAnnotationExtensions.cs index 52f0d7a276b5c..018cc2f3bebc3 100644 --- a/src/Workspaces/Core/Portable/CodeGeneration/SyntaxAnnotationExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/SyntaxAnnotationExtensions.cs @@ -19,23 +19,5 @@ public static TSymbol AddAnnotationToSymbol( var codeGenSymbol = (CodeGenerationSymbol)(object)symbol; return (TSymbol)(object)codeGenSymbol.WithAdditionalAnnotations(annotation); } - - internal static SyntaxAnnotation[] CombineAnnotations( - SyntaxAnnotation[] originalAnnotations, - SyntaxAnnotation[] newAnnotations) - { - if (!originalAnnotations.IsNullOrEmpty()) - { - // Make a new array (that includes the new annotations) and copy the original - // annotations into it. - var finalAnnotations = newAnnotations; - Array.Resize(ref finalAnnotations, originalAnnotations.Length + newAnnotations.Length); - Array.Copy(originalAnnotations, 0, finalAnnotations, newAnnotations.Length, originalAnnotations.Length); - - return finalAnnotations; - } - - return newAnnotations; - } } } diff --git a/src/Workspaces/Core/Portable/CodeGeneration/TypeGenerator.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/TypeGenerator.cs similarity index 100% rename from src/Workspaces/Core/Portable/CodeGeneration/TypeGenerator.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/TypeGenerator.cs diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/ArrayExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/ArrayExtensions.cs similarity index 100% rename from src/Workspaces/Core/Portable/Shared/Extensions/ArrayExtensions.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/ArrayExtensions.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs index baa5040bc0af0..ba930e585ddbf 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs @@ -187,6 +187,12 @@ public static bool IsGeneratedCode(this Document document, CancellationToken can } #endif + public static bool IsGeneratedCode(this Document document, SyntaxTree tree, CancellationToken cancellationToken) + { + var generatedCodeRecognitionService = document.GetLanguageService(); + return generatedCodeRecognitionService?.IsGeneratedCode(tree, document, cancellationToken) == true; + } + public static async Task IsGeneratedCodeAsync(this Document document, CancellationToken cancellationToken) { var generatedCodeRecognitionService = document.GetLanguageService(); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs index 68eac08935bf7..04763463f1f96 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs @@ -10,6 +10,12 @@ using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Shared.Extensions; +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; +#endif + namespace Microsoft.CodeAnalysis.AddImport { internal abstract class AbstractAddImportsService @@ -29,9 +35,7 @@ protected AbstractAddImportsService() protected abstract SyntaxList GetExterns(SyntaxNode node); protected abstract bool IsStaticUsing(TUsingOrAliasSyntax usingOrAlias); -#if !CODE_STYLE - public abstract bool PlaceImportsInsideNamespaces(Options.OptionSet optionSet); -#endif + public abstract bool PlaceImportsInsideNamespaces(OptionSet optionSet); private bool IsSimpleUsing(TUsingOrAliasSyntax usingOrAlias) => !IsAlias(usingOrAlias) && !IsStaticUsing(usingOrAlias); private bool IsAlias(TUsingOrAliasSyntax usingOrAlias) => GetAlias(usingOrAlias) != null; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs index 489d167099e4b..ceee0a3cd7a2e 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs @@ -6,11 +6,18 @@ using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using Microsoft.CodeAnalysis.Options; +#endif + namespace Microsoft.CodeAnalysis.AddImport { [DataContract] @@ -23,7 +30,7 @@ internal record struct AddImportPlacementOptions( public static async Task FromDocumentAsync(Document document, CancellationToken cancellationToken) => FromDocument(document, await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false)); - public static AddImportPlacementOptions FromDocument(Document document, Options.OptionSet documentOptions) + public static AddImportPlacementOptions FromDocument(Document document, OptionSet documentOptions) { var service = document.GetRequiredLanguageService(); @@ -41,14 +48,22 @@ private static bool CanAddImportsInHiddenRegions(Document document) var spanMapper = document.Services.GetService(); return spanMapper != null && spanMapper.SupportsMappingImportDirectives; } +#else + public static async Task FromDocumentAsync(Document document, CancellationToken cancellationToken) + { + var service = document.GetRequiredLanguageService(); + var options = document.Project.AnalyzerOptions.GetAnalyzerOptionSet(await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false), cancellationToken); + return new( + PlaceSystemNamespaceFirst: options.GetOption(GenerationOptions.PlaceSystemNamespaceFirst), + PlaceImportsInsideNamespaces: service.PlaceImportsInsideNamespaces(options), + AllowInHiddenRegions: false); + } #endif } internal interface IAddImportsService : ILanguageService { -#if !CODE_STYLE - bool PlaceImportsInsideNamespaces(Options.OptionSet optionSet); -#endif + bool PlaceImportsInsideNamespaces(OptionSet optionSet); /// /// Returns true if the tree already has an existing import syntactically equivalent to diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs index 3547f536f7542..12819c4d7f6c8 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs @@ -28,7 +28,7 @@ public async Task IsGeneratedCodeAsync(Document document, CancellationToke return IsGeneratedCode(syntaxTree, document, cancellationToken); } - private static bool IsGeneratedCode(SyntaxTree syntaxTree, Document document, CancellationToken cancellationToken) + public bool IsGeneratedCode(SyntaxTree syntaxTree, Document document, CancellationToken cancellationToken) { var syntaxFacts = document.GetLanguageService(); return syntaxTree.IsGeneratedCode(document.Project.AnalyzerOptions, syntaxFacts, cancellationToken); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs index f4e7b1dea31c4..55f8b414fcc31 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs @@ -17,5 +17,7 @@ internal interface IGeneratedCodeRecognitionService : ILanguageService #endif Task IsGeneratedCodeAsync(Document document, CancellationToken cancellationToken); + + bool IsGeneratedCode(SyntaxTree syntaxTree, Document document, CancellationToken cancellationToken); } } diff --git a/src/Workspaces/Core/Portable/Editing/ImportAdderService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/ImportAdder/ImportAdderService.cs similarity index 100% rename from src/Workspaces/Core/Portable/Editing/ImportAdderService.cs rename to src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/ImportAdder/ImportAdderService.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems index 6d798ec06c87a..90960257abe40 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems @@ -10,8 +10,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -39,6 +86,7 @@ + diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensionsResources.resx b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensionsResources.resx index f5b438da33afe..2bf8009eed9e8 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensionsResources.resx +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensionsResources.resx @@ -144,4 +144,37 @@ Warning: Declaration changes scope and may change meaning. + + Location must be null or from source. + + + Could not find location to generation symbol into. + + + Destination location was from a different tree. + + + Destination location was not in source. + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + Destination type must be a {0}, but given one is {1}. + + + Destination type must be a {0} or a {1}, but given one is {2}. + + + No location provided to add statements to. + + + Invalid number of parameters for binary operator. + + + Invalid number of parameters for unary operator. + \ No newline at end of file diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.cs.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.cs.xlf index b260a21696b04..15ce5cde54f35 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.cs.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.cs.xlf @@ -7,6 +7,41 @@ K provedení úlohy se vyžaduje kompilace, ale projekt {0} ji nepodporuje. + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' Opravit vše ({0}) @@ -22,6 +57,26 @@ Opravit vše ({0}) v řešení + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution Ke splnění úkolu se vyžaduje projekt s ID {0}, který ale není z řešení dostupný. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.de.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.de.xlf index e1b4b7ed01fc5..f3318f32fe58b 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.de.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.de.xlf @@ -7,6 +7,41 @@ Die Kompilierung ist zum Ausführen der Aufgabe erforderlich, wird aber vom Projekt "{0}" nicht unterstützt. + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' Alle '{0}' reparieren @@ -22,6 +57,26 @@ Alle '{0}' in Lösung reparieren + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution Ein Projekt mit der ID "{0}" ist zum Ausführen der Aufgabe erforderlich, steht aber in der Projektmappe nicht zur Verfügung. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.es.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.es.xlf index 1b78e6d680b8a..10e0c0bdeed4e 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.es.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.es.xlf @@ -7,6 +7,41 @@ La compilación es necesaria para realizar la tarea, pero el proyecto {0} no la admite. + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' Corregir todo '{0}' @@ -22,6 +57,26 @@ Corregir todo '{0}' en solución + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution Se necesita el identificador de proyecto "{0}" para realizar la tarea, pero no está disponibles en la solución diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.fr.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.fr.xlf index c00a9f0c92b08..00f6c594cbafb 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.fr.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.fr.xlf @@ -7,6 +7,41 @@ Une compilation est nécessaire pour accomplir la tâche, mais elle n'est pas prise en charge par le projet {0}. + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' Corriger tous les '{0}' @@ -22,6 +57,26 @@ Corriger tous les '{0}' dans la solution + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution Le projet de l'ID {0} est nécessaire pour accomplir la tâche mais n'est pas disponible dans la solution diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.it.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.it.xlf index 584ccef5f4fb7..5324bd365f72f 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.it.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.it.xlf @@ -7,6 +7,41 @@ Per eseguire l'attività, è necessaria la compilazione, che però non è supportata dal progetto {0}. + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' Correggi tutti '{0}' @@ -22,6 +57,26 @@ Correggi tutti '{0}' nella soluzione + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution Per eseguire l'attività, è necessario il progetto con ID '{0}', che però non è disponibile dalla soluzione diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ja.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ja.xlf index 878a0817f7cb4..770f670759bfd 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ja.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ja.xlf @@ -7,6 +7,41 @@ コンパイルはタスクの実行に必要ですが、プロジェクト {0} ではサポートされていません。 + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' すべての '{0}' を修正します @@ -22,6 +57,26 @@ ソリューションに含まれているすべての '{0}' を修正します + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution タスクの完了には ID {0} のプロジェクトが必要ですが、このソリューションからは利用できません diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ko.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ko.xlf index b7893a187a979..0b9a670077886 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ko.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ko.xlf @@ -7,6 +7,41 @@ 작업을 수행하는 데 컴파일이 필요하지만 프로젝트 {0}에서 지원하지 않습니다. + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' 모든 '{0}' 수정 @@ -22,6 +57,26 @@ 솔루션의 모든 '{0}' 수정 + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution 작업을 수행하는 데 ID가 {0}인 프로젝트가 필요하지만, 솔루션에서 해당 프로젝트를 사용할 수 없습니다. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pl.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pl.xlf index 6ce41179340ce..0169ce14061b0 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pl.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pl.xlf @@ -7,6 +7,41 @@ Ukończenie zadania wymaga kompilacji, ale nie jest ona obsługiwana przez projekt {0}. + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' Napraw wszystkie wystąpienia elementu „{0}” @@ -22,6 +57,26 @@ Napraw wszystkie wystąpienia elementu „{0}” w rozwiązaniu + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution Do wykonania zadania wymagany jest projekt o identyfikatorze {0}, ale nie jest on udostępniany przez rozwiązanie diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pt-BR.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pt-BR.xlf index d9f762bf4227e..d5184729cebc9 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pt-BR.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pt-BR.xlf @@ -7,6 +7,41 @@ A compilação é necessária para realizar a tarefa, mas não é compatível com o projeto {0}. + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' Corrigir todos os '{0}' @@ -22,6 +57,26 @@ Corrigir todos os '{0}' na Solução + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution O projeto com a ID {0} é necessário para realizar a tarefa, mas não está disponível na solução diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ru.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ru.xlf index 742117c1c9930..36f75411bc17a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ru.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ru.xlf @@ -7,6 +7,41 @@ Для выполнения задачи требуется компиляция, но она не поддерживается в проекте {0}. + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' Исправить все "{0}" @@ -22,6 +57,26 @@ Исправить все "{0}" в решении + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution Проект с ИД "{0}" необходим для выполнения задачи, но он недоступен из решения. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.tr.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.tr.xlf index befe4cda1ace2..92f78344b59f8 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.tr.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.tr.xlf @@ -7,6 +7,41 @@ Görevi gerçekleştirmek için derleme gerekiyor ancak bu, {0} projesi tarafından desteklenmiyor. + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' Geçtiği her yerde '{0}' ifadesini düzelt @@ -22,6 +57,26 @@ Çözüm'de geçtiği her yerde '{0}' ifadesini düzelt + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution Görevi gerçekleştirmek için '{0}' kimlikli proje gerekli, ancak bu proje çözümde yok diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hans.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hans.xlf index 6196afb3309a9..2ccebe3aa24ec 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hans.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hans.xlf @@ -7,6 +7,41 @@ 必须进行编译才能完成该任务,但项目 {0} 不支持此操作。 + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' 修复所有“{0}” @@ -22,6 +57,26 @@ 修复解决方案中的所有“{0}” + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution 需要 ID 为 {0} 的项目才能完成任务,但无法从解决方案中使用该项目 diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hant.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hant.xlf index 726bc7c6fa2ab..c1e9af3667f5a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hant.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hant.xlf @@ -7,6 +7,41 @@ 必須編譯才能完成工作,但專案 {0} 並不支援。 + + Could not find location to generation symbol into. + Could not find location to generation symbol into. + + + + Destination location was from a different tree. + Destination location was from a different tree. + + + + Destination location was not in source. + Destination location was not in source. + + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + + Destination type must be a {0}, but given one is {1}. + Destination type must be a {0}, but given one is {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Destination type must be a {0} or a {1}, but given one is {2}. + + Fix all '{0}' 修正所有 '{0}' @@ -22,6 +57,26 @@ 修正方案中的所有 '{0}' + + Invalid number of parameters for binary operator. + Invalid number of parameters for binary operator. + + + + Invalid number of parameters for unary operator. + Invalid number of parameters for unary operator. + + + + Location must be null or from source. + Location must be null or from source. + + + + No location provided to add statements to. + No location provided to add statements to. + + Project of ID {0} is required to accomplish the task but is not available from the solution 完成工作需要識別碼為 {0} 的專案,但是無法從解決方案取得 diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb index 035f8718aa952..88842d65e6cf6 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb @@ -12,6 +12,12 @@ Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Microsoft.CodeAnalysis.VisualBasic.Utilities +#If CODE_STYLE Then +Imports OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions +#Else +Imports Microsoft.CodeAnalysis.Options +#End If + Namespace Microsoft.CodeAnalysis.VisualBasic.AddImports Friend Class VisualBasicAddImportsService @@ -57,12 +63,11 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.AddImports FirstOrDefault()?.Alias End Function -#If Not CODE_STYLE Then - Public Overrides Function PlaceImportsInsideNamespaces(optionSet As Options.OptionSet) As Boolean + Public Overrides Function PlaceImportsInsideNamespaces(optionSet As OptionSet) As Boolean ' Visual Basic doesn't support imports inside namespaces Return False End Function -#End If + Protected Overrides Function IsStaticUsing(usingOrAlias As ImportsStatementSyntax) As Boolean ' Visual Basic doesn't support static imports Return False From 82f75a5a487af48f4f784befcf4fac0ceb144920 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Sat, 2 Apr 2022 14:24:17 +0200 Subject: [PATCH 104/131] Revert bad changes --- .../CodeGeneration/ArgumentGenerator.cs | 0 .../CodeGeneration/AttributeGenerator.cs | 0 .../CSharpCodeGenerationHelpers.cs | 0 .../CSharpCodeGenerationOptions.cs | 0 .../CSharpCodeGenerationPreferences.cs | 7 +-- .../CSharpCodeGenerationService.cs | 7 +-- .../CSharpCodeGenerationServiceFactory.cs | 0 .../CSharpDeclarationComparer.cs | 0 .../CSharpFlagsEnumGenerator.cs | 0 .../CodeGeneration/CSharpSyntaxGenerator.cs | 0 .../CodeGeneration/ConstructorGenerator.cs | 0 .../CodeGeneration/ConversionGenerator.cs | 0 .../CodeGeneration/DestructorGenerator.cs | 0 .../CodeGeneration/EnumMemberGenerator.cs | 0 .../CodeGeneration/EventGenerator.cs | 0 .../CodeGeneration/ExpressionGenerator.cs | 0 .../CodeGeneration/FieldGenerator.cs | 0 .../CodeGeneration/MethodGenerator.cs | 0 .../CodeGeneration/NamedTypeGenerator.cs | 0 .../CodeGeneration/NamespaceGenerator.cs | 0 .../CodeGeneration/OperatorGenerator.cs | 0 .../CodeGeneration/ParameterGenerator.cs | 0 .../CodeGeneration/PropertyGenerator.cs | 0 .../CodeGeneration/StatementGenerator.cs | 0 .../CodeGeneration/TypeParameterGenerator.cs | 0 .../AbstractCodeGenerationService.cs | 32 ++++------- ...ctCodeGenerationService_FindDeclaration.cs | 2 +- .../AbstractFlagsEnumGenerator.cs | 0 .../CodeGeneration/CodeGenerationContext.cs | 2 +- .../CodeGenerationDestination.cs | 0 .../CodeGeneration/CodeGenerationHelpers.cs | 4 +- .../CodeGenerationOperatorKind.cs | 0 .../CodeGeneration/CodeGenerationOptions.cs | 0 .../CodeGenerationSymbolFactory.cs | 11 +--- .../Portable}/CodeGeneration/CodeGenerator.cs | 0 .../CodeGeneration/ICodeGenerationService.cs | 8 +-- .../INamedTypeSymbolExtensions.cs | 0 .../CodeGeneration/LiteralSpecialValues.cs | 0 .../NullableSyntaxAnnotation.cs | 0 .../CodeGenerationAbstractMethodSymbol.cs | 5 -- .../CodeGenerationAbstractNamedTypeSymbol.cs | 5 -- .../Symbols/CodeGenerationArrayTypeSymbol.cs | 0 .../Symbols/CodeGenerationAttributeData.cs | 0 .../CodeGenerationConstructedMethodSymbol.cs | 0 ...odeGenerationConstructedNamedTypeSymbol.cs | 0 .../Symbols/CodeGenerationConstructorInfo.cs | 0 .../CodeGenerationConstructorSymbol.cs | 5 -- .../Symbols/CodeGenerationConversionSymbol.cs | 5 -- .../Symbols/CodeGenerationDestructorInfo.cs | 0 .../Symbols/CodeGenerationDestructorSymbol.cs | 0 .../Symbols/CodeGenerationEventInfo.cs | 0 .../Symbols/CodeGenerationEventSymbol.cs | 5 -- .../Symbols/CodeGenerationFieldInfo.cs | 0 .../Symbols/CodeGenerationFieldSymbol.cs | 5 -- .../Symbols/CodeGenerationMethodInfo.cs | 0 .../Symbols/CodeGenerationMethodSymbol.cs | 5 -- .../Symbols/CodeGenerationNamedTypeSymbol.cs | 7 +-- .../Symbols/CodeGenerationNamespaceInfo.cs | 0 .../CodeGenerationNamespaceOrTypeSymbol.cs | 5 -- .../Symbols/CodeGenerationNamespaceSymbol.cs | 0 .../Symbols/CodeGenerationOperatorSymbol.cs | 7 +-- .../Symbols/CodeGenerationParameterSymbol.cs | 5 -- .../CodeGenerationPointerTypeSymbol.cs | 0 .../Symbols/CodeGenerationPropertyInfo.cs | 0 .../Symbols/CodeGenerationPropertySymbol.cs | 5 -- .../Symbols/CodeGenerationSymbol.cs | 27 +-------- .../CodeGenerationTypeParameterSymbol.cs | 0 .../Symbols/CodeGenerationTypeSymbol.cs | 5 -- .../SyntaxAnnotationExtensions.cs | 18 ++++++ .../Portable}/CodeGeneration/TypeGenerator.cs | 0 .../Portable/Editing}/ImportAdderService.cs | 0 .../Shared}/Extensions/ArrayExtensions.cs | 0 .../Shared/Extensions/IListExtensions.cs | 29 ++++++++++ .../Extensions/IMethodSymbolExtensions.cs | 21 +++++++ .../Shared/Extensions/ISymbolExtensions.cs | 11 ++++ .../Shared/Extensions}/ITypeGenerator.cs | 0 .../Shared/Extensions/SourceTextExtensions.cs | 18 ++++++ .../Core/Portable/WorkspacesResources.resx | 33 +++++++++++ .../Portable/xlf/WorkspacesResources.cs.xlf | 55 +++++++++++++++++++ .../Portable/xlf/WorkspacesResources.de.xlf | 55 +++++++++++++++++++ .../Portable/xlf/WorkspacesResources.es.xlf | 55 +++++++++++++++++++ .../Portable/xlf/WorkspacesResources.fr.xlf | 55 +++++++++++++++++++ .../Portable/xlf/WorkspacesResources.it.xlf | 55 +++++++++++++++++++ .../Portable/xlf/WorkspacesResources.ja.xlf | 55 +++++++++++++++++++ .../Portable/xlf/WorkspacesResources.ko.xlf | 55 +++++++++++++++++++ .../Portable/xlf/WorkspacesResources.pl.xlf | 55 +++++++++++++++++++ .../xlf/WorkspacesResources.pt-BR.xlf | 55 +++++++++++++++++++ .../Portable/xlf/WorkspacesResources.ru.xlf | 55 +++++++++++++++++++ .../Portable/xlf/WorkspacesResources.tr.xlf | 55 +++++++++++++++++++ .../xlf/WorkspacesResources.zh-Hans.xlf | 55 +++++++++++++++++++ .../xlf/WorkspacesResources.zh-Hant.xlf | 55 +++++++++++++++++++ .../Extensions/IMethodSymbolExtensions.cs | 23 -------- .../Core/Extensions/ISymbolExtensions.cs | 17 ------ .../Core/Extensions/ListExtensions.cs | 16 ------ ...ourceTextExtensions_SharedWithCodeStyle.cs | 19 ------- .../CSharpWorkspaceExtensions.projitems | 25 --------- .../CSharpAddImportsService.cs | 11 +--- .../CodeGenerationPreferences.cs | 10 +--- .../Core/Extensions/DocumentExtensions.cs | 6 -- .../AddImports/AbstractAddImportsService.cs | 10 +--- .../AddImports/IAddImportsService.cs | 23 ++------ ...AbstractGeneratedCodeRecognitionService.cs | 2 +- .../IGeneratedCodeRecognitionService.cs | 2 - .../Core/WorkspaceExtensions.projitems | 48 ---------------- .../Core/WorkspaceExtensionsResources.resx | 33 ----------- .../xlf/WorkspaceExtensionsResources.cs.xlf | 55 ------------------- .../xlf/WorkspaceExtensionsResources.de.xlf | 55 ------------------- .../xlf/WorkspaceExtensionsResources.es.xlf | 55 ------------------- .../xlf/WorkspaceExtensionsResources.fr.xlf | 55 ------------------- .../xlf/WorkspaceExtensionsResources.it.xlf | 55 ------------------- .../xlf/WorkspaceExtensionsResources.ja.xlf | 55 ------------------- .../xlf/WorkspaceExtensionsResources.ko.xlf | 55 ------------------- .../xlf/WorkspaceExtensionsResources.pl.xlf | 55 ------------------- .../WorkspaceExtensionsResources.pt-BR.xlf | 55 ------------------- .../xlf/WorkspaceExtensionsResources.ru.xlf | 55 ------------------- .../xlf/WorkspaceExtensionsResources.tr.xlf | 55 ------------------- .../WorkspaceExtensionsResources.zh-Hans.xlf | 55 ------------------- .../WorkspaceExtensionsResources.zh-Hant.xlf | 55 ------------------- .../VisualBasicAddImportsService.vb | 11 +--- 119 files changed, 886 insertions(+), 1099 deletions(-) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/ArgumentGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/AttributeGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/CSharpCodeGenerationHelpers.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/CSharpCodeGenerationOptions.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/CSharpCodeGenerationPreferences.cs (95%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/CSharpCodeGenerationService.cs (99%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/CSharpCodeGenerationServiceFactory.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/CSharpDeclarationComparer.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/CSharpFlagsEnumGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/CSharpSyntaxGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/ConstructorGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/ConversionGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/DestructorGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/EnumMemberGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/EventGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/ExpressionGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/FieldGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/MethodGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/NamedTypeGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/NamespaceGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/OperatorGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/ParameterGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/PropertyGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/StatementGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/CSharp => CSharp/Portable}/CodeGeneration/TypeParameterGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/AbstractCodeGenerationService.cs (95%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs (99%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/AbstractFlagsEnumGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/CodeGenerationContext.cs (99%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/CodeGenerationDestination.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/CodeGenerationHelpers.cs (99%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/CodeGenerationOperatorKind.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/CodeGenerationOptions.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/CodeGenerationSymbolFactory.cs (99%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/CodeGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/ICodeGenerationService.cs (98%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/INamedTypeSymbolExtensions.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/LiteralSpecialValues.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/NullableSyntaxAnnotation.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs (98%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs (98%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationArrayTypeSymbol.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationAttributeData.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationConstructedMethodSymbol.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationConstructedNamedTypeSymbol.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationConstructorInfo.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs (96%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs (95%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationDestructorInfo.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationDestructorSymbol.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationEventInfo.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs (97%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationFieldInfo.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs (97%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationMethodInfo.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs (98%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs (98%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationNamespaceInfo.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs (95%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationNamespaceSymbol.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs (98%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs (97%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationPointerTypeSymbol.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationPropertyInfo.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs (97%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationSymbol.cs (88%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationTypeParameterSymbol.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs (98%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/SyntaxAnnotationExtensions.cs (52%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable}/CodeGeneration/TypeGenerator.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/ImportAdder => Core/Portable/Editing}/ImportAdderService.cs (100%) rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core => Core/Portable/Shared}/Extensions/ArrayExtensions.cs (100%) create mode 100644 src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs rename src/Workspaces/{SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration => Core/Portable/Shared/Extensions}/ITypeGenerator.cs (100%) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ArgumentGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/ArgumentGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ArgumentGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/ArgumentGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/AttributeGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/AttributeGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/AttributeGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/AttributeGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationHelpers.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationHelpers.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationHelpers.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationHelpers.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationOptions.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationOptions.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationOptions.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationOptions.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationPreferences.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationPreferences.cs similarity index 95% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationPreferences.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationPreferences.cs index a3bf3a4467dd6..b82d4859e943d 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationPreferences.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationPreferences.cs @@ -8,14 +8,9 @@ using Microsoft.CodeAnalysis.CodeGeneration; using Microsoft.CodeAnalysis.CodeStyle; using Microsoft.CodeAnalysis.CSharp.CodeStyle; +using Microsoft.CodeAnalysis.Options; using Roslyn.Utilities; -#if CODE_STYLE -using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; -#else -using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; -#endif - namespace Microsoft.CodeAnalysis.CSharp.CodeGeneration { internal sealed class CSharpCodeGenerationPreferences : CodeGenerationPreferences diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationService.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationService.cs similarity index 99% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationService.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationService.cs index 2e88507378078..71ca665e7f620 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationService.cs +++ b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationService.cs @@ -15,16 +15,11 @@ using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.LanguageServices; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; -#if CODE_STYLE -using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; -#else -using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; -#endif - namespace Microsoft.CodeAnalysis.CSharp.CodeGeneration { internal partial class CSharpCodeGenerationService : AbstractCodeGenerationService diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationServiceFactory.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationServiceFactory.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpCodeGenerationServiceFactory.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/CSharpCodeGenerationServiceFactory.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpDeclarationComparer.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpDeclarationComparer.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpDeclarationComparer.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/CSharpDeclarationComparer.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpFlagsEnumGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpFlagsEnumGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpFlagsEnumGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/CSharpFlagsEnumGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpSyntaxGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/CSharpSyntaxGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/CSharpSyntaxGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ConstructorGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/ConstructorGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ConstructorGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/ConstructorGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ConversionGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/ConversionGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ConversionGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/ConversionGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/DestructorGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/DestructorGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/DestructorGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/DestructorGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/EnumMemberGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/EnumMemberGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/EnumMemberGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/EnumMemberGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/EventGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/EventGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/EventGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/EventGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ExpressionGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/ExpressionGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ExpressionGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/ExpressionGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/FieldGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/FieldGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/FieldGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/FieldGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/MethodGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/MethodGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/MethodGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamedTypeGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/NamedTypeGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamedTypeGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/NamedTypeGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamespaceGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/NamespaceGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/NamespaceGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/NamespaceGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/OperatorGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/OperatorGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/OperatorGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/OperatorGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ParameterGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/ParameterGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/ParameterGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/ParameterGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/PropertyGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/PropertyGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/PropertyGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/PropertyGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/StatementGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/StatementGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/StatementGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/StatementGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/TypeParameterGenerator.cs b/src/Workspaces/CSharp/Portable/CodeGeneration/TypeParameterGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CodeGeneration/TypeParameterGenerator.cs rename to src/Workspaces/CSharp/Portable/CodeGeneration/TypeParameterGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService.cs b/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService.cs similarity index 95% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService.cs rename to src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService.cs index 180cac4cc6543..ef33ce30a9c2d 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService.cs @@ -12,18 +12,12 @@ using Microsoft.CodeAnalysis.AddImport; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.LanguageServices; +using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Simplification; using Roslyn.Utilities; -#if CODE_STYLE -using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; -#else -using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; -#endif - - namespace Microsoft.CodeAnalysis.CodeGeneration { internal abstract partial class AbstractCodeGenerationService : ICodeGenerationService @@ -160,7 +154,7 @@ protected static void CheckDeclarationNode(SyntaxNode destinat if (destination is not TDeclarationNode) { throw new ArgumentException( - string.Format(WorkspaceExtensionsResources.Destination_type_must_be_a_0_but_given_one_is_1, typeof(TDeclarationNode).Name, destination.GetType().Name), + string.Format(WorkspacesResources.Destination_type_must_be_a_0_but_given_one_is_1, typeof(TDeclarationNode).Name, destination.GetType().Name), nameof(destination)); } } @@ -178,7 +172,7 @@ protected static void CheckDeclarationNode not TDeclarationNode2) { throw new ArgumentException( - string.Format(WorkspaceExtensionsResources.Destination_type_must_be_a_0_or_a_1_but_given_one_is_2, + string.Format(WorkspacesResources.Destination_type_must_be_a_0_or_a_1_but_given_one_is_2, typeof(TDeclarationNode1).Name, typeof(TDeclarationNode2).Name, destination.GetType().Name), nameof(destination)); } @@ -199,7 +193,7 @@ not TDeclarationNode2 and not TDeclarationNode3) { throw new ArgumentException( - string.Format(WorkspaceExtensionsResources.Destination_type_must_be_a_0_1_or_2_but_given_one_is_3, + string.Format(WorkspacesResources.Destination_type_must_be_a_0_1_or_2_but_given_one_is_3, typeof(TDeclarationNode1).Name, typeof(TDeclarationNode2).Name, typeof(TDeclarationNode3).Name, destination.GetType().Name), nameof(destination)); } @@ -217,7 +211,7 @@ not TDeclarationNode3 and not TDeclarationNode4) { throw new ArgumentException( - string.Format(WorkspaceExtensionsResources.Destination_type_must_be_a_0_1_2_or_3_but_given_one_is_4, + string.Format(WorkspacesResources.Destination_type_must_be_a_0_1_2_or_3_but_given_one_is_4, typeof(TDeclarationNode1).Name, typeof(TDeclarationNode2).Name, typeof(TDeclarationNode3).Name, typeof(TDeclarationNode4).Name, destination.GetType().Name), nameof(destination)); } @@ -235,7 +229,7 @@ private async Task GetEditAsync( if (destinationDeclaration == null) { - throw new ArgumentException(WorkspaceExtensionsResources.Could_not_find_location_to_generation_symbol_into); + throw new ArgumentException(WorkspacesResources.Could_not_find_location_to_generation_symbol_into); } var destinationTree = destinationDeclaration.SyntaxTree; @@ -251,13 +245,7 @@ private async Task GetEditAsync( if (context.AddImports) { var addImportsOptions = await AddImportPlacementOptions.FromDocumentAsync(newDocument, cancellationToken).ConfigureAwait(false); - var importAdder = newDocument.GetRequiredLanguageService(); - newDocument = await importAdder.AddImportsAsync( - newDocument, - SpecializedCollections.SingletonEnumerable(currentRoot.FullSpan), - ImportAdderService.Strategy.AddImportsFromSymbolAnnotations, - addImportsOptions, - cancellationToken).ConfigureAwait(false); + newDocument = await ImportAdder.AddImportsFromSymbolAnnotationAsync(newDocument, addImportsOptions, cancellationToken).ConfigureAwait(false); } return newDocument; @@ -482,17 +470,17 @@ protected static void CheckLocation(SyntaxNode destinationMember, [NotNull] Loca { if (location == null) { - throw new ArgumentException(WorkspaceExtensionsResources.No_location_provided_to_add_statements_to); + throw new ArgumentException(WorkspacesResources.No_location_provided_to_add_statements_to); } if (!location.IsInSource) { - throw new ArgumentException(WorkspaceExtensionsResources.Destination_location_was_not_in_source); + throw new ArgumentException(WorkspacesResources.Destination_location_was_not_in_source); } if (location.SourceTree != destinationMember.SyntaxTree) { - throw new ArgumentException(WorkspaceExtensionsResources.Destination_location_was_from_a_different_tree); + throw new ArgumentException(WorkspacesResources.Destination_location_was_from_a_different_tree); } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs b/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs similarity index 99% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs rename to src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs index 8325c7ef813b1..b3c34ae5a3963 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/AbstractCodeGenerationService_FindDeclaration.cs @@ -80,7 +80,7 @@ private bool CanAddTo(SyntaxNode? destination, Solution solution, CancellationTo // If we are avoiding generating into files marked as generated (but are still regular files) // then check accordingly. This is distinct from the prior check in that we as a fallback // will generate into these files is we have no alternative. - if (checkGeneratedCode && document.IsGeneratedCode(syntaxTree, cancellationToken)) + if (checkGeneratedCode && document.IsGeneratedCode(cancellationToken)) { return false; } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractFlagsEnumGenerator.cs b/src/Workspaces/Core/Portable/CodeGeneration/AbstractFlagsEnumGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/AbstractFlagsEnumGenerator.cs rename to src/Workspaces/Core/Portable/CodeGeneration/AbstractFlagsEnumGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationContext.cs b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationContext.cs similarity index 99% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationContext.cs rename to src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationContext.cs index 3162ef6cff9da..f1be39d46f4c0 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationContext.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationContext.cs @@ -167,7 +167,7 @@ private static void CheckLocation(Location? location, string name) { if (location != null && !location.IsInSource) { - throw new ArgumentException(WorkspaceExtensionsResources.Location_must_be_null_or_from_source, name); + throw new ArgumentException(WorkspacesResources.Location_must_be_null_or_from_source, name); } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationDestination.cs b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationDestination.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationDestination.cs rename to src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationDestination.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationHelpers.cs b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs similarity index 99% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationHelpers.cs rename to src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs index 3877b049c3e78..5194dbd5f5e1e 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationHelpers.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationHelpers.cs @@ -119,7 +119,7 @@ public static bool TryGetDocumentationComment( ISymbol symbol, string commentToken, [NotNullWhen(true)] out string? comment, CancellationToken cancellationToken = default) { var xml = symbol.GetDocumentationCommentXml(cancellationToken: cancellationToken); - if (RoslynString.IsNullOrEmpty(xml)) + if (string.IsNullOrEmpty(xml)) { comment = null; return false; @@ -167,7 +167,7 @@ public static IEnumerable GetMembers(INamedTypeSymbol namedType) } return f1.HasConstantValue - ? Comparer.Default.Compare(f1.ConstantValue, f2.ConstantValue!) + ? Comparer.Default.Compare(f1.ConstantValue, f2.ConstantValue) : f1.Name.CompareTo(f2.Name); }).ToList(); } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationOperatorKind.cs b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationOperatorKind.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationOperatorKind.cs rename to src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationOperatorKind.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationOptions.cs b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationOptions.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationOptions.cs rename to src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationOptions.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationSymbolFactory.cs b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationSymbolFactory.cs similarity index 99% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationSymbolFactory.cs rename to src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationSymbolFactory.cs index cfa882aede743..2ef60b41f806d 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationSymbolFactory.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerationSymbolFactory.cs @@ -6,13 +6,8 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; -using Microsoft.CodeAnalysis.Shared.Extensions; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif +using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CodeGeneration { @@ -207,8 +202,8 @@ public static IMethodSymbol CreateOperatorSymbol( if (parameters.Length != expectedParameterCount) { var message = expectedParameterCount == 1 ? - WorkspaceExtensionsResources.Invalid_number_of_parameters_for_unary_operator : - WorkspaceExtensionsResources.Invalid_number_of_parameters_for_binary_operator; + WorkspacesResources.Invalid_number_of_parameters_for_unary_operator : + WorkspacesResources.Invalid_number_of_parameters_for_binary_operator; throw new ArgumentException(message, nameof(parameters)); } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerator.cs b/src/Workspaces/Core/Portable/CodeGeneration/CodeGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerator.cs rename to src/Workspaces/Core/Portable/CodeGeneration/CodeGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/ICodeGenerationService.cs b/src/Workspaces/Core/Portable/CodeGeneration/ICodeGenerationService.cs similarity index 98% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/ICodeGenerationService.cs rename to src/Workspaces/Core/Portable/CodeGeneration/ICodeGenerationService.cs index b83d17069bbdf..84b85e9e18d6d 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/ICodeGenerationService.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/ICodeGenerationService.cs @@ -6,13 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Host; - -#if CODE_STYLE -using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; -#else -using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; -#endif - +using Microsoft.CodeAnalysis.Options; namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/INamedTypeSymbolExtensions.cs b/src/Workspaces/Core/Portable/CodeGeneration/INamedTypeSymbolExtensions.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/INamedTypeSymbolExtensions.cs rename to src/Workspaces/Core/Portable/CodeGeneration/INamedTypeSymbolExtensions.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/LiteralSpecialValues.cs b/src/Workspaces/Core/Portable/CodeGeneration/LiteralSpecialValues.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/LiteralSpecialValues.cs rename to src/Workspaces/Core/Portable/CodeGeneration/LiteralSpecialValues.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/NullableSyntaxAnnotation.cs b/src/Workspaces/Core/Portable/CodeGeneration/NullableSyntaxAnnotation.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/NullableSyntaxAnnotation.cs rename to src/Workspaces/Core/Portable/CodeGeneration/NullableSyntaxAnnotation.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs similarity index 98% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs index d22dda6e7dceb..c040bccc0cdd0 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractMethodSymbol.cs @@ -6,12 +6,7 @@ using System.Collections.Immutable; using System.Reflection.Metadata; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs similarity index 98% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs index 4599685e658f9..afb4c096ccf9d 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAbstractNamedTypeSymbol.cs @@ -7,12 +7,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationArrayTypeSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationArrayTypeSymbol.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationArrayTypeSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationArrayTypeSymbol.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAttributeData.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAttributeData.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationAttributeData.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationAttributeData.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructedMethodSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructedMethodSymbol.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructedMethodSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructedMethodSymbol.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructedNamedTypeSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructedNamedTypeSymbol.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructedNamedTypeSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructedNamedTypeSymbol.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructorInfo.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructorInfo.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructorInfo.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructorInfo.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs similarity index 96% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs index be6376ceae81d..c1aa5ebb8ea00 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConstructorSymbol.cs @@ -5,12 +5,7 @@ #nullable disable using System.Collections.Immutable; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs similarity index 95% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs index b41e77f7259c1..e8d7d0eecc34e 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationConversionSymbol.cs @@ -5,12 +5,7 @@ #nullable disable using System.Collections.Immutable; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationDestructorInfo.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationDestructorInfo.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationDestructorInfo.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationDestructorInfo.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationDestructorSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationDestructorSymbol.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationDestructorSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationDestructorSymbol.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationEventInfo.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationEventInfo.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationEventInfo.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationEventInfo.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs similarity index 97% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs index efed6d2d9edc4..7b7949f8b12d3 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationEventSymbol.cs @@ -3,12 +3,7 @@ // See the LICENSE file in the project root for more information. using System.Collections.Immutable; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationFieldInfo.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationFieldInfo.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationFieldInfo.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationFieldInfo.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs similarity index 97% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs index e5b1f1d092ba8..ceb695c493def 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationFieldSymbol.cs @@ -5,12 +5,7 @@ #nullable disable using System.Collections.Immutable; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationMethodInfo.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodInfo.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationMethodInfo.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodInfo.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs similarity index 98% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs index c66f84eb97c5e..f17a9dabd284c 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationMethodSymbol.cs @@ -7,12 +7,7 @@ using System; using System.Collections.Immutable; using System.Diagnostics; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs similarity index 98% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs index 544470cbb8caa..9176276d0b62e 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamedTypeSymbol.cs @@ -8,13 +8,8 @@ using System.Collections.Immutable; using System.Linq; using Microsoft.CodeAnalysis; -using Roslyn.Utilities; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceInfo.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceInfo.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceInfo.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceInfo.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs similarity index 95% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs index 4cf190debb603..f8d25434497b1 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceOrTypeSymbol.cs @@ -5,12 +5,7 @@ #nullable disable using System.Collections.Immutable; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceSymbol.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationNamespaceSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationNamespaceSymbol.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs similarity index 98% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs index c5968021388e8..2e99829026b52 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationOperatorSymbol.cs @@ -5,13 +5,8 @@ #nullable disable using System.Collections.Immutable; -using Roslyn.Utilities; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs similarity index 97% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs index 87e5dabf4dd0b..5c24c75230aaa 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationParameterSymbol.cs @@ -5,12 +5,7 @@ #nullable disable using System.Collections.Immutable; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPointerTypeSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPointerTypeSymbol.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPointerTypeSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPointerTypeSymbol.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertyInfo.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPropertyInfo.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertyInfo.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPropertyInfo.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs similarity index 97% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs index bef1da886c368..7909d1f0a6ca4 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationPropertySymbol.cs @@ -5,12 +5,7 @@ #nullable disable using System.Collections.Immutable; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationSymbol.cs similarity index 88% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationSymbol.cs index bb8a7b16c9245..d120665f77ef4 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationSymbol.cs @@ -9,13 +9,8 @@ using System.Globalization; using System.Runtime.CompilerServices; using System.Threading; -using Microsoft.CodeAnalysis.Shared.Extensions; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif +using Microsoft.CodeAnalysis.Shared.Extensions; namespace Microsoft.CodeAnalysis.CodeGeneration { @@ -69,30 +64,12 @@ private static CodeGenerationSymbol AddAnnotationsTo( { annotationsTable.TryGetValue(originalDefinition, out var originalAnnotations); - annotations = CombineAnnotations(originalAnnotations, annotations); + annotations = SyntaxAnnotationExtensions.CombineAnnotations(originalAnnotations, annotations); annotationsTable.Add(newDefinition, annotations); return newDefinition; } - private static SyntaxAnnotation[] CombineAnnotations( - SyntaxAnnotation[] originalAnnotations, - SyntaxAnnotation[] newAnnotations) - { - if (!originalAnnotations.IsNullOrEmpty()) - { - // Make a new array (that includes the new annotations) and copy the original - // annotations into it. - var finalAnnotations = newAnnotations; - Array.Resize(ref finalAnnotations, originalAnnotations.Length + newAnnotations.Length); - Array.Copy(originalAnnotations, 0, finalAnnotations, newAnnotations.Length, originalAnnotations.Length); - - return finalAnnotations; - } - - return newAnnotations; - } - public abstract SymbolKind Kind { get; } public string Language => "Code Generation Agnostic Language"; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationTypeParameterSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationTypeParameterSymbol.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationTypeParameterSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationTypeParameterSymbol.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs similarity index 98% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs rename to src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs index 93a364de72e54..efaa88336e672 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/Symbols/CodeGenerationTypeSymbol.cs @@ -5,12 +5,7 @@ #nullable disable using System.Collections.Immutable; - -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else using Microsoft.CodeAnalysis.Editing; -#endif namespace Microsoft.CodeAnalysis.CodeGeneration { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/SyntaxAnnotationExtensions.cs b/src/Workspaces/Core/Portable/CodeGeneration/SyntaxAnnotationExtensions.cs similarity index 52% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/SyntaxAnnotationExtensions.cs rename to src/Workspaces/Core/Portable/CodeGeneration/SyntaxAnnotationExtensions.cs index 018cc2f3bebc3..52f0d7a276b5c 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/SyntaxAnnotationExtensions.cs +++ b/src/Workspaces/Core/Portable/CodeGeneration/SyntaxAnnotationExtensions.cs @@ -19,5 +19,23 @@ public static TSymbol AddAnnotationToSymbol( var codeGenSymbol = (CodeGenerationSymbol)(object)symbol; return (TSymbol)(object)codeGenSymbol.WithAdditionalAnnotations(annotation); } + + internal static SyntaxAnnotation[] CombineAnnotations( + SyntaxAnnotation[] originalAnnotations, + SyntaxAnnotation[] newAnnotations) + { + if (!originalAnnotations.IsNullOrEmpty()) + { + // Make a new array (that includes the new annotations) and copy the original + // annotations into it. + var finalAnnotations = newAnnotations; + Array.Resize(ref finalAnnotations, originalAnnotations.Length + newAnnotations.Length); + Array.Copy(originalAnnotations, 0, finalAnnotations, newAnnotations.Length, originalAnnotations.Length); + + return finalAnnotations; + } + + return newAnnotations; + } } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/TypeGenerator.cs b/src/Workspaces/Core/Portable/CodeGeneration/TypeGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/TypeGenerator.cs rename to src/Workspaces/Core/Portable/CodeGeneration/TypeGenerator.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/ImportAdder/ImportAdderService.cs b/src/Workspaces/Core/Portable/Editing/ImportAdderService.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/ImportAdder/ImportAdderService.cs rename to src/Workspaces/Core/Portable/Editing/ImportAdderService.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/ArrayExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/ArrayExtensions.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/ArrayExtensions.cs rename to src/Workspaces/Core/Portable/Shared/Extensions/ArrayExtensions.cs diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs new file mode 100644 index 0000000000000..e69f2ba59a96f --- /dev/null +++ b/src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs @@ -0,0 +1,29 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Collections.Generic; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.Shared.Extensions +{ + internal static class IListExtensions + { + public static int IndexOf(this IList list, Func predicate) + { + Contract.ThrowIfNull(list); + Contract.ThrowIfNull(predicate); + + for (var i = 0; i < list.Count; i++) + { + if (predicate(list[i])) + { + return i; + } + } + + return -1; + } + } +} diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs index dfd06aa29ec10..816b43f8e4ad7 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs @@ -55,6 +55,27 @@ public static bool CompatibleSignatureToDelegate(this IMethodSymbol method, INam return true; } + /// + /// Returns the methodSymbol and any partial parts. + /// + public static ImmutableArray GetAllMethodSymbolsOfPartialParts(this IMethodSymbol method) + { + if (method.PartialDefinitionPart != null) + { + Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); + return ImmutableArray.Create(method, method.PartialDefinitionPart); + } + else if (method.PartialImplementationPart != null) + { + Debug.Assert(!Equals(method.PartialImplementationPart, method)); + return ImmutableArray.Create(method.PartialImplementationPart, method); + } + else + { + return ImmutableArray.Create(method); + } + } + public static IMethodSymbol RenameTypeParameters(this IMethodSymbol method, ImmutableArray newNames) { if (method.TypeParameters.Select(t => t.Name).SequenceEqual(newNames)) diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs index abf45b793acf9..5071112465fb2 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/ISymbolExtensions.cs @@ -25,6 +25,17 @@ namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class ISymbolExtensions { + public static DeclarationModifiers GetSymbolModifiers(this ISymbol symbol) + { + return new DeclarationModifiers( + isStatic: symbol.IsStatic, + isAbstract: symbol.IsAbstract, + isUnsafe: symbol.RequiresUnsafeModifier(), + isVirtual: symbol.IsVirtual, + isOverride: symbol.IsOverride, + isSealed: symbol.IsSealed); + } + /// /// Checks a given symbol for browsability based on its declaration location, attributes /// explicitly limiting browsability, and whether showing of advanced members is enabled. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/ITypeGenerator.cs b/src/Workspaces/Core/Portable/Shared/Extensions/ITypeGenerator.cs similarity index 100% rename from src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/ITypeGenerator.cs rename to src/Workspaces/Core/Portable/Shared/Extensions/ITypeGenerator.cs diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs index 84e5de00012ef..1ceb1db50bb73 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs @@ -16,6 +16,24 @@ namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class SourceTextExtensions { + /// + /// Returns the leading whitespace of the line located at the specified position in the given snapshot. + /// + public static string GetLeadingWhitespaceOfLineAtPosition(this SourceText text, int position) + { + Contract.ThrowIfNull(text); + + var line = text.Lines.GetLineFromPosition(position); + var linePosition = line.GetFirstNonWhitespacePosition(); + if (!linePosition.HasValue) + { + return line.ToString(); + } + + var lineText = line.ToString(); + return lineText.Substring(0, linePosition.Value - line.Start); + } + public static void GetLineAndOffset(this SourceText text, int position, out int lineNumber, out int offset) { var line = text.Lines.GetLineFromPosition(position); diff --git a/src/Workspaces/Core/Portable/WorkspacesResources.resx b/src/Workspaces/Core/Portable/WorkspacesResources.resx index 15180f35cddfa..06deb5218f886 100644 --- a/src/Workspaces/Core/Portable/WorkspacesResources.resx +++ b/src/Workspaces/Core/Portable/WorkspacesResources.resx @@ -129,9 +129,36 @@ Cycle detected in extensions + + Destination type must be a {0}, but given one is {1}. + + + Destination type must be a {0} or a {1}, but given one is {2}. + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + + + Could not find location to generation symbol into. + + + No location provided to add statements to. + + + Destination location was not in source. + + + Destination location was from a different tree. + Node is of the wrong type. + + Location must be null or from source. + Duplicate source file '{0}' in project '{1}' @@ -282,6 +309,12 @@ Cannot generate code for unsupported operator '{0}' + + Invalid number of parameters for binary operator. + + + Invalid number of parameters for unary operator. + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf index 976b6bf7c4770..778c4b26985b7 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.cs.xlf @@ -52,6 +52,11 @@ DateTimeKind musí být Utc + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Cílový typ musí být {0}, {1}, {2} nebo {3}, ale zadaný typ je {4}. + + Document does not support syntax trees Dokument nepodporuje stromy syntaxe. @@ -132,11 +137,51 @@ V rozšířeních se zjistil cyklus. + + Destination type must be a {0}, but given one is {1}. + Cílový typ musí být {0}, ale zadaný typ je {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Cílový typ musí být {0} nebo {1}, ale zadaný typ je {2}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Cílový typ musí být {0}, {1} nebo {2}, ale zadaný typ je {3}. + + + + Could not find location to generation symbol into. + Nenašlo se umístění, do kterého by se vygeneroval symbol. + + + + No location provided to add statements to. + Není zadané žádné umístění, kam by se daly přidávat příkazy. + + + + Destination location was not in source. + Cílové umístění není ve zdroji. + + + + Destination location was from a different tree. + Cílové umístění pochází z jiného stromu. + + Node is of the wrong type. Uzel je chybného typu. + + Location must be null or from source. + Umístění musí být null nebo ze zdroje. + + Duplicate source file '{0}' in project '{1}' Duplicitní zdrojový soubor {0} v projektu {1} @@ -407,6 +452,16 @@ Nejde generovat kód pro nepodporovaný operátor {0}. + + Invalid number of parameters for binary operator. + Neplatný počet parametrů pro binární operátor + + + + Invalid number of parameters for unary operator. + Neplatný počet parametrů pro unární operátor + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Nejde otevřít projekt {0}, protože přípona souboru {1} není přidružená k jazyku. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf index a4f8bf615ef1a..3b33ebc674923 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.de.xlf @@ -52,6 +52,11 @@ "DateTimeKind" muss UTC sein. + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Der Zieltyp muss "{0}", "{1}", "{2}" oder "{3}" lauten. Es wurde jedoch "{4}" angegeben. + + Document does not support syntax trees Das Dokument unterstützt keine Syntaxstrukturen. @@ -132,11 +137,51 @@ Zyklus in Erweiterungen entdeckt + + Destination type must be a {0}, but given one is {1}. + Zieltyp muss {0} sein. Es wurde jedoch {1} angegeben. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Zieltyp muss {0} oder {1} sein. Es wurde jedoch {2} angegeben. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Zieltyp muss {0}, {1} oder {2} sein. Es wurde jedoch {3} angegeben. + + + + Could not find location to generation symbol into. + Konnte keinen Ort finden, in den das Symbol generiert werden kann. + + + + No location provided to add statements to. + Kein Ort angegeben, zu dem Anweisungen hinzugefügt werden. + + + + Destination location was not in source. + Zielort war nicht in Quelle. + + + + Destination location was from a different tree. + Zielort stammt aus anderem Baum. + + Node is of the wrong type. Knoten hat den falschen Typ. + + Location must be null or from source. + Ort muss null oder von Quelle sein. + + Duplicate source file '{0}' in project '{1}' Doppelte Quelldatei "{0}" in Projekt "{1}" @@ -407,6 +452,16 @@ Kann keinen Code für nicht unterstützten Operator "{0}" generieren + + Invalid number of parameters for binary operator. + Ungültige Parameteranzahl für binären Operator. + + + + Invalid number of parameters for unary operator. + Ungültige Parameteranzahl für unären Operator. + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Projekt "{0}" kann nicht geöffnet werden, da die Dateierweiterung "{1}" keiner Sprache zugeordnet ist. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf index c476ae51972df..28f0516522f55 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.es.xlf @@ -52,6 +52,11 @@ DateTimeKind debe ser Utc + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + El tipo de destino debe ser una instancia de {0}, {1}, {2} o {3}, pero el proporcionado es {4}. + + Document does not support syntax trees El documento no admite árboles de sintaxis @@ -132,11 +137,51 @@ Detectado ciclo en extensiones + + Destination type must be a {0}, but given one is {1}. + El tipo de destino debe ser un {0}, pero el proporcionado es {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + El tipo de destino debe ser un {0} o un {1}, pero el proporcionado es {2}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + El tipo de destino debe ser un {0}, {1} o {2}, pero el proporcionado es {3}. + + + + Could not find location to generation symbol into. + No se pudo encontrar una ubicación en la que generar un símbolo. + + + + No location provided to add statements to. + No se ha proporcionado ubicación a la que agregar instrucciones. + + + + Destination location was not in source. + La ubicación de destino no estaba en el código fuente. + + + + Destination location was from a different tree. + La ubicación de destino era de otro árbol. + + Node is of the wrong type. El nodo es del tipo erróneo. + + Location must be null or from source. + La ubicación debe ser null o del código fuente. + + Duplicate source file '{0}' in project '{1}' Archivo de código fuente '{0}' duplicado en el proyecto '{1}' @@ -407,6 +452,16 @@ No se puede generar código para el operador no compatible '{0}' + + Invalid number of parameters for binary operator. + Número de parámetros no válido para el operador binario. + + + + Invalid number of parameters for unary operator. + Número de parámetros no válido para el operador unario. + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. No se puede abrir el proyecto '{0}' porque la extensión de archivo '{1}' no está asociada a un lenguaje. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf index 198c24f7a56c4..b28c49f5e07d0 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.fr.xlf @@ -52,6 +52,11 @@ DateTimeKind doit être UTC + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Le type de destination doit être {0}, {1}, {2} ou {3}, mais le type spécifié est {4}. + + Document does not support syntax trees Le document ne prend pas en charge les arborescences de syntaxe @@ -132,11 +137,51 @@ Cycle détecté dans les extensions + + Destination type must be a {0}, but given one is {1}. + Le type de destination doit être un {0}, mais le type donné est {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Le type de destination doit être un {0} ou un {1}, mais le type donné est {2}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Le type de destination doit être un {0}, {1} ou {2}, mais le type donné est {3}. + + + + Could not find location to generation symbol into. + L'emplacement dans lequel générer le symbole est introuvable. + + + + No location provided to add statements to. + Aucun emplacement n'a été fourni pour l'ajout d'instructions. + + + + Destination location was not in source. + L'emplacement de destination n'était pas dans la source. + + + + Destination location was from a different tree. + L'emplacement de destination provient d'une arborescence différente. + + Node is of the wrong type. Le type de nœud est incorrect. + + Location must be null or from source. + L'emplacement doit être null ou dans la source. + + Duplicate source file '{0}' in project '{1}' Dupliquer le fichier source '{0}' dans le projet '{1}' @@ -407,6 +452,16 @@ Impossible de générer du code pour l'opérateur non pris en charge '{0}' + + Invalid number of parameters for binary operator. + Nombre de paramètres non valide pour l'opérateur binaire. + + + + Invalid number of parameters for unary operator. + Nombre de paramètres non valide pour l'opérateur unaire. + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Impossible d'ouvrir le projet '{0}', car l'extension de fichier '{1}' n'est pas associée à un langage. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf index 6c08647a92158..833722dc62843 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.it.xlf @@ -52,6 +52,11 @@ Il valore di DateTimeKind deve essere Utc + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Il tipo di destinazione deve essere {0}, {1}, {2} o {3}, ma quello specificato è {4}. + + Document does not support syntax trees Il documento non supporta alberi di sintassi @@ -132,11 +137,51 @@ È stato rilevato un ciclo nelle estensioni + + Destination type must be a {0}, but given one is {1}. + Il tipo di destinazione deve essere {0}, ma quello specificato è {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Il tipo di destinazione deve essere {0} o {1}, ma quello specificato è {2}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Il tipo di destinazione deve essere {0}, {1} o {2}, ma quello specificato è {3}. + + + + Could not find location to generation symbol into. + Non è stata trovata la posizione in cui generare il simbolo. + + + + No location provided to add statements to. + Non sono state specificate posizioni in cui aggiungere istruzioni. + + + + Destination location was not in source. + La posizione di destinazione non è inclusa nell'origine. + + + + Destination location was from a different tree. + La posizione di destinazione è in un albero diverso. + + Node is of the wrong type. Il tipo del nodo è errato. + + Location must be null or from source. + La posizione deve essere Null o derivare dall'origine. + + Duplicate source file '{0}' in project '{1}' File di origine '{0}' duplicato nel progetto '{1}' @@ -407,6 +452,16 @@ Non è possibile generare il codice per l'operatore '{0}' non supportato + + Invalid number of parameters for binary operator. + Il numero di parametri per l'operatore binario non è valido. + + + + Invalid number of parameters for unary operator. + Il numero di parametri per l'operatore unario non è valido. + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Non è possibile aprire il progetto '{0}' perché l'estensione di file '{1}' non è associata a un linguaggio. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf index 1d5921e0ca513..055f08def46cc 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ja.xlf @@ -52,6 +52,11 @@ DateTimeKind は Utc にする必要があります + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + ターゲットの型は {0}、{1}、{2}、または {3} である必要がありますが、{4} が指定されています。 + + Document does not support syntax trees ドキュメントでは構文ツリーがサポートされません @@ -132,11 +137,51 @@ 拡張機能で循環が検出されました + + Destination type must be a {0}, but given one is {1}. + ターゲットの型は {0} である必要がありますが、{1} が指定されています。 + + + + Destination type must be a {0} or a {1}, but given one is {2}. + ターゲットの型は {0} または {1} である必要がありますが、{2} が指定されています。 + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + ターゲットの型は {0}、{1}、または {2} である必要がありますが、{3} が指定されています。 + + + + Could not find location to generation symbol into. + シンボルの生成先が見つかりませんでした。 + + + + No location provided to add statements to. + ステートメントを追加する場所がありません。 + + + + Destination location was not in source. + 追加先の場所は、ソース内ではありません。 + + + + Destination location was from a different tree. + ターゲットの場所は、別のツリーでした。 + + Node is of the wrong type. ノードの種類が正しくありません。 + + Location must be null or from source. + 場所は Null であるか、ソースからでなければなりません。 + + Duplicate source file '{0}' in project '{1}' プロジェクト '{1}' でソース ファイル '{0}' が重複しています @@ -407,6 +452,16 @@ サポートされない演算子 '{0}' のコードは生成できません + + Invalid number of parameters for binary operator. + 二項演算子のパラメーターの数が無効です。 + + + + Invalid number of parameters for unary operator. + 単項演算子のパラメーターの数が無効です。 + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. ファイルの拡張子 '{1}' が言語に関連付けられていないため、プロジェクト '{0}' を開くことができません。 diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf index 9d973075e113c..27fe20e964e11 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ko.xlf @@ -52,6 +52,11 @@ DateTimeKind는 UTC여야 합니다. + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + 대상 형식은 {0}, {1}, {2} 또는 {3}이어야 하지만 지정된 대상 형식은 {4}입니다. + + Document does not support syntax trees 문서가 구문 트리를 지원하지 않음 @@ -132,11 +137,51 @@ 확장에서 순환 발견 + + Destination type must be a {0}, but given one is {1}. + 대상 형식은 {0}이어야 하지만 지정된 형식은 {1}입니다. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + 대상 형식은 {0} 또는 {1}이어야 하지만 지정된 형식은 {2}입니다. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + 대상 형식은 {0}, {1} 또는 {2}이어야 하지만 지정된 형식은 {3}입니다. + + + + Could not find location to generation symbol into. + 기호를 생성할 위치를 찾을 수 없습니다. + + + + No location provided to add statements to. + 문을 추가할 위치가 제공되지 않았습니다. + + + + Destination location was not in source. + 대상 위치가 소스에 없습니다. + + + + Destination location was from a different tree. + 다른 트리에서 온 대상 위치입니다. + + Node is of the wrong type. 잘못된 형식의 노드입니다. + + Location must be null or from source. + 위치는 null이거나 소스에 있어야 합니다. + + Duplicate source file '{0}' in project '{1}' '{1}' 프로젝트에서 중복된 '{0}' 소스 파일입니다. @@ -407,6 +452,16 @@ 지원되지 않는 '{0}' 연산자에 대한 코드를 생성할 수 없습니다. + + Invalid number of parameters for binary operator. + 이진 연산자에 대해 잘못된 매개 변수 수입니다. + + + + Invalid number of parameters for unary operator. + 단항 연산자에 대해 잘못된 매개 변수 수입니다. + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. '{1}' 파일 확장명이 언어에 연결되어 있지 않아 '{0}' 프로젝트를 열 수 없습니다. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf index f29f635432c97..bf6c1799e126d 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pl.xlf @@ -52,6 +52,11 @@ Element DateTimeKind musi mieć wartość Utc + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Typ docelowy musi być elementem {0}, {1}, {2} lub {3}, ale podano element {4}. + + Document does not support syntax trees Dokument nie obsługuje drzew składni @@ -132,11 +137,51 @@ W rozszerzeniach wykryto cykl + + Destination type must be a {0}, but given one is {1}. + Typ docelowy musi być elementem {0}, ale podano element {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Typ docelowy musi być elementem {0} lub {1}, ale podano element {2}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Typ docelowy musi być elementem {0}, {1} lub {2}, ale podano element {3}. + + + + Could not find location to generation symbol into. + Nie można znaleźć lokalizacji do wygenerowania symbolu. + + + + No location provided to add statements to. + Nie podano lokalizacji, do których można dodać instrukcje. + + + + Destination location was not in source. + Lokalizacja docelowa nie znajdowała się w źródle. + + + + Destination location was from a different tree. + Lokalizacja docelowa pochodziła z innego drzewa. + + Node is of the wrong type. Węzeł ma nieprawidłowy typ. + + Location must be null or from source. + Lokalizacja musi mieć wartość null lub pochodzić ze źródła. + + Duplicate source file '{0}' in project '{1}' Zduplikowany plik źródłowy „{0}” w projekcie „{1}” @@ -407,6 +452,16 @@ Nie można wygenerować kodu dla nieobsługiwanego operatora „{0}” + + Invalid number of parameters for binary operator. + Nieprawidłowa liczba parametrów operatora binarnego. + + + + Invalid number of parameters for unary operator. + Nieprawidłowa liczba parametrów operatora jednoargumentowego. + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Nie można otworzyć projektu „{0}”, ponieważ rozszerzenie pliku „{1}” nie jest skojarzone z językiem. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf index 0debb02a468f1..4079e600970ba 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.pt-BR.xlf @@ -52,6 +52,11 @@ DateTimeKind deve ser Utc + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + O tipo de destino precisa ser {0}, {1}, {2} ou {3}, mas o tipo fornecido é {4}. + + Document does not support syntax trees O documento não dá suporte a árvores de sintaxe @@ -132,11 +137,51 @@ Ciclo detectado em extensões + + Destination type must be a {0}, but given one is {1}. + O tipo de destino deve ser um {0}, mas o tipo fornecido é {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + O tipo de destino deve ser um {0} ou um {1}, mas o tipo fornecido é {2}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + O tipo de destino deve ser um {0}, {1} ou {2}, mas o tipo fornecido é {3}. + + + + Could not find location to generation symbol into. + Não foi possível encontrar o local para o símbolo de geração. + + + + No location provided to add statements to. + Nenhum local fornecido para o qual adicionar instruções. + + + + Destination location was not in source. + Local de destino não estava na origem. + + + + Destination location was from a different tree. + Local de destino era de uma árvore diferente. + + Node is of the wrong type. O nó é do tipo errado. + + Location must be null or from source. + Local deve ser nulo ou da fonte. + + Duplicate source file '{0}' in project '{1}' Arquivo de origem duplicado "{0}" no projeto "{1}" @@ -407,6 +452,16 @@ Não é possível gerar código para operador não suportado "{0}" + + Invalid number of parameters for binary operator. + Número inválido de parâmetros para o operador binário. + + + + Invalid number of parameters for unary operator. + Número inválido de parâmetros para o operador unário. + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Não é possível abrir o projeto "{0}" porque a extensão de arquivo "{1}" não está associada a um idioma. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf index a15d12cd10569..f84d7e5a5fce0 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.ru.xlf @@ -52,6 +52,11 @@ Параметр DateTimeKind должен содержать время и дату в формате UTC + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Конечный тип должен быть {0}, {1}, {2} или {3}, но указан {4}. + + Document does not support syntax trees Документ не поддерживает синтаксические деревья. @@ -132,11 +137,51 @@ В выражениях обнаружен цикл + + Destination type must be a {0}, but given one is {1}. + Конечный тип должен быть {0}, но указан {1}. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Конечный тип должен быть {0} или {1}, но указан {2}. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Конечный тип должен быть {0}, {1} или {2}, но указан {3}. + + + + Could not find location to generation symbol into. + Не удалось найти расположение для создания символа. + + + + No location provided to add statements to. + Для добавления операторов не было указано расположение. + + + + Destination location was not in source. + Целевое расположение не найдено в источнике. + + + + Destination location was from a different tree. + Целевое расположение находилось в другом дереве. + + Node is of the wrong type. Узел имеет неверный тип. + + Location must be null or from source. + Расположение должно иметь значение Null или источника. + + Duplicate source file '{0}' in project '{1}' Дублирование исходного файла "{0}" в проекте "{1}" @@ -407,6 +452,16 @@ Невозможно сформировать код для неподдерживаемого оператора "{0}" + + Invalid number of parameters for binary operator. + Недопустимое число параметров для бинарного оператора. + + + + Invalid number of parameters for unary operator. + Недопустимое число параметров для унарного оператора. + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Не удается открыть проект "{0}", так как расширение файла "{1}" не связано с языком. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf index 2e6aea73cea58..134a34cbdb11b 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.tr.xlf @@ -52,6 +52,11 @@ DateTimeKind Utc olmalıdır + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + Hedef tür bir {0}, {1}, {2} veya {3} olmalı, ancak {4} belirtildi. + + Document does not support syntax trees Belge, söz dizimi ağaçlarını desteklemiyor @@ -132,11 +137,51 @@ Uzantılarda döngü algılandı + + Destination type must be a {0}, but given one is {1}. + Hedef tür bir {0} olmalı, ancak {1} belirtildi. + + + + Destination type must be a {0} or a {1}, but given one is {2}. + Hedef tür bir {0} veya {1} olmalı, ancak {2} belirtildi. + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + Hedef tür bir {0}, {1} veya {2} olmalı, ancak {3} belirtildi. + + + + Could not find location to generation symbol into. + Sembolün üretileceği konum bulunamadı. + + + + No location provided to add statements to. + Deyimlerin ekleneceği konum sağlanmadı. + + + + Destination location was not in source. + Hedef konum kaynakta değildi. + + + + Destination location was from a different tree. + Hedef konum farklı bir ağaçtandı. + + Node is of the wrong type. Düğüm yanlış türde. + + Location must be null or from source. + Konum boş veya kaynağa ait olmalıdır. + + Duplicate source file '{0}' in project '{1}' '{1}' projesinde yinelenen kaynak dosyası '{0}' @@ -407,6 +452,16 @@ Desteklenmeyen operatör '{0}' için kod üretilemiyor + + Invalid number of parameters for binary operator. + İkili operatör için parametre sayısı geçersiz. + + + + Invalid number of parameters for unary operator. + Birli operatör için parametre sayısı geçersiz. + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. Dosya uzantısı '{1}' bir dil ile ilişkili olmadığı için '{0}' projesi açılamıyor. diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf index 2b3834b392764..d7f065176dd1f 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hans.xlf @@ -52,6 +52,11 @@ DateTimeKind 必须是 Utc + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + 目标类型必须是 {0}、{1}、{2} 或 {3},但给定类型是 {4}。 + + Document does not support syntax trees 文档不支持语法树 @@ -132,11 +137,51 @@ 在扩展中检测到循环 + + Destination type must be a {0}, but given one is {1}. + 目标类型必须是 {0},但给定类型是 {1}。 + + + + Destination type must be a {0} or a {1}, but given one is {2}. + 目标类型必须是 {0} 或 {1},但给定类型是 {2}。 + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + 目标类型必须是 {0}、{1} 或 {2},但给定类型是 {3}。 + + + + Could not find location to generation symbol into. + 找不到符号生成到的位置。 + + + + No location provided to add statements to. + 未提供语句要添加到的位置。 + + + + Destination location was not in source. + 目标位置不在源中。 + + + + Destination location was from a different tree. + 目标位置来自不同的树。 + + Node is of the wrong type. 节点类型不正确。 + + Location must be null or from source. + 位置必须为 null 或来自源。 + + Duplicate source file '{0}' in project '{1}' 项目“{1}”中源文件“{0}”重复 @@ -407,6 +452,16 @@ 无法为不受支持的运算符“{0}”生成代码 + + Invalid number of parameters for binary operator. + 参数数目对二元运算符无效。 + + + + Invalid number of parameters for unary operator. + 参数数目对一元运算符无效。 + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. 无法打开项目“{0}”, 因为文件扩展名“{1}”没有与某种语言关联。 diff --git a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf index fdf0efabef1d5..939d15173014c 100644 --- a/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf +++ b/src/Workspaces/Core/Portable/xlf/WorkspacesResources.zh-Hant.xlf @@ -52,6 +52,11 @@ DateTimeKind 必須是 Utc + + Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. + 目的地類型必須是 {0}、{1}、{2} 或 {3},但提供的類型是 {4}。 + + Document does not support syntax trees 文件不支援語法樹 @@ -132,11 +137,51 @@ 在擴充功能中偵測到循環 + + Destination type must be a {0}, but given one is {1}. + 目的地類型必須是 {0},但提供的是 {1}。 + + + + Destination type must be a {0} or a {1}, but given one is {2}. + 目的地類型必須是 {0} 或 {1},但提供的是 {2}。 + + + + Destination type must be a {0}, {1} or {2}, but given one is {3}. + 目的地類型必須是 {0}、{1} 或 {2},但提供的是 {3}。 + + + + Could not find location to generation symbol into. + 找不到產生符號目的地位置。 + + + + No location provided to add statements to. + 未提供加入陳述式的位置。 + + + + Destination location was not in source. + 目的地位置不在來源中。 + + + + Destination location was from a different tree. + 目的地位置來自不同的樹狀目錄。 + + Node is of the wrong type. 節點類型不正確。 + + Location must be null or from source. + 位置必須是 null 或源自來源。 + + Duplicate source file '{0}' in project '{1}' 複製專案 '{1}' 中的原始程式檔 '{0}' @@ -407,6 +452,16 @@ 無法產生不受支援之運算子 '{0}' 的程式碼 + + Invalid number of parameters for binary operator. + 二元運算子的參數數目無效。 + + + + Invalid number of parameters for unary operator. + 一元運算子的參數數目無效。 + + Cannot open project '{0}' because the file extension '{1}' is not associated with a language. 無法開啟專案 '{0}',因為副檔名 '{1}' 未與語言相關聯。 diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs index 923f603901323..34d3c61dd7f1a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs @@ -3,8 +3,6 @@ // See the LICENSE file in the project root for more information. using System; -using System.Collections.Immutable; -using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.LanguageServices; @@ -12,27 +10,6 @@ namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class IMethodSymbolExtensions { - /// - /// Returns the methodSymbol and any partial parts. - /// - public static ImmutableArray GetAllMethodSymbolsOfPartialParts(this IMethodSymbol method) - { - if (method.PartialDefinitionPart != null) - { - Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); - return ImmutableArray.Create(method, method.PartialDefinitionPart); - } - else if (method.PartialImplementationPart != null) - { - Debug.Assert(!Equals(method.PartialImplementationPart, method)); - return ImmutableArray.Create(method.PartialImplementationPart, method); - } - else - { - return ImmutableArray.Create(method); - } - } - /// /// Returns true for void returning methods with two parameters, where /// the first parameter is of type and the second diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs index ccae323b36542..d90f5d03d5f67 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ISymbolExtensions.cs @@ -12,27 +12,10 @@ using Microsoft.CodeAnalysis.Shared.Utilities; using Roslyn.Utilities; -#if CODE_STYLE -using Microsoft.CodeAnalysis.Internal.Editing; -#else -using Microsoft.CodeAnalysis.Editing; -#endif - namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class ISymbolExtensions { - public static DeclarationModifiers GetSymbolModifiers(this ISymbol symbol) - { - return new DeclarationModifiers( - isStatic: symbol.IsStatic, - isAbstract: symbol.IsAbstract, - isUnsafe: symbol.RequiresUnsafeModifier(), - isVirtual: symbol.IsVirtual, - isOverride: symbol.IsOverride, - isSealed: symbol.IsSealed); - } - public static string ToNameDisplayString(this ISymbol symbol) => symbol.ToDisplayString(SymbolDisplayFormats.NameFormat); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs index b9695d23e8e1a..0a3dd965b3f54 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs @@ -62,21 +62,5 @@ public static bool TryRemoveFirst(this IList list, Func(this IList list, Func predicate) - { - Contract.ThrowIfNull(list); - Contract.ThrowIfNull(predicate); - - for (var i = 0; i < list.Count; i++) - { - if (predicate(list[i])) - { - return i; - } - } - - return -1; - } } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs index 89325f2535625..6f39379e5a29e 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs @@ -5,30 +5,11 @@ using System; using System.Threading; using Microsoft.CodeAnalysis.Text; -using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class SourceTextExtensions { - /// - /// Returns the leading whitespace of the line located at the specified position in the given snapshot. - /// - public static string GetLeadingWhitespaceOfLineAtPosition(this SourceText text, int position) - { - Contract.ThrowIfNull(text); - - var line = text.Lines.GetLineFromPosition(position); - var linePosition = line.GetFirstNonWhitespacePosition(); - if (!linePosition.HasValue) - { - return line.ToString(); - } - - var lineText = line.ToString(); - return lineText.Substring(0, linePosition.Value - line.Start); - } - public static bool OverlapsHiddenPosition( this SourceText text, TextSpan span, Func isPositionHidden, CancellationToken cancellationToken) { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems index c50917f98c57d..f4ccbf505feb8 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/CSharpWorkspaceExtensions.projitems @@ -9,31 +9,6 @@ Microsoft.CodeAnalysis.CSharp.Shared - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs index 449d8c4fbae50..1b726becb9d2b 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs @@ -15,13 +15,6 @@ using Microsoft.CodeAnalysis.Host.Mef; using Roslyn.Utilities; -#if CODE_STYLE -using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; -#else -using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; -#endif - - namespace Microsoft.CodeAnalysis.CSharp.AddImport { [ExportLanguageService(typeof(IAddImportsService), LanguageNames.CSharp), Shared] @@ -34,10 +27,12 @@ public CSharpAddImportsService() { } - public override bool PlaceImportsInsideNamespaces(OptionSet optionSet) +#if !CODE_STYLE + public override bool PlaceImportsInsideNamespaces(Options.OptionSet optionSet) { return optionSet.GetOption(CSharpCodeStyleOptions.PreferredUsingDirectivePlacement).Value == AddImportPlacement.InsideNamespace; } +#endif // C# doesn't have global imports. protected override ImmutableArray GetGlobalImports(Compilation compilation, SyntaxGenerator generator) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationPreferences.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationPreferences.cs index e85c1d81aafb2..3b36e4cff23a0 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationPreferences.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeGeneration/CodeGenerationPreferences.cs @@ -7,7 +7,6 @@ using Roslyn.Utilities; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Editing; -using Microsoft.CodeAnalysis.Diagnostics; #if CODE_STYLE using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; @@ -35,21 +34,18 @@ public CodeGenerationPreferences(OptionSet options) public bool PlaceSystemNamespaceFirst => Options.GetOption(GenerationOptions.PlaceSystemNamespaceFirst, Language); +#if !CODE_STYLE public abstract CodeGenerationOptions GetOptions(CodeGenerationContext context); public static async Task FromDocumentAsync(Document document, CancellationToken cancellationToken) { var parseOptions = document.Project.ParseOptions; Contract.ThrowIfNull(parseOptions); -#if CODE_STYLE - var tree = await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); - var documentOptions = document.Project.AnalyzerOptions.GetAnalyzerOptionSet(tree, cancellationToken); -#else - var documentOptions = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); -#endif + var documentOptions = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); var codeGenerationService = document.GetRequiredLanguageService(); return codeGenerationService.GetPreferences(parseOptions, documentOptions); } +#endif } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs index ba930e585ddbf..baa5040bc0af0 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/Extensions/DocumentExtensions.cs @@ -187,12 +187,6 @@ public static bool IsGeneratedCode(this Document document, CancellationToken can } #endif - public static bool IsGeneratedCode(this Document document, SyntaxTree tree, CancellationToken cancellationToken) - { - var generatedCodeRecognitionService = document.GetLanguageService(); - return generatedCodeRecognitionService?.IsGeneratedCode(tree, document, cancellationToken) == true; - } - public static async Task IsGeneratedCodeAsync(this Document document, CancellationToken cancellationToken) { var generatedCodeRecognitionService = document.GetLanguageService(); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs index 04763463f1f96..68eac08935bf7 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs @@ -10,12 +10,6 @@ using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Shared.Extensions; -#if CODE_STYLE -using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; -#else -using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; -#endif - namespace Microsoft.CodeAnalysis.AddImport { internal abstract class AbstractAddImportsService @@ -35,7 +29,9 @@ protected AbstractAddImportsService() protected abstract SyntaxList GetExterns(SyntaxNode node); protected abstract bool IsStaticUsing(TUsingOrAliasSyntax usingOrAlias); - public abstract bool PlaceImportsInsideNamespaces(OptionSet optionSet); +#if !CODE_STYLE + public abstract bool PlaceImportsInsideNamespaces(Options.OptionSet optionSet); +#endif private bool IsSimpleUsing(TUsingOrAliasSyntax usingOrAlias) => !IsAlias(usingOrAlias) && !IsStaticUsing(usingOrAlias); private bool IsAlias(TUsingOrAliasSyntax usingOrAlias) => GetAlias(usingOrAlias) != null; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs index ceee0a3cd7a2e..489d167099e4b 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs @@ -6,18 +6,11 @@ using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; -#if CODE_STYLE -using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; -#else -using Microsoft.CodeAnalysis.Options; -#endif - namespace Microsoft.CodeAnalysis.AddImport { [DataContract] @@ -30,7 +23,7 @@ internal record struct AddImportPlacementOptions( public static async Task FromDocumentAsync(Document document, CancellationToken cancellationToken) => FromDocument(document, await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false)); - public static AddImportPlacementOptions FromDocument(Document document, OptionSet documentOptions) + public static AddImportPlacementOptions FromDocument(Document document, Options.OptionSet documentOptions) { var service = document.GetRequiredLanguageService(); @@ -48,22 +41,14 @@ private static bool CanAddImportsInHiddenRegions(Document document) var spanMapper = document.Services.GetService(); return spanMapper != null && spanMapper.SupportsMappingImportDirectives; } -#else - public static async Task FromDocumentAsync(Document document, CancellationToken cancellationToken) - { - var service = document.GetRequiredLanguageService(); - var options = document.Project.AnalyzerOptions.GetAnalyzerOptionSet(await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false), cancellationToken); - return new( - PlaceSystemNamespaceFirst: options.GetOption(GenerationOptions.PlaceSystemNamespaceFirst), - PlaceImportsInsideNamespaces: service.PlaceImportsInsideNamespaces(options), - AllowInHiddenRegions: false); - } #endif } internal interface IAddImportsService : ILanguageService { - bool PlaceImportsInsideNamespaces(OptionSet optionSet); +#if !CODE_STYLE + bool PlaceImportsInsideNamespaces(Options.OptionSet optionSet); +#endif /// /// Returns true if the tree already has an existing import syntactically equivalent to diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs index 12819c4d7f6c8..3547f536f7542 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/AbstractGeneratedCodeRecognitionService.cs @@ -28,7 +28,7 @@ public async Task IsGeneratedCodeAsync(Document document, CancellationToke return IsGeneratedCode(syntaxTree, document, cancellationToken); } - public bool IsGeneratedCode(SyntaxTree syntaxTree, Document document, CancellationToken cancellationToken) + private static bool IsGeneratedCode(SyntaxTree syntaxTree, Document document, CancellationToken cancellationToken) { var syntaxFacts = document.GetLanguageService(); return syntaxTree.IsGeneratedCode(document.Project.AnalyzerOptions, syntaxFacts, cancellationToken); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs index 55f8b414fcc31..f4e7b1dea31c4 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/GeneratedCodeRecognition/IGeneratedCodeRecognitionService.cs @@ -17,7 +17,5 @@ internal interface IGeneratedCodeRecognitionService : ILanguageService #endif Task IsGeneratedCodeAsync(Document document, CancellationToken cancellationToken); - - bool IsGeneratedCode(SyntaxTree syntaxTree, Document document, CancellationToken cancellationToken); } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems index 90960257abe40..6d798ec06c87a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems @@ -10,55 +10,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -86,7 +39,6 @@ - diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensionsResources.resx b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensionsResources.resx index 2bf8009eed9e8..f5b438da33afe 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensionsResources.resx +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensionsResources.resx @@ -144,37 +144,4 @@ Warning: Declaration changes scope and may change meaning. - - Location must be null or from source. - - - Could not find location to generation symbol into. - - - Destination location was from a different tree. - - - Destination location was not in source. - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - Destination type must be a {0}, but given one is {1}. - - - Destination type must be a {0} or a {1}, but given one is {2}. - - - No location provided to add statements to. - - - Invalid number of parameters for binary operator. - - - Invalid number of parameters for unary operator. - \ No newline at end of file diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.cs.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.cs.xlf index 15ce5cde54f35..b260a21696b04 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.cs.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.cs.xlf @@ -7,41 +7,6 @@ K provedení úlohy se vyžaduje kompilace, ale projekt {0} ji nepodporuje. - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' Opravit vše ({0}) @@ -57,26 +22,6 @@ Opravit vše ({0}) v řešení - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution Ke splnění úkolu se vyžaduje projekt s ID {0}, který ale není z řešení dostupný. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.de.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.de.xlf index f3318f32fe58b..e1b4b7ed01fc5 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.de.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.de.xlf @@ -7,41 +7,6 @@ Die Kompilierung ist zum Ausführen der Aufgabe erforderlich, wird aber vom Projekt "{0}" nicht unterstützt. - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' Alle '{0}' reparieren @@ -57,26 +22,6 @@ Alle '{0}' in Lösung reparieren - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution Ein Projekt mit der ID "{0}" ist zum Ausführen der Aufgabe erforderlich, steht aber in der Projektmappe nicht zur Verfügung. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.es.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.es.xlf index 10e0c0bdeed4e..1b78e6d680b8a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.es.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.es.xlf @@ -7,41 +7,6 @@ La compilación es necesaria para realizar la tarea, pero el proyecto {0} no la admite. - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' Corregir todo '{0}' @@ -57,26 +22,6 @@ Corregir todo '{0}' en solución - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution Se necesita el identificador de proyecto "{0}" para realizar la tarea, pero no está disponibles en la solución diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.fr.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.fr.xlf index 00f6c594cbafb..c00a9f0c92b08 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.fr.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.fr.xlf @@ -7,41 +7,6 @@ Une compilation est nécessaire pour accomplir la tâche, mais elle n'est pas prise en charge par le projet {0}. - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' Corriger tous les '{0}' @@ -57,26 +22,6 @@ Corriger tous les '{0}' dans la solution - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution Le projet de l'ID {0} est nécessaire pour accomplir la tâche mais n'est pas disponible dans la solution diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.it.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.it.xlf index 5324bd365f72f..584ccef5f4fb7 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.it.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.it.xlf @@ -7,41 +7,6 @@ Per eseguire l'attività, è necessaria la compilazione, che però non è supportata dal progetto {0}. - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' Correggi tutti '{0}' @@ -57,26 +22,6 @@ Correggi tutti '{0}' nella soluzione - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution Per eseguire l'attività, è necessario il progetto con ID '{0}', che però non è disponibile dalla soluzione diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ja.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ja.xlf index 770f670759bfd..878a0817f7cb4 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ja.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ja.xlf @@ -7,41 +7,6 @@ コンパイルはタスクの実行に必要ですが、プロジェクト {0} ではサポートされていません。 - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' すべての '{0}' を修正します @@ -57,26 +22,6 @@ ソリューションに含まれているすべての '{0}' を修正します - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution タスクの完了には ID {0} のプロジェクトが必要ですが、このソリューションからは利用できません diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ko.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ko.xlf index 0b9a670077886..b7893a187a979 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ko.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ko.xlf @@ -7,41 +7,6 @@ 작업을 수행하는 데 컴파일이 필요하지만 프로젝트 {0}에서 지원하지 않습니다. - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' 모든 '{0}' 수정 @@ -57,26 +22,6 @@ 솔루션의 모든 '{0}' 수정 - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution 작업을 수행하는 데 ID가 {0}인 프로젝트가 필요하지만, 솔루션에서 해당 프로젝트를 사용할 수 없습니다. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pl.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pl.xlf index 0169ce14061b0..6ce41179340ce 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pl.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pl.xlf @@ -7,41 +7,6 @@ Ukończenie zadania wymaga kompilacji, ale nie jest ona obsługiwana przez projekt {0}. - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' Napraw wszystkie wystąpienia elementu „{0}” @@ -57,26 +22,6 @@ Napraw wszystkie wystąpienia elementu „{0}” w rozwiązaniu - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution Do wykonania zadania wymagany jest projekt o identyfikatorze {0}, ale nie jest on udostępniany przez rozwiązanie diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pt-BR.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pt-BR.xlf index d5184729cebc9..d9f762bf4227e 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pt-BR.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.pt-BR.xlf @@ -7,41 +7,6 @@ A compilação é necessária para realizar a tarefa, mas não é compatível com o projeto {0}. - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' Corrigir todos os '{0}' @@ -57,26 +22,6 @@ Corrigir todos os '{0}' na Solução - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution O projeto com a ID {0} é necessário para realizar a tarefa, mas não está disponível na solução diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ru.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ru.xlf index 36f75411bc17a..742117c1c9930 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ru.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.ru.xlf @@ -7,41 +7,6 @@ Для выполнения задачи требуется компиляция, но она не поддерживается в проекте {0}. - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' Исправить все "{0}" @@ -57,26 +22,6 @@ Исправить все "{0}" в решении - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution Проект с ИД "{0}" необходим для выполнения задачи, но он недоступен из решения. diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.tr.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.tr.xlf index 92f78344b59f8..befe4cda1ace2 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.tr.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.tr.xlf @@ -7,41 +7,6 @@ Görevi gerçekleştirmek için derleme gerekiyor ancak bu, {0} projesi tarafından desteklenmiyor. - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' Geçtiği her yerde '{0}' ifadesini düzelt @@ -57,26 +22,6 @@ Çözüm'de geçtiği her yerde '{0}' ifadesini düzelt - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution Görevi gerçekleştirmek için '{0}' kimlikli proje gerekli, ancak bu proje çözümde yok diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hans.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hans.xlf index 2ccebe3aa24ec..6196afb3309a9 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hans.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hans.xlf @@ -7,41 +7,6 @@ 必须进行编译才能完成该任务,但项目 {0} 不支持此操作。 - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' 修复所有“{0}” @@ -57,26 +22,6 @@ 修复解决方案中的所有“{0}” - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution 需要 ID 为 {0} 的项目才能完成任务,但无法从解决方案中使用该项目 diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hant.xlf b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hant.xlf index c1e9af3667f5a..726bc7c6fa2ab 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hant.xlf +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/xlf/WorkspaceExtensionsResources.zh-Hant.xlf @@ -7,41 +7,6 @@ 必須編譯才能完成工作,但專案 {0} 並不支援。 - - Could not find location to generation symbol into. - Could not find location to generation symbol into. - - - - Destination location was from a different tree. - Destination location was from a different tree. - - - - Destination location was not in source. - Destination location was not in source. - - - - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - Destination type must be a {0}, {1}, {2} or {3}, but given one is {4}. - - - - Destination type must be a {0}, {1} or {2}, but given one is {3}. - Destination type must be a {0}, {1} or {2}, but given one is {3}. - - - - Destination type must be a {0}, but given one is {1}. - Destination type must be a {0}, but given one is {1}. - - - - Destination type must be a {0} or a {1}, but given one is {2}. - Destination type must be a {0} or a {1}, but given one is {2}. - - Fix all '{0}' 修正所有 '{0}' @@ -57,26 +22,6 @@ 修正方案中的所有 '{0}' - - Invalid number of parameters for binary operator. - Invalid number of parameters for binary operator. - - - - Invalid number of parameters for unary operator. - Invalid number of parameters for unary operator. - - - - Location must be null or from source. - Location must be null or from source. - - - - No location provided to add statements to. - No location provided to add statements to. - - Project of ID {0} is required to accomplish the task but is not available from the solution 完成工作需要識別碼為 {0} 的專案,但是無法從解決方案取得 diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb index 88842d65e6cf6..035f8718aa952 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb @@ -12,12 +12,6 @@ Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Microsoft.CodeAnalysis.VisualBasic.Utilities -#If CODE_STYLE Then -Imports OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions -#Else -Imports Microsoft.CodeAnalysis.Options -#End If - Namespace Microsoft.CodeAnalysis.VisualBasic.AddImports Friend Class VisualBasicAddImportsService @@ -63,11 +57,12 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.AddImports FirstOrDefault()?.Alias End Function - Public Overrides Function PlaceImportsInsideNamespaces(optionSet As OptionSet) As Boolean +#If Not CODE_STYLE Then + Public Overrides Function PlaceImportsInsideNamespaces(optionSet As Options.OptionSet) As Boolean ' Visual Basic doesn't support imports inside namespaces Return False End Function - +#End If Protected Overrides Function IsStaticUsing(usingOrAlias As ImportsStatementSyntax) As Boolean ' Visual Basic doesn't support static imports Return False From 9a7897a286c41145880f3eff9fbfd79529c29774 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Sat, 2 Apr 2022 16:16:16 +0200 Subject: [PATCH 105/131] Fix errors and remove a hard CodeFixProvider back to Features --- .../CSharpUseLocalFunctionCodeFixProvider.cs | 5 ---- .../Shared/Extensions/IListExtensions.cs | 29 ------------------- .../Extensions/IMethodSymbolExtensions.cs | 21 -------------- .../Shared/Extensions/SourceTextExtensions.cs | 18 ------------ .../Extensions/IMethodSymbolExtensions.cs | 23 +++++++++++++++ .../Core/Extensions/ListExtensions.cs | 16 ++++++++++ ...ourceTextExtensions_SharedWithCodeStyle.cs | 19 ++++++++++++ .../CSharpAddImportsService.cs | 10 +++++-- .../AddImports/AbstractAddImportsService.cs | 10 +++++-- .../AddImports/IAddImportsService.cs | 23 ++++++++++++--- .../VisualBasicAddImportsService.vb | 10 +++++-- 11 files changed, 98 insertions(+), 86 deletions(-) rename src/{Analyzers/CSharp/CodeFixes => Features/CSharp/Portable}/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs (99%) delete mode 100644 src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs diff --git a/src/Analyzers/CSharp/CodeFixes/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs b/src/Features/CSharp/Portable/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs similarity index 99% rename from src/Analyzers/CSharp/CodeFixes/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs rename to src/Features/CSharp/Portable/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs index 87cafd3879c74..19dbb99b310eb 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs @@ -89,12 +89,7 @@ protected override async Task FixAllAsync( var root = editor.OriginalRoot; var currentRoot = root.TrackNodes(nodesToTrack); -#if CODE_STYLE - var options = document.Project.AnalyzerOptions.GetAnalyzerOptionSet(root.SyntaxTree, cancellationToken); -#else var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); -#endif - var languageVersion = semanticModel.SyntaxTree.Options.LanguageVersion(); var makeStaticIfPossible = languageVersion >= LanguageVersion.CSharp8 && options.GetOption(CSharpCodeStyleOptions.PreferStaticLocalFunction).Value; diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs deleted file mode 100644 index e69f2ba59a96f..0000000000000 --- a/src/Workspaces/Core/Portable/Shared/Extensions/IListExtensions.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Generic; -using Roslyn.Utilities; - -namespace Microsoft.CodeAnalysis.Shared.Extensions -{ - internal static class IListExtensions - { - public static int IndexOf(this IList list, Func predicate) - { - Contract.ThrowIfNull(list); - Contract.ThrowIfNull(predicate); - - for (var i = 0; i < list.Count; i++) - { - if (predicate(list[i])) - { - return i; - } - } - - return -1; - } - } -} diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs index 816b43f8e4ad7..dfd06aa29ec10 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/IMethodSymbolExtensions.cs @@ -55,27 +55,6 @@ public static bool CompatibleSignatureToDelegate(this IMethodSymbol method, INam return true; } - /// - /// Returns the methodSymbol and any partial parts. - /// - public static ImmutableArray GetAllMethodSymbolsOfPartialParts(this IMethodSymbol method) - { - if (method.PartialDefinitionPart != null) - { - Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); - return ImmutableArray.Create(method, method.PartialDefinitionPart); - } - else if (method.PartialImplementationPart != null) - { - Debug.Assert(!Equals(method.PartialImplementationPart, method)); - return ImmutableArray.Create(method.PartialImplementationPart, method); - } - else - { - return ImmutableArray.Create(method); - } - } - public static IMethodSymbol RenameTypeParameters(this IMethodSymbol method, ImmutableArray newNames) { if (method.TypeParameters.Select(t => t.Name).SequenceEqual(newNames)) diff --git a/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs b/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs index 1ceb1db50bb73..84e5de00012ef 100644 --- a/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs +++ b/src/Workspaces/Core/Portable/Shared/Extensions/SourceTextExtensions.cs @@ -16,24 +16,6 @@ namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class SourceTextExtensions { - /// - /// Returns the leading whitespace of the line located at the specified position in the given snapshot. - /// - public static string GetLeadingWhitespaceOfLineAtPosition(this SourceText text, int position) - { - Contract.ThrowIfNull(text); - - var line = text.Lines.GetLineFromPosition(position); - var linePosition = line.GetFirstNonWhitespacePosition(); - if (!linePosition.HasValue) - { - return line.ToString(); - } - - var lineText = line.ToString(); - return lineText.Substring(0, linePosition.Value - line.Start); - } - public static void GetLineAndOffset(this SourceText text, int position, out int lineNumber, out int offset) { var line = text.Lines.GetLineFromPosition(position); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs index 34d3c61dd7f1a..923f603901323 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/IMethodSymbolExtensions.cs @@ -3,6 +3,8 @@ // See the LICENSE file in the project root for more information. using System; +using System.Collections.Immutable; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using Microsoft.CodeAnalysis.LanguageServices; @@ -10,6 +12,27 @@ namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class IMethodSymbolExtensions { + /// + /// Returns the methodSymbol and any partial parts. + /// + public static ImmutableArray GetAllMethodSymbolsOfPartialParts(this IMethodSymbol method) + { + if (method.PartialDefinitionPart != null) + { + Debug.Assert(method.PartialImplementationPart == null && !Equals(method.PartialDefinitionPart, method)); + return ImmutableArray.Create(method, method.PartialDefinitionPart); + } + else if (method.PartialImplementationPart != null) + { + Debug.Assert(!Equals(method.PartialImplementationPart, method)); + return ImmutableArray.Create(method.PartialImplementationPart, method); + } + else + { + return ImmutableArray.Create(method); + } + } + /// /// Returns true for void returning methods with two parameters, where /// the first parameter is of type and the second diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs index 0a3dd965b3f54..b9695d23e8e1a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/ListExtensions.cs @@ -62,5 +62,21 @@ public static bool TryRemoveFirst(this IList list, Func(this IList list, Func predicate) + { + Contract.ThrowIfNull(list); + Contract.ThrowIfNull(predicate); + + for (var i = 0; i < list.Count; i++) + { + if (predicate(list[i])) + { + return i; + } + } + + return -1; + } } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs index 6f39379e5a29e..89325f2535625 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/Extensions/SourceTextExtensions_SharedWithCodeStyle.cs @@ -5,11 +5,30 @@ using System; using System.Threading; using Microsoft.CodeAnalysis.Text; +using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Shared.Extensions { internal static partial class SourceTextExtensions { + /// + /// Returns the leading whitespace of the line located at the specified position in the given snapshot. + /// + public static string GetLeadingWhitespaceOfLineAtPosition(this SourceText text, int position) + { + Contract.ThrowIfNull(text); + + var line = text.Lines.GetLineFromPosition(position); + var linePosition = line.GetFirstNonWhitespacePosition(); + if (!linePosition.HasValue) + { + return line.ToString(); + } + + var lineText = line.ToString(); + return lineText.Substring(0, linePosition.Value - line.Start); + } + public static bool OverlapsHiddenPosition( this SourceText text, TextSpan span, Func isPositionHidden, CancellationToken cancellationToken) { diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs index 1b726becb9d2b..600befdf1ba0c 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/CSharp/LanguageServices/CSharpAddImportsService.cs @@ -15,6 +15,12 @@ using Microsoft.CodeAnalysis.Host.Mef; using Roslyn.Utilities; +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; +#endif + namespace Microsoft.CodeAnalysis.CSharp.AddImport { [ExportLanguageService(typeof(IAddImportsService), LanguageNames.CSharp), Shared] @@ -27,12 +33,10 @@ public CSharpAddImportsService() { } -#if !CODE_STYLE - public override bool PlaceImportsInsideNamespaces(Options.OptionSet optionSet) + public override bool PlaceImportsInsideNamespaces(OptionSet optionSet) { return optionSet.GetOption(CSharpCodeStyleOptions.PreferredUsingDirectivePlacement).Value == AddImportPlacement.InsideNamespace; } -#endif // C# doesn't have global imports. protected override ImmutableArray GetGlobalImports(Compilation compilation, SyntaxGenerator generator) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs index 68eac08935bf7..04763463f1f96 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/AbstractAddImportsService.cs @@ -10,6 +10,12 @@ using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Shared.Extensions; +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; +#endif + namespace Microsoft.CodeAnalysis.AddImport { internal abstract class AbstractAddImportsService @@ -29,9 +35,7 @@ protected AbstractAddImportsService() protected abstract SyntaxList GetExterns(SyntaxNode node); protected abstract bool IsStaticUsing(TUsingOrAliasSyntax usingOrAlias); -#if !CODE_STYLE - public abstract bool PlaceImportsInsideNamespaces(Options.OptionSet optionSet); -#endif + public abstract bool PlaceImportsInsideNamespaces(OptionSet optionSet); private bool IsSimpleUsing(TUsingOrAliasSyntax usingOrAlias) => !IsAlias(usingOrAlias) && !IsStaticUsing(usingOrAlias); private bool IsAlias(TUsingOrAliasSyntax usingOrAlias) => GetAlias(usingOrAlias) != null; diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs index 489d167099e4b..e29753b2de1ba 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs @@ -6,11 +6,18 @@ using System.Runtime.Serialization; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.Editing; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Shared.Extensions; using Roslyn.Utilities; +#if CODE_STYLE +using OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions; +#else +using OptionSet = Microsoft.CodeAnalysis.Options.OptionSet; +#endif + namespace Microsoft.CodeAnalysis.AddImport { [DataContract] @@ -23,7 +30,7 @@ internal record struct AddImportPlacementOptions( public static async Task FromDocumentAsync(Document document, CancellationToken cancellationToken) => FromDocument(document, await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false)); - public static AddImportPlacementOptions FromDocument(Document document, Options.OptionSet documentOptions) + public static AddImportPlacementOptions FromDocument(Document document, OptionSet documentOptions) { var service = document.GetRequiredLanguageService(); @@ -41,14 +48,22 @@ private static bool CanAddImportsInHiddenRegions(Document document) var spanMapper = document.Services.GetService(); return spanMapper != null && spanMapper.SupportsMappingImportDirectives; } +#else + public static async Task FromDocumentAsync(Document document, CancellationToken cancellationToken) + { + var service = document.GetRequiredLanguageService(); + var options = document.Project.AnalyzerOptions.GetAnalyzerOptionSet(await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false), cancellationToken); + return new( + PlaceSystemNamespaceFirst: options.GetOption(GenerationOptions.PlaceSystemNamespaceFirst), + PlaceImportsInsideNamespaces: service.PlaceImportsInsideNamespaces(options), + AllowInHiddenRegions: false); + } #endif } internal interface IAddImportsService : ILanguageService { -#if !CODE_STYLE - bool PlaceImportsInsideNamespaces(Options.OptionSet optionSet); -#endif + bool PlaceImportsInsideNamespaces(OptionSet optionSet); /// /// Returns true if the tree already has an existing import syntactically equivalent to diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb index 035f8718aa952..2adb2a6de2df5 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/VisualBasic/LanguageServices/VisualBasicAddImportsService.vb @@ -12,6 +12,12 @@ Imports Microsoft.CodeAnalysis.PooledObjects Imports Microsoft.CodeAnalysis.VisualBasic.Syntax Imports Microsoft.CodeAnalysis.VisualBasic.Utilities +#If CODE_STYLE Then +Imports OptionSet = Microsoft.CodeAnalysis.Diagnostics.AnalyzerConfigOptions +#Else +Imports OptionSet = Microsoft.CodeAnalysis.Options.OptionSet +#End If + Namespace Microsoft.CodeAnalysis.VisualBasic.AddImports Friend Class VisualBasicAddImportsService @@ -57,12 +63,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.AddImports FirstOrDefault()?.Alias End Function -#If Not CODE_STYLE Then - Public Overrides Function PlaceImportsInsideNamespaces(optionSet As Options.OptionSet) As Boolean + Public Overrides Function PlaceImportsInsideNamespaces(optionSet As OptionSet) As Boolean ' Visual Basic doesn't support imports inside namespaces Return False End Function -#End If Protected Overrides Function IsStaticUsing(usingOrAlias As ImportsStatementSyntax) As Boolean ' Visual Basic doesn't support static imports Return False From f82a7a10809ccf78fffca368eed3df8d389ee064 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Sat, 2 Apr 2022 16:23:26 +0200 Subject: [PATCH 106/131] Update projitems --- src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems index f0c1f8f9d08b0..aa691a6e730a6 100644 --- a/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems +++ b/src/Analyzers/CSharp/CodeFixes/CSharpCodeFixes.projitems @@ -39,7 +39,6 @@ - From baa1cd7831a7ac5e807042340b4ca3a6865083d8 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Sat, 2 Apr 2022 17:14:19 +0200 Subject: [PATCH 107/131] Move tests --- .../Tests}/AddInheritdoc/AddInheritdocTests.cs | 0 .../AddObsoleteAttributeTests.cs | 0 .../AliasAmbiguousType/AliasAmbiguousTypeTests.cs | 0 .../Tests/CSharpAnalyzers.UnitTests.projitems | 14 ++++++++++++++ .../DisambiguateSameVariableTests.cs | 0 .../Tests}/FixReturnType/FixReturnTypeTests.cs | 0 .../CSharp/Tests}/HideBase/HideBaseTests.cs | 0 .../CSharp/Tests}/Iterator/AddYieldTests.cs | 0 .../Tests}/Iterator/ChangeToIEnumerableTests.cs | 0 .../MakeMemberStatic/MakeMemberStaticTests.cs | 0 .../CSharpMakeStatementAsynchronousCodeFixTests.cs | 0 .../MakeTypeAbstract/MakeTypeAbstractTests.cs | 0 .../CSharpDeclareAsNullableCodeFixTests.cs | 0 .../CSharp/Tests}/UnsealClass/UnsealClassTests.cs | 0 .../UseInterpolatedVerbatimStringCodeFixTests.cs | 0 .../AddObsoleteAttributeTests.vb | 0 .../AliasAmbiguousType/AliasAmbiguousTypeTests.vb | 0 .../VisualBasic/Tests}/Iterator/IteratorTests.vb | 0 .../MakeTypeAbstract/MakeTypeAbstractTests.vb | 0 .../Tests}/UnsealClass/UnsealClassTests.vb | 0 .../Tests/VisualBasicAnalyzers.UnitTests.projitems | 5 +++++ 21 files changed, 19 insertions(+) rename src/{EditorFeatures/CSharpTest/Diagnostics => Analyzers/CSharp/Tests}/AddInheritdoc/AddInheritdocTests.cs (100%) rename src/{EditorFeatures/CSharpTest => Analyzers/CSharp/Tests}/AddObsoleteAttribute/AddObsoleteAttributeTests.cs (100%) rename src/{EditorFeatures/CSharpTest => Analyzers/CSharp/Tests}/AliasAmbiguousType/AliasAmbiguousTypeTests.cs (100%) rename src/{EditorFeatures/CSharpTest => Analyzers/CSharp/Tests}/DisambiguateSameVariable/DisambiguateSameVariableTests.cs (100%) rename src/{EditorFeatures/CSharpTest/Diagnostics => Analyzers/CSharp/Tests}/FixReturnType/FixReturnTypeTests.cs (100%) rename src/{EditorFeatures/CSharpTest/Diagnostics => Analyzers/CSharp/Tests}/HideBase/HideBaseTests.cs (100%) rename src/{EditorFeatures/CSharpTest/Diagnostics => Analyzers/CSharp/Tests}/Iterator/AddYieldTests.cs (100%) rename src/{EditorFeatures/CSharpTest/Diagnostics => Analyzers/CSharp/Tests}/Iterator/ChangeToIEnumerableTests.cs (100%) rename src/{EditorFeatures/CSharpTest => Analyzers/CSharp/Tests}/MakeMemberStatic/MakeMemberStaticTests.cs (100%) rename src/{EditorFeatures/CSharpTest/Diagnostics => Analyzers/CSharp/Tests}/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixTests.cs (100%) rename src/{EditorFeatures/CSharpTest => Analyzers/CSharp/Tests}/MakeTypeAbstract/MakeTypeAbstractTests.cs (100%) rename src/{EditorFeatures/CSharpTest/Diagnostics => Analyzers/CSharp/Tests}/Nullable/CSharpDeclareAsNullableCodeFixTests.cs (100%) rename src/{EditorFeatures/CSharpTest => Analyzers/CSharp/Tests}/UnsealClass/UnsealClassTests.cs (100%) rename src/{EditorFeatures/CSharpTest => Analyzers/CSharp/Tests}/UseInterpolatedVerbatimString/UseInterpolatedVerbatimStringCodeFixTests.cs (100%) rename src/{EditorFeatures/VisualBasicTest => Analyzers/VisualBasic/Tests}/AddObsoleteAttribute/AddObsoleteAttributeTests.vb (100%) rename src/{EditorFeatures/VisualBasicTest/Diagnostics => Analyzers/VisualBasic/Tests}/AliasAmbiguousType/AliasAmbiguousTypeTests.vb (100%) rename src/{EditorFeatures/VisualBasicTest/Diagnostics => Analyzers/VisualBasic/Tests}/Iterator/IteratorTests.vb (100%) rename src/{EditorFeatures/VisualBasicTest => Analyzers/VisualBasic/Tests}/MakeTypeAbstract/MakeTypeAbstractTests.vb (100%) rename src/{EditorFeatures/VisualBasicTest => Analyzers/VisualBasic/Tests}/UnsealClass/UnsealClassTests.vb (100%) diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/AddInheritdoc/AddInheritdocTests.cs b/src/Analyzers/CSharp/Tests/AddInheritdoc/AddInheritdocTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/Diagnostics/AddInheritdoc/AddInheritdocTests.cs rename to src/Analyzers/CSharp/Tests/AddInheritdoc/AddInheritdocTests.cs diff --git a/src/EditorFeatures/CSharpTest/AddObsoleteAttribute/AddObsoleteAttributeTests.cs b/src/Analyzers/CSharp/Tests/AddObsoleteAttribute/AddObsoleteAttributeTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/AddObsoleteAttribute/AddObsoleteAttributeTests.cs rename to src/Analyzers/CSharp/Tests/AddObsoleteAttribute/AddObsoleteAttributeTests.cs diff --git a/src/EditorFeatures/CSharpTest/AliasAmbiguousType/AliasAmbiguousTypeTests.cs b/src/Analyzers/CSharp/Tests/AliasAmbiguousType/AliasAmbiguousTypeTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/AliasAmbiguousType/AliasAmbiguousTypeTests.cs rename to src/Analyzers/CSharp/Tests/AliasAmbiguousType/AliasAmbiguousTypeTests.cs diff --git a/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems b/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems index b40c50a32715d..607c96a22ed55 100644 --- a/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems +++ b/src/Analyzers/CSharp/Tests/CSharpAnalyzers.UnitTests.projitems @@ -11,11 +11,23 @@ + + + + + + + + + + + + @@ -40,6 +52,7 @@ + @@ -89,6 +102,7 @@ + diff --git a/src/EditorFeatures/CSharpTest/DisambiguateSameVariable/DisambiguateSameVariableTests.cs b/src/Analyzers/CSharp/Tests/DisambiguateSameVariable/DisambiguateSameVariableTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/DisambiguateSameVariable/DisambiguateSameVariableTests.cs rename to src/Analyzers/CSharp/Tests/DisambiguateSameVariable/DisambiguateSameVariableTests.cs diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/FixReturnType/FixReturnTypeTests.cs b/src/Analyzers/CSharp/Tests/FixReturnType/FixReturnTypeTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/Diagnostics/FixReturnType/FixReturnTypeTests.cs rename to src/Analyzers/CSharp/Tests/FixReturnType/FixReturnTypeTests.cs diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/HideBase/HideBaseTests.cs b/src/Analyzers/CSharp/Tests/HideBase/HideBaseTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/Diagnostics/HideBase/HideBaseTests.cs rename to src/Analyzers/CSharp/Tests/HideBase/HideBaseTests.cs diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/Iterator/AddYieldTests.cs b/src/Analyzers/CSharp/Tests/Iterator/AddYieldTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/Diagnostics/Iterator/AddYieldTests.cs rename to src/Analyzers/CSharp/Tests/Iterator/AddYieldTests.cs diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/Iterator/ChangeToIEnumerableTests.cs b/src/Analyzers/CSharp/Tests/Iterator/ChangeToIEnumerableTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/Diagnostics/Iterator/ChangeToIEnumerableTests.cs rename to src/Analyzers/CSharp/Tests/Iterator/ChangeToIEnumerableTests.cs diff --git a/src/EditorFeatures/CSharpTest/MakeMemberStatic/MakeMemberStaticTests.cs b/src/Analyzers/CSharp/Tests/MakeMemberStatic/MakeMemberStaticTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/MakeMemberStatic/MakeMemberStaticTests.cs rename to src/Analyzers/CSharp/Tests/MakeMemberStatic/MakeMemberStaticTests.cs diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixTests.cs b/src/Analyzers/CSharp/Tests/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/Diagnostics/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixTests.cs rename to src/Analyzers/CSharp/Tests/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixTests.cs diff --git a/src/EditorFeatures/CSharpTest/MakeTypeAbstract/MakeTypeAbstractTests.cs b/src/Analyzers/CSharp/Tests/MakeTypeAbstract/MakeTypeAbstractTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/MakeTypeAbstract/MakeTypeAbstractTests.cs rename to src/Analyzers/CSharp/Tests/MakeTypeAbstract/MakeTypeAbstractTests.cs diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/Nullable/CSharpDeclareAsNullableCodeFixTests.cs b/src/Analyzers/CSharp/Tests/Nullable/CSharpDeclareAsNullableCodeFixTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/Diagnostics/Nullable/CSharpDeclareAsNullableCodeFixTests.cs rename to src/Analyzers/CSharp/Tests/Nullable/CSharpDeclareAsNullableCodeFixTests.cs diff --git a/src/EditorFeatures/CSharpTest/UnsealClass/UnsealClassTests.cs b/src/Analyzers/CSharp/Tests/UnsealClass/UnsealClassTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/UnsealClass/UnsealClassTests.cs rename to src/Analyzers/CSharp/Tests/UnsealClass/UnsealClassTests.cs diff --git a/src/EditorFeatures/CSharpTest/UseInterpolatedVerbatimString/UseInterpolatedVerbatimStringCodeFixTests.cs b/src/Analyzers/CSharp/Tests/UseInterpolatedVerbatimString/UseInterpolatedVerbatimStringCodeFixTests.cs similarity index 100% rename from src/EditorFeatures/CSharpTest/UseInterpolatedVerbatimString/UseInterpolatedVerbatimStringCodeFixTests.cs rename to src/Analyzers/CSharp/Tests/UseInterpolatedVerbatimString/UseInterpolatedVerbatimStringCodeFixTests.cs diff --git a/src/EditorFeatures/VisualBasicTest/AddObsoleteAttribute/AddObsoleteAttributeTests.vb b/src/Analyzers/VisualBasic/Tests/AddObsoleteAttribute/AddObsoleteAttributeTests.vb similarity index 100% rename from src/EditorFeatures/VisualBasicTest/AddObsoleteAttribute/AddObsoleteAttributeTests.vb rename to src/Analyzers/VisualBasic/Tests/AddObsoleteAttribute/AddObsoleteAttributeTests.vb diff --git a/src/EditorFeatures/VisualBasicTest/Diagnostics/AliasAmbiguousType/AliasAmbiguousTypeTests.vb b/src/Analyzers/VisualBasic/Tests/AliasAmbiguousType/AliasAmbiguousTypeTests.vb similarity index 100% rename from src/EditorFeatures/VisualBasicTest/Diagnostics/AliasAmbiguousType/AliasAmbiguousTypeTests.vb rename to src/Analyzers/VisualBasic/Tests/AliasAmbiguousType/AliasAmbiguousTypeTests.vb diff --git a/src/EditorFeatures/VisualBasicTest/Diagnostics/Iterator/IteratorTests.vb b/src/Analyzers/VisualBasic/Tests/Iterator/IteratorTests.vb similarity index 100% rename from src/EditorFeatures/VisualBasicTest/Diagnostics/Iterator/IteratorTests.vb rename to src/Analyzers/VisualBasic/Tests/Iterator/IteratorTests.vb diff --git a/src/EditorFeatures/VisualBasicTest/MakeTypeAbstract/MakeTypeAbstractTests.vb b/src/Analyzers/VisualBasic/Tests/MakeTypeAbstract/MakeTypeAbstractTests.vb similarity index 100% rename from src/EditorFeatures/VisualBasicTest/MakeTypeAbstract/MakeTypeAbstractTests.vb rename to src/Analyzers/VisualBasic/Tests/MakeTypeAbstract/MakeTypeAbstractTests.vb diff --git a/src/EditorFeatures/VisualBasicTest/UnsealClass/UnsealClassTests.vb b/src/Analyzers/VisualBasic/Tests/UnsealClass/UnsealClassTests.vb similarity index 100% rename from src/EditorFeatures/VisualBasicTest/UnsealClass/UnsealClassTests.vb rename to src/Analyzers/VisualBasic/Tests/UnsealClass/UnsealClassTests.vb diff --git a/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems b/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems index 9d44e1576f130..e913d80783866 100644 --- a/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems +++ b/src/Analyzers/VisualBasic/Tests/VisualBasicAnalyzers.UnitTests.projitems @@ -12,13 +12,18 @@ + + + + + From 0f38b293669f454f72da5d11d5f9fef0124e5507 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Sat, 2 Apr 2022 17:22:19 +0200 Subject: [PATCH 108/131] Remove unused abstract property --- .../Core/CodeFixes/CodeFixCategory.cs | 32 ------------------- .../SyntaxEditorBasedCodeFixProvider.cs | 2 -- .../Core/WorkspaceExtensions.projitems | 3 +- 3 files changed, 1 insertion(+), 36 deletions(-) delete mode 100644 src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/CodeFixCategory.cs diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/CodeFixCategory.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/CodeFixCategory.cs deleted file mode 100644 index 84b76a37b0474..0000000000000 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/CodeFixCategory.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -namespace Microsoft.CodeAnalysis.CodeFixes -{ - /// - /// Code fix category for code fixes provided by a . - /// - internal enum CodeFixCategory - { - /// - /// Fixes code to adhere to code style. - /// - CodeStyle, - - /// - /// Fixes code to improve code quality. - /// - CodeQuality, - - /// - /// Fixes code to fix compiler diagnostics. - /// - Compile, - - /// - /// Custom category for fix. - /// - Custom - } -} diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/SyntaxEditorBasedCodeFixProvider.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/SyntaxEditorBasedCodeFixProvider.cs index e8871f733f605..b5e299c2e5830 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/SyntaxEditorBasedCodeFixProvider.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/CodeFixes/SyntaxEditorBasedCodeFixProvider.cs @@ -72,8 +72,6 @@ internal static async Task FixAllWithEditorAsync( return document.WithSyntaxRoot(newRoot); } - internal abstract CodeFixCategory CodeFixCategory { get; } - protected abstract Task FixAllAsync( Document document, ImmutableArray diagnostics, SyntaxEditor editor, CancellationToken cancellationToken); diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems index 6d798ec06c87a..37665675673e7 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/WorkspaceExtensions.projitems @@ -25,7 +25,6 @@ - @@ -98,4 +97,4 @@ - \ No newline at end of file + From ea43db05d9e40e8339afe7220cbb69fcd994e352 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Sat, 2 Apr 2022 17:35:00 +0200 Subject: [PATCH 109/131] Remove the single unused read of CodeFixCategory --- .../Core.Wpf/Suggestions/SuggestedActions/SuggestedAction.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/SuggestedAction.cs b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/SuggestedAction.cs index 619e455ae9dfb..0e63dbf5b1237 100644 --- a/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/SuggestedAction.cs +++ b/src/EditorFeatures/Core.Wpf/Suggestions/SuggestedActions/SuggestedAction.cs @@ -65,9 +65,6 @@ internal SuggestedAction( internal virtual CodeActionPriority Priority => CodeAction.Priority; - internal bool IsForCodeQualityImprovement - => (Provider as SyntaxEditorBasedCodeFixProvider)?.CodeFixCategory == CodeFixCategory.CodeQuality; - public virtual bool TryGetTelemetryId(out Guid telemetryId) { telemetryId = CodeAction.GetType().GetTelemetryId(); From 0f3ebc7aec5dd240332f763a506b5884c5c1d417 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Sat, 2 Apr 2022 17:43:06 +0200 Subject: [PATCH 110/131] Remove overrides in Analyzers --- .../CodeFixes/AddBraces/CSharpAddBracesCodeFixProvider.cs | 2 -- .../ConvertNamespace/ConvertNamespaceCodeFixProvider.cs | 2 -- .../ConvertSwitchStatementToExpressionCodeFixProvider.cs | 2 -- .../CSharpInlineDeclarationCodeFixProvider.cs | 2 -- .../InvokeDelegateWithConditionalAccessCodeFixProvider.cs | 2 -- .../CSharpMakeStructFieldsWritableCodeFixProvider.cs | 2 -- .../CSharpRemoveUnnecessaryCastCodeFixProvider.cs | 2 -- ...arpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs | 2 -- ...SharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs | 2 -- .../CSharpRemoveUnreachableCodeCodeFixProvider.cs | 2 -- .../CSharpSimplifyPropertyPatternCodeFixProvider.cs | 2 -- .../CSharpTransposeRecordKeywordCodeFixProvider.cs | 3 --- .../CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs | 2 -- .../CSharpUseDeconstructionCodeFixProvider.cs | 2 -- .../CSharpUseDefaultLiteralCodeFixProvider.cs | 2 -- .../UseExpressionBody/UseExpressionBodyCodeFixProvider.cs | 2 -- .../CSharpUseImplicitObjectCreationCodeFixProvider.cs | 2 -- .../UseExplicitTypeCodeFixProvider.cs | 2 -- .../UseImplicitTypeCodeFixProvider.cs | 2 -- .../CSharpUseIndexOperatorCodeFixProvider.cs | 2 -- .../CSharpUseRangeOperatorCodeFixProvider.cs | 2 -- ...eIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs | 2 -- .../CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs | 2 -- .../CSharpUseParameterNullCheckingCodeFixProvider.cs | 2 -- .../CSharpUsePatternCombinatorsCodeFixProvider.cs | 2 -- .../CSharpAsAndNullCheckCodeFixProvider.cs | 2 -- .../CSharpIsAndCastCheckCodeFixProvider.cs | 2 -- .../CSharpUseNotPatternCodeFixProvider.cs | 2 -- .../UseSimpleUsingStatementCodeFixProvider.cs | 2 -- .../UseTupleSwap/CSharpUseTupleSwapCodeFixProvider.cs | 2 -- .../AbstractAddAccessibilityModifiersCodeFixProvider.cs | 2 -- .../AddRequiredParenthesesCodeFixProvider.cs | 2 -- .../AbstractConvertTypeOfToNameOfCodeFixProvider.cs | 2 -- .../AbstractMakeFieldReadonlyCodeFixProvider.cs | 2 -- .../OrderModifiers/AbstractOrderModifiersCodeFixProvider.cs | 2 -- .../PopulateSwitch/AbstractPopulateSwitchCodeFixProvider.cs | 2 -- .../AbstractQualifyMemberAccessCodeFixProvider.cs | 2 -- .../RemoveRedundantEqualityCodeFixProvider.cs | 2 -- .../AbstractRemoveUnnecessaryParenthesesCodeFixProvider.cs | 2 -- ...RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs | 3 --- .../RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs | 3 --- .../AbstractRemoveUnusedMembersCodeFixProvider.cs | 2 -- .../AbstractRemoveUnusedValuesCodeFixProvider.cs | 2 -- .../SimplifyConditionalCodeFixProvider.cs | 3 --- .../AbstractSimplifyInterpolationCodeFixProvider.cs | 2 -- .../AbstractSimplifyLinqExpressionCodeFixProvider`3.cs | 2 -- .../UpdateLegacySuppressionsCodeFixProvider.cs | 3 --- .../UseCoalesceExpressionCodeFixProvider.cs | 2 -- .../UseCoalesceExpressionForNullableCodeFixProvider.cs | 2 -- .../AbstractUseCollectionInitializerCodeFixProvider.cs | 2 -- .../AbstractUseCompoundAssignmentCodeFixProvider.cs | 2 -- .../AbstractUseConditionalExpressionCodeFixProvider.cs | 2 -- .../UseExplicitTupleNameCodeFixProvider.cs | 2 -- .../AbstractUseInferredMemberNameCodeFixProvider.cs | 2 -- .../AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs | 2 -- .../AbstractUseNullPropagationCodeFixProvider.cs | 2 -- .../AbstractUseObjectInitializerCodeFixProvider.cs | 2 -- .../UseSystemHashCode/UseSystemHashCodeCodeFixProvider.cs | 3 --- .../UseThrowExpression/UseThrowExpressionCodeFixProvider.cs | 2 -- .../VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb | 2 -- .../VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb | 6 ------ .../VisualBasicSimplifyObjectCreationCodeFixProvider.vb | 2 -- .../VisualBasicUseIsNotExpressionCodeFixProvider.vb | 2 -- 63 files changed, 136 deletions(-) diff --git a/src/Analyzers/CSharp/CodeFixes/AddBraces/CSharpAddBracesCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/AddBraces/CSharpAddBracesCodeFixProvider.cs index d137b4a34b012..9d97e81df37fc 100644 --- a/src/Analyzers/CSharp/CodeFixes/AddBraces/CSharpAddBracesCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/AddBraces/CSharpAddBracesCodeFixProvider.cs @@ -32,8 +32,6 @@ public CSharpAddBracesCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.AddBracesDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( diff --git a/src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs index 23f3c9dd11369..22408004fec96 100644 --- a/src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs @@ -31,8 +31,6 @@ internal class ConvertNamespaceCodeFixProvider : SyntaxEditorBasedCodeFixProvide public ConvertNamespaceCodeFixProvider() { } - - internal override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseBlockScopedNamespaceDiagnosticId, IDEDiagnosticIds.UseFileScopedNamespaceDiagnosticId); diff --git a/src/Analyzers/CSharp/CodeFixes/ConvertSwitchStatementToExpression/ConvertSwitchStatementToExpressionCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/ConvertSwitchStatementToExpression/ConvertSwitchStatementToExpressionCodeFixProvider.cs index c648b541302cf..373b735e8a99b 100644 --- a/src/Analyzers/CSharp/CodeFixes/ConvertSwitchStatementToExpression/ConvertSwitchStatementToExpressionCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/ConvertSwitchStatementToExpression/ConvertSwitchStatementToExpressionCodeFixProvider.cs @@ -38,8 +38,6 @@ public ConvertSwitchStatementToExpressionCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.ConvertSwitchStatementToExpressionDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { var switchLocation = context.Diagnostics.First().AdditionalLocations[0]; diff --git a/src/Analyzers/CSharp/CodeFixes/InlineDeclaration/CSharpInlineDeclarationCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/InlineDeclaration/CSharpInlineDeclarationCodeFixProvider.cs index b7219ae686992..2dd7c8d841248 100644 --- a/src/Analyzers/CSharp/CodeFixes/InlineDeclaration/CSharpInlineDeclarationCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/InlineDeclaration/CSharpInlineDeclarationCodeFixProvider.cs @@ -47,8 +47,6 @@ public CSharpInlineDeclarationCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.InlineDeclarationDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs index e51cafabec0d7..8ad1a0deae791 100644 --- a/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs @@ -33,8 +33,6 @@ public InvokeDelegateWithConditionalAccessCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.InvokeDelegateWithConditionalAccessId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - // Filter out the diagnostics we created for the faded out code. We don't want // to try to fix those as well as the normal diagnostics we created. protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) diff --git a/src/Analyzers/CSharp/CodeFixes/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableCodeFixProvider.cs index 584bff79be040..4589db37d1033 100644 --- a/src/Analyzers/CSharp/CodeFixes/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableCodeFixProvider.cs @@ -32,8 +32,6 @@ public CSharpMakeStructFieldsWritableCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.MakeStructFieldsWritable); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeQuality; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryCast/CSharpRemoveUnnecessaryCastCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryCast/CSharpRemoveUnnecessaryCastCodeFixProvider.cs index 69309be37e093..8274c3447015c 100644 --- a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryCast/CSharpRemoveUnnecessaryCastCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryCast/CSharpRemoveUnnecessaryCastCodeFixProvider.cs @@ -36,8 +36,6 @@ public CSharpRemoveUnnecessaryCastCodeFixProvider() public sealed override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.RemoveUnnecessaryCastDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryDiscardDesignation/CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryDiscardDesignation/CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs index 5642f196cd1fa..51a563474c861 100644 --- a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryDiscardDesignation/CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryDiscardDesignation/CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs @@ -33,8 +33,6 @@ public CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.RemoveUnnecessaryDiscardDesignationDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); diff --git a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryLambdaExpression/CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryLambdaExpression/CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs index d5f32eb3fb2bc..42e754fbb80e1 100644 --- a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryLambdaExpression/CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryLambdaExpression/CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs @@ -34,8 +34,6 @@ public CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.RemoveUnnecessaryLambdaExpressionDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( diff --git a/src/Analyzers/CSharp/CodeFixes/RemoveUnreachableCode/CSharpRemoveUnreachableCodeCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/RemoveUnreachableCode/CSharpRemoveUnreachableCodeCodeFixProvider.cs index 1d74d5c70b02b..5538e6eb7ff66 100644 --- a/src/Analyzers/CSharp/CodeFixes/RemoveUnreachableCode/CSharpRemoveUnreachableCodeCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/RemoveUnreachableCode/CSharpRemoveUnreachableCodeCodeFixProvider.cs @@ -33,8 +33,6 @@ public CSharpRemoveUnreachableCodeCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.RemoveUnreachableCodeDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeQuality; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics[0]; diff --git a/src/Analyzers/CSharp/CodeFixes/SimplifyPropertyPattern/CSharpSimplifyPropertyPatternCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/SimplifyPropertyPattern/CSharpSimplifyPropertyPatternCodeFixProvider.cs index 0db665fb9fc1c..61ed86c7fbe7f 100644 --- a/src/Analyzers/CSharp/CodeFixes/SimplifyPropertyPattern/CSharpSimplifyPropertyPatternCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/SimplifyPropertyPattern/CSharpSimplifyPropertyPatternCodeFixProvider.cs @@ -34,8 +34,6 @@ public CSharpSimplifyPropertyPatternCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.SimplifyPropertyPatternDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/TransposeRecordKeyword/CSharpTransposeRecordKeywordCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/TransposeRecordKeyword/CSharpTransposeRecordKeywordCodeFixProvider.cs index 069f6e147be94..c19c14d8a628f 100644 --- a/src/Analyzers/CSharp/CodeFixes/TransposeRecordKeyword/CSharpTransposeRecordKeywordCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/TransposeRecordKeyword/CSharpTransposeRecordKeywordCodeFixProvider.cs @@ -32,9 +32,6 @@ public CSharpTransposeRecordKeywordCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(CS9012); - internal override CodeFixCategory CodeFixCategory - => CodeFixCategory.Compile; - private static bool TryGetRecordDeclaration( Diagnostic diagnostic, CancellationToken cancellationToken, [NotNullWhen(true)] out RecordDeclarationSyntax? recordDeclaration) { diff --git a/src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs index fbebb1082c7d4..de1ba38635c05 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs @@ -31,8 +31,6 @@ public CSharpUseCompoundCoalesceAssignmentCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.UseCoalesceCompoundAssignmentDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; diff --git a/src/Analyzers/CSharp/CodeFixes/UseDeconstruction/CSharpUseDeconstructionCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseDeconstruction/CSharpUseDeconstructionCodeFixProvider.cs index f3cbd2965bf58..01cd9955a39d1 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseDeconstruction/CSharpUseDeconstructionCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseDeconstruction/CSharpUseDeconstructionCodeFixProvider.cs @@ -34,8 +34,6 @@ public CSharpUseDeconstructionCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseDeconstructionDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( diff --git a/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs index 3b25dde36faef..b72d9e7b09bd6 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs @@ -35,8 +35,6 @@ public CSharpUseDefaultLiteralCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.UseDefaultLiteralDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/UseExpressionBody/UseExpressionBodyCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseExpressionBody/UseExpressionBodyCodeFixProvider.cs index eee0034fba488..d84665dbaeb8b 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseExpressionBody/UseExpressionBodyCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseExpressionBody/UseExpressionBodyCodeFixProvider.cs @@ -27,8 +27,6 @@ internal partial class UseExpressionBodyCodeFixProvider : SyntaxEditorBasedCodeF { public sealed override ImmutableArray FixableDiagnosticIds { get; } - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - private static readonly ImmutableArray _helpers = UseExpressionBodyHelper.Helpers; [ImportingConstructor] diff --git a/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs index a8d67d3d24a1d..ab7463f40ab3c 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs @@ -33,8 +33,6 @@ public CSharpUseImplicitObjectCreationCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseImplicitObjectCreationDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) => !diagnostic.IsSuppressed; diff --git a/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseExplicitTypeCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseExplicitTypeCodeFixProvider.cs index abdfb11cf27e6..3b7508506e5ea 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseExplicitTypeCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseExplicitTypeCodeFixProvider.cs @@ -35,8 +35,6 @@ public UseExplicitTypeCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseExplicitTypeDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseImplicitTypeCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseImplicitTypeCodeFixProvider.cs index ba9d48d17ee40..95b776c1e364a 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseImplicitTypeCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseImplicitTypeCodeFixProvider.cs @@ -33,8 +33,6 @@ public UseImplicitTypeCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseImplicitTypeDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( diff --git a/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseIndexOperatorCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseIndexOperatorCodeFixProvider.cs index 75b429ac0e901..e3ebdf74ae9f6 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseIndexOperatorCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseIndexOperatorCodeFixProvider.cs @@ -34,8 +34,6 @@ public CSharpUseIndexOperatorCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.UseIndexOperatorDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseRangeOperatorCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseRangeOperatorCodeFixProvider.cs index 4d33644bc22d6..b481faf807eb7 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseRangeOperatorCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseRangeOperatorCodeFixProvider.cs @@ -39,8 +39,6 @@ public CSharpUseRangeOperatorCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.UseRangeOperatorDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs index 2ca0c12fc87cc..cf99552eb8019 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs @@ -35,8 +35,6 @@ public CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseIsNullCheckDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - private static bool IsSupportedDiagnostic(Diagnostic diagnostic) => diagnostic.Properties[UseIsNullConstants.Kind] == UseIsNullConstants.CastAndEqualityKey; diff --git a/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs index d588e3941ec53..a6cf1401a8875 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs @@ -35,8 +35,6 @@ public CSharpUseNullCheckOverTypeCheckCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseNullCheckOverTypeCheckDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); diff --git a/src/Analyzers/CSharp/CodeFixes/UseParameterNullChecking/CSharpUseParameterNullCheckingCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseParameterNullChecking/CSharpUseParameterNullCheckingCodeFixProvider.cs index 3b3badcacc4e8..be70fadf101b2 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseParameterNullChecking/CSharpUseParameterNullCheckingCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseParameterNullChecking/CSharpUseParameterNullCheckingCodeFixProvider.cs @@ -33,8 +33,6 @@ public CSharpUseParameterNullCheckingCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseParameterNullCheckingId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics[0]; diff --git a/src/Analyzers/CSharp/CodeFixes/UsePatternCombinators/CSharpUsePatternCombinatorsCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UsePatternCombinators/CSharpUsePatternCombinatorsCodeFixProvider.cs index 8dff5954c094b..21c3a8aeecd19 100644 --- a/src/Analyzers/CSharp/CodeFixes/UsePatternCombinators/CSharpUsePatternCombinatorsCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePatternCombinators/CSharpUsePatternCombinatorsCodeFixProvider.cs @@ -54,8 +54,6 @@ private static SyntaxKind MapToSyntaxKind(BinaryOperatorKind kind) public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UsePatternCombinatorsDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected override bool IncludeDiagnosticDuringFixAll( Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) { diff --git a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs index 8a18396dd7340..c95bf01481667 100644 --- a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs @@ -35,8 +35,6 @@ public CSharpAsAndNullCheckCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.InlineAsTypeCheckId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpIsAndCastCheckCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpIsAndCastCheckCodeFixProvider.cs index 195c4b6dfae69..0bd39de79a50e 100644 --- a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpIsAndCastCheckCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpIsAndCastCheckCodeFixProvider.cs @@ -35,8 +35,6 @@ public CSharpIsAndCastCheckCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.InlineIsTypeCheckId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpUseNotPatternCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpUseNotPatternCodeFixProvider.cs index eff776debdf9b..d27e1c0d1b5b9 100644 --- a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpUseNotPatternCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpUseNotPatternCodeFixProvider.cs @@ -32,8 +32,6 @@ public CSharpUseNotPatternCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseNotPatternDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs index b5f0be3a94cfa..cdfa96f2030cf 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs @@ -39,8 +39,6 @@ public UseSimpleUsingStatementCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.UseSimpleUsingStatementDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/CSharp/CodeFixes/UseTupleSwap/CSharpUseTupleSwapCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseTupleSwap/CSharpUseTupleSwapCodeFixProvider.cs index 0eb78ed1f3d54..e61c3fa4744b7 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseTupleSwap/CSharpUseTupleSwapCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseTupleSwap/CSharpUseTupleSwapCodeFixProvider.cs @@ -35,8 +35,6 @@ public CSharpUseTupleSwapCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.UseTupleSwapDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/Core/CodeFixes/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersCodeFixProvider.cs index 653b69703b24c..e78fa1d48c6d9 100644 --- a/src/Analyzers/Core/CodeFixes/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/AddAccessibilityModifiers/AbstractAddAccessibilityModifiersCodeFixProvider.cs @@ -23,8 +23,6 @@ internal abstract class AbstractAddAccessibilityModifiersCodeFixProvider : Synta public sealed override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.AddAccessibilityModifiersDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); diff --git a/src/Analyzers/Core/CodeFixes/AddRequiredParentheses/AddRequiredParenthesesCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/AddRequiredParentheses/AddRequiredParenthesesCodeFixProvider.cs index f381b917e35a2..3098f0ab1180b 100644 --- a/src/Analyzers/Core/CodeFixes/AddRequiredParentheses/AddRequiredParenthesesCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/AddRequiredParentheses/AddRequiredParenthesesCodeFixProvider.cs @@ -28,8 +28,6 @@ public AddRequiredParenthesesCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.AddRequiredParenthesesDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic, Document document, string? equivalenceKey, CancellationToken cancellationToken) => diagnostic.Properties.ContainsKey(AddRequiredParenthesesConstants.IncludeInFixAll) && diagnostic.Properties[AddRequiredParenthesesConstants.EquivalenceKey] == equivalenceKey; diff --git a/src/Analyzers/Core/CodeFixes/ConvertTypeOfToNameOf/AbstractConvertTypeOfToNameOfCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/ConvertTypeOfToNameOf/AbstractConvertTypeOfToNameOfCodeFixProvider.cs index e5874726f07de..118796b8f186e 100644 --- a/src/Analyzers/Core/CodeFixes/ConvertTypeOfToNameOf/AbstractConvertTypeOfToNameOfCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/ConvertTypeOfToNameOf/AbstractConvertTypeOfToNameOfCodeFixProvider.cs @@ -20,8 +20,6 @@ internal abstract class AbstractConvertTypeOfToNameOfCodeFixProvider : SyntaxEdi { public sealed override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.ConvertTypeOfToNameOfDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs index 66ce04cb44d1c..08e7593b267ff 100644 --- a/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs @@ -26,8 +26,6 @@ internal abstract class AbstractMakeFieldReadonlyCodeFixProvider FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.MakeFieldReadonlyDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeQuality; - protected abstract SyntaxNode GetInitializerNode(TSymbolSyntax declaration); protected abstract ImmutableList GetVariableDeclarators(TFieldDeclarationSyntax declaration); diff --git a/src/Analyzers/Core/CodeFixes/OrderModifiers/AbstractOrderModifiersCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/OrderModifiers/AbstractOrderModifiersCodeFixProvider.cs index dd65e23df21c8..fd2a8bb32a8f3 100644 --- a/src/Analyzers/Core/CodeFixes/OrderModifiers/AbstractOrderModifiersCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/OrderModifiers/AbstractOrderModifiersCodeFixProvider.cs @@ -40,8 +40,6 @@ protected AbstractOrderModifiersCodeFixProvider( public sealed override ImmutableArray FixableDiagnosticIds => FixableCompilerErrorIds.Add(IDEDiagnosticIds.OrderModifiersDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var syntaxTree = await context.Document.GetRequiredSyntaxTreeAsync(context.CancellationToken).ConfigureAwait(false); diff --git a/src/Analyzers/Core/CodeFixes/PopulateSwitch/AbstractPopulateSwitchCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/PopulateSwitch/AbstractPopulateSwitchCodeFixProvider.cs index 3968a0d2c709e..0cb1d3b361882 100644 --- a/src/Analyzers/Core/CodeFixes/PopulateSwitch/AbstractPopulateSwitchCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/PopulateSwitch/AbstractPopulateSwitchCodeFixProvider.cs @@ -50,8 +50,6 @@ protected abstract void FixOneDiagnostic( bool hasMissingCases, bool hasMissingDefaultCase, TSwitchSyntax switchNode, TSwitchOperation switchOperation); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Custom; - public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); diff --git a/src/Analyzers/Core/CodeFixes/QualifyMemberAccess/AbstractQualifyMemberAccessCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/QualifyMemberAccess/AbstractQualifyMemberAccessCodeFixProvider.cs index 1651e6376a2ec..3800dba1d46f9 100644 --- a/src/Analyzers/Core/CodeFixes/QualifyMemberAccess/AbstractQualifyMemberAccessCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/QualifyMemberAccess/AbstractQualifyMemberAccessCodeFixProvider.cs @@ -24,8 +24,6 @@ internal abstract class AbstractQualifyMemberAccessCodeFixprovider FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.AddQualificationDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/Core/CodeFixes/RemoveRedundantEquality/RemoveRedundantEqualityCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveRedundantEquality/RemoveRedundantEqualityCodeFixProvider.cs index 5439d8e62fe55..dc06e6b518c90 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveRedundantEquality/RemoveRedundantEqualityCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveRedundantEquality/RemoveRedundantEqualityCodeFixProvider.cs @@ -30,8 +30,6 @@ public RemoveRedundantEqualityCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.RemoveRedundantEqualityDiagnosticId); - internal override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { foreach (var diagnostic in context.Diagnostics) diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesCodeFixProvider.cs index 1a3d1af29c3fc..8444e2b14ba92 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesCodeFixProvider.cs @@ -22,8 +22,6 @@ internal abstract class AbstractRemoveUnnecessaryParenthesesCodeFixProvider FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.RemoveUnnecessaryParenthesesDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected abstract bool CanRemoveParentheses( TParenthesizedExpressionSyntax current, SemanticModel semanticModel, CancellationToken cancellationToken); diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs index a32e49f2c2681..2d4ab370fd174 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs @@ -28,9 +28,6 @@ public RemoveUnnecessaryAttributeSuppressionsCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.InvalidSuppressMessageAttributeDiagnosticId); - internal override CodeFixCategory CodeFixCategory - => CodeFixCategory.CodeQuality; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs index b88b1acb6a3df..eb7afd7f56f29 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs @@ -33,9 +33,6 @@ public RemoveUnnecessaryInlineSuppressionsCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.RemoveUnnecessarySuppressionDiagnosticId); - internal override CodeFixCategory CodeFixCategory - => CodeFixCategory.CodeQuality; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs index 7bcdd977308fe..ded56b472ca8a 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs @@ -25,8 +25,6 @@ internal abstract class AbstractRemoveUnusedMembersCodeFixProvider FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.RemoveUnusedMembersDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeQuality; - /// /// This method adjusts the to remove based on whether or not all variable declarators /// within a field declaration should be removed, diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs index 5fb59a2c445c0..2098335064734 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs @@ -64,8 +64,6 @@ public sealed override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.ExpressionValueIsUnusedDiagnosticId, IDEDiagnosticIds.ValueAssignedIsUnusedDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeQuality; - #if CODE_STYLE protected abstract ISyntaxFormatting GetSyntaxFormatting(); #endif diff --git a/src/Analyzers/Core/CodeFixes/SimplifyBooleanExpression/SimplifyConditionalCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/SimplifyBooleanExpression/SimplifyConditionalCodeFixProvider.cs index 5603d7eadd6ca..9602b413c003e 100644 --- a/src/Analyzers/Core/CodeFixes/SimplifyBooleanExpression/SimplifyConditionalCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/SimplifyBooleanExpression/SimplifyConditionalCodeFixProvider.cs @@ -32,9 +32,6 @@ public SimplifyConditionalCodeFixProvider() public sealed override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.SimplifyConditionalExpressionDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory - => CodeFixCategory.CodeQuality; - public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/Core/CodeFixes/SimplifyInterpolation/AbstractSimplifyInterpolationCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/SimplifyInterpolation/AbstractSimplifyInterpolationCodeFixProvider.cs index 11826a68d818b..963a414d5764b 100644 --- a/src/Analyzers/Core/CodeFixes/SimplifyInterpolation/AbstractSimplifyInterpolationCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/SimplifyInterpolation/AbstractSimplifyInterpolationCodeFixProvider.cs @@ -33,8 +33,6 @@ internal abstract class AbstractSimplifyInterpolationCodeFixProvider< public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.SimplifyInterpolationId); - internal override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected abstract AbstractSimplifyInterpolationHelpers GetHelpers(); protected abstract TInterpolationSyntax WithExpression(TInterpolationSyntax interpolation, TExpressionSyntax expression); diff --git a/src/Analyzers/Core/CodeFixes/SimplifyLinqExpression/AbstractSimplifyLinqExpressionCodeFixProvider`3.cs b/src/Analyzers/Core/CodeFixes/SimplifyLinqExpression/AbstractSimplifyLinqExpressionCodeFixProvider`3.cs index e4470516c8738..a46cbfacc40b4 100644 --- a/src/Analyzers/Core/CodeFixes/SimplifyLinqExpression/AbstractSimplifyLinqExpressionCodeFixProvider`3.cs +++ b/src/Analyzers/Core/CodeFixes/SimplifyLinqExpression/AbstractSimplifyLinqExpressionCodeFixProvider`3.cs @@ -25,8 +25,6 @@ internal abstract class AbstractSimplifyLinqExpressionCodeFixProvider FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.SimplifyLinqExpressionDiagnosticId); - internal override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeQuality; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/Core/CodeFixes/UpdateLegacySuppressions/UpdateLegacySuppressionsCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UpdateLegacySuppressions/UpdateLegacySuppressionsCodeFixProvider.cs index c0698b2b73192..c9ff7acfb47c9 100644 --- a/src/Analyzers/Core/CodeFixes/UpdateLegacySuppressions/UpdateLegacySuppressionsCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UpdateLegacySuppressions/UpdateLegacySuppressionsCodeFixProvider.cs @@ -29,9 +29,6 @@ public UpdateLegacySuppressionsCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.LegacyFormatSuppressMessageAttributeDiagnosticId); - internal override CodeFixCategory CodeFixCategory - => CodeFixCategory.CodeQuality; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var root = await context.Document.GetRequiredSyntaxRootAsync(context.CancellationToken).ConfigureAwait(false); diff --git a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionCodeFixProvider.cs index f572e087a4fe9..28b1ce648075d 100644 --- a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionCodeFixProvider.cs @@ -30,8 +30,6 @@ public UseCoalesceExpressionCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseCoalesceExpressionDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); diff --git a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableCodeFixProvider.cs index b189fa68e52b1..e637ffbe5be59 100644 --- a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableCodeFixProvider.cs @@ -29,8 +29,6 @@ public UseCoalesceExpressionForNullableCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseCoalesceExpressionForNullableDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); diff --git a/src/Analyzers/Core/CodeFixes/UseCollectionInitializer/AbstractUseCollectionInitializerCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseCollectionInitializer/AbstractUseCollectionInitializerCodeFixProvider.cs index b06948430ce62..30cf4e5ab1441 100644 --- a/src/Analyzers/Core/CodeFixes/UseCollectionInitializer/AbstractUseCollectionInitializerCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseCollectionInitializer/AbstractUseCollectionInitializerCodeFixProvider.cs @@ -41,8 +41,6 @@ internal abstract class AbstractUseCollectionInitializerCodeFixProvider< public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseCollectionInitializerDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); diff --git a/src/Analyzers/Core/CodeFixes/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs index 07a38d48f5d2f..5d506744a74c8 100644 --- a/src/Analyzers/Core/CodeFixes/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs @@ -25,8 +25,6 @@ internal abstract class AbstractUseCompoundAssignmentCodeFixProvider< public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.UseCompoundAssignmentDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - // See comments in the analyzer for what these maps are for. private readonly ImmutableDictionary _binaryToAssignmentMap; diff --git a/src/Analyzers/Core/CodeFixes/UseConditionalExpression/AbstractUseConditionalExpressionCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseConditionalExpression/AbstractUseConditionalExpressionCodeFixProvider.cs index f986ec870e774..4732c77cee13d 100644 --- a/src/Analyzers/Core/CodeFixes/UseConditionalExpression/AbstractUseConditionalExpressionCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseConditionalExpression/AbstractUseConditionalExpressionCodeFixProvider.cs @@ -35,8 +35,6 @@ internal abstract class AbstractUseConditionalExpressionCodeFixProvider< where TExpressionSyntax : SyntaxNode where TConditionalExpressionSyntax : TExpressionSyntax { - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected abstract ISyntaxFacts SyntaxFacts { get; } protected abstract AbstractFormattingRule GetMultiLineFormattingRule(); diff --git a/src/Analyzers/Core/CodeFixes/UseExplicitTupleName/UseExplicitTupleNameCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseExplicitTupleName/UseExplicitTupleNameCodeFixProvider.cs index f38c06d61765b..c8271ef751b68 100644 --- a/src/Analyzers/Core/CodeFixes/UseExplicitTupleName/UseExplicitTupleNameCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseExplicitTupleName/UseExplicitTupleNameCodeFixProvider.cs @@ -29,8 +29,6 @@ public UseExplicitTupleNameCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.UseExplicitTupleNameDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/Core/CodeFixes/UseInferredMemberName/AbstractUseInferredMemberNameCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseInferredMemberName/AbstractUseInferredMemberNameCodeFixProvider.cs index d0fe865eaa397..e9db689b6ee9d 100644 --- a/src/Analyzers/Core/CodeFixes/UseInferredMemberName/AbstractUseInferredMemberNameCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseInferredMemberName/AbstractUseInferredMemberNameCodeFixProvider.cs @@ -22,8 +22,6 @@ internal abstract class AbstractUseInferredMemberNameCodeFixProvider : SyntaxEdi public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.UseInferredMemberNameDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Analyzers/Core/CodeFixes/UseIsNullCheck/AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseIsNullCheck/AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs index fac3945add703..29266e98095ee 100644 --- a/src/Analyzers/Core/CodeFixes/UseIsNullCheck/AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseIsNullCheck/AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs @@ -24,8 +24,6 @@ internal abstract class AbstractUseIsNullCheckForReferenceEqualsCodeFixProvider< public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseIsNullCheckDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected abstract string GetTitle(bool negated, ParseOptions options); protected abstract SyntaxNode CreateNullCheck(TExpressionSyntax argument, bool isUnconstrainedGeneric); diff --git a/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs index 1b2a2737bf937..325b44e11577e 100644 --- a/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs @@ -45,8 +45,6 @@ internal abstract class AbstractUseNullPropagationCodeFixProvider< public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseNullPropagationDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); diff --git a/src/Analyzers/Core/CodeFixes/UseObjectInitializer/AbstractUseObjectInitializerCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseObjectInitializer/AbstractUseObjectInitializerCodeFixProvider.cs index c242651cf9215..ed79af014c3bd 100644 --- a/src/Analyzers/Core/CodeFixes/UseObjectInitializer/AbstractUseObjectInitializerCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseObjectInitializer/AbstractUseObjectInitializerCodeFixProvider.cs @@ -39,8 +39,6 @@ internal abstract class AbstractUseObjectInitializerCodeFixProvider< public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseObjectInitializerDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); diff --git a/src/Analyzers/Core/CodeFixes/UseSystemHashCode/UseSystemHashCodeCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseSystemHashCode/UseSystemHashCodeCodeFixProvider.cs index fcb56ab24908b..fcd2a9d8956b2 100644 --- a/src/Analyzers/Core/CodeFixes/UseSystemHashCode/UseSystemHashCodeCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseSystemHashCode/UseSystemHashCodeCodeFixProvider.cs @@ -30,9 +30,6 @@ public UseSystemHashCodeCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.UseSystemHashCode); - internal override CodeFixCategory CodeFixCategory { get; } - = CodeFixCategory.CodeQuality; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; diff --git a/src/Analyzers/Core/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs index 80242b963c701..ca9f1ff663360 100644 --- a/src/Analyzers/Core/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs @@ -31,8 +31,6 @@ public UseThrowExpressionCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseThrowExpressionDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) => !diagnostic.Descriptor.ImmutableCustomTags().Contains(WellKnownDiagnosticTags.Unnecessary); diff --git a/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryByVal/VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryByVal/VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb index bd730f1af920b..82de49db13484 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryByVal/VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryByVal/VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb @@ -26,8 +26,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryByVal Public Overrides ReadOnly Property FixableDiagnosticIds As ImmutableArray(Of String) = ImmutableArray.Create(IDEDiagnosticIds.RemoveUnnecessaryByValDiagnosticId) - Friend Overrides ReadOnly Property CodeFixCategory As CodeFixCategory = CodeFixCategory.CodeStyle - Public Overrides Function RegisterCodeFixesAsync(context As CodeFixContext) As Task For Each diagnostic In context.Diagnostics context.RegisterCodeFix(New MyCodeAction( diff --git a/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryCast/VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryCast/VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb index 9b168e1c56811..10059e139b180 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryCast/VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryCast/VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb @@ -30,12 +30,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryCast Public NotOverridable Overrides ReadOnly Property FixableDiagnosticIds As ImmutableArray(Of String) = ImmutableArray.Create(IDEDiagnosticIds.RemoveUnnecessaryCastDiagnosticId) - Friend NotOverridable Overrides ReadOnly Property CodeFixCategory As CodeFixCategory - Get - Return CodeFixCategory.CodeStyle - End Get - End Property - Public Overrides Function RegisterCodeFixesAsync(context As CodeFixContext) As Task context.RegisterCodeFix(New MyCodeAction( Function(c) FixAsync(context.Document, context.Diagnostics.First(), c)), diff --git a/src/Analyzers/VisualBasic/CodeFixes/SimplifyObjectCreation/VisualBasicSimplifyObjectCreationCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/SimplifyObjectCreation/VisualBasicSimplifyObjectCreationCodeFixProvider.vb index caf3cc969f0c6..e9017da936990 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/SimplifyObjectCreation/VisualBasicSimplifyObjectCreationCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/SimplifyObjectCreation/VisualBasicSimplifyObjectCreationCodeFixProvider.vb @@ -24,8 +24,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SimplifyObjectCreation Public Overrides ReadOnly Property FixableDiagnosticIds As ImmutableArray(Of String) = ImmutableArray.Create(IDEDiagnosticIds.SimplifyObjectCreationDiagnosticId) - Friend Overrides ReadOnly Property CodeFixCategory As CodeFixCategory = CodeFixCategory.CodeStyle - Public Overrides Function RegisterCodeFixesAsync(context As CodeFixContext) As Task For Each diagnostic In context.Diagnostics context.RegisterCodeFix(New MyCodeAction( diff --git a/src/Analyzers/VisualBasic/CodeFixes/UseIsNotExpression/VisualBasicUseIsNotExpressionCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/UseIsNotExpression/VisualBasicUseIsNotExpressionCodeFixProvider.vb index 9c2d3c88b0f55..6bc3cc829269f 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/UseIsNotExpression/VisualBasicUseIsNotExpressionCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/UseIsNotExpression/VisualBasicUseIsNotExpressionCodeFixProvider.vb @@ -25,8 +25,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UseIsNotExpression Public Overrides ReadOnly Property FixableDiagnosticIds As ImmutableArray(Of String) = ImmutableArray.Create(IDEDiagnosticIds.UseIsNotExpressionDiagnosticId) - Friend Overrides ReadOnly Property CodeFixCategory As CodeFixCategory = CodeFixCategory.CodeStyle - Public Overrides Function RegisterCodeFixesAsync(context As CodeFixContext) As Task context.RegisterCodeFix(New MyCodeAction( Function(c) FixAsync(context.Document, context.Diagnostics.First(), c)), From 66098907890ed9dbde22f8aa6cdef2d6dd1e2254 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Sat, 2 Apr 2022 17:47:03 +0200 Subject: [PATCH 111/131] Remove overrides in Features --- .../AbstractAssignOutParametersCodeFixProvider.cs | 2 -- .../CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs | 2 -- .../FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs | 2 -- .../CSharpMakeStatementAsynchronousCodeFixProvider.cs | 2 -- .../Nullable/CSharpDeclareAsNullableCodeFixProvider.cs | 2 -- .../CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs | 2 -- .../CSharpDisambiguateSameVariableCodeFixProvider.cs | 3 --- .../MakeLocalFunctionStaticCodeFixProvider.cs | 2 -- .../PassInCapturedVariablesAsArgumentsCodeFixProvider.cs | 2 -- .../CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs | 2 -- .../UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs | 2 -- .../CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs | 2 -- .../AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs | 2 -- .../AbstractAddObsoleteAttributeCodeFixProvider.cs | 2 -- .../AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs | 2 -- .../Portable/CodeStyle/AbstractCodeStyleProvider.Fixing.cs | 2 -- .../LanguageServices/AbstractJsonDetectionCodeFixProvider.cs | 2 -- .../Core/Portable/Formatting/FormattingCodeFixProvider.cs | 2 -- .../AbstractMakeTypeAbstractCodeFixProvider.cs | 2 -- .../AbstractMakeMemberStaticCodeFixProvider.cs | 2 -- .../PreferFrameworkType/PreferFrameworkTypeCodeFixProvider.cs | 2 -- .../AbstractRemoveAsyncModifierCodeFixProvider.cs | 2 -- .../AbstractRemoveUnusedVariableCodeFixProvider.cs | 2 -- .../AbstractSimplifyThisOrMeCodeFixProvider.cs | 2 -- .../AbstractSimplifyTypeNamesCodeFixProvider.cs | 2 -- .../VisualBasicRemoveSharedFromModuleMembersCodeFixProvider.vb | 2 -- 26 files changed, 53 deletions(-) diff --git a/src/Features/CSharp/Portable/AssignOutParameters/AbstractAssignOutParametersCodeFixProvider.cs b/src/Features/CSharp/Portable/AssignOutParameters/AbstractAssignOutParametersCodeFixProvider.cs index 450c71e631c62..6ed8324636798 100644 --- a/src/Features/CSharp/Portable/AssignOutParameters/AbstractAssignOutParametersCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/AssignOutParameters/AbstractAssignOutParametersCodeFixProvider.cs @@ -28,8 +28,6 @@ internal abstract class AbstractAssignOutParametersCodeFixProvider : SyntaxEdito public sealed override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(CS0177); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile; - public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) { var cancellationToken = context.CancellationToken; diff --git a/src/Features/CSharp/Portable/CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs b/src/Features/CSharp/Portable/CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs index a400321dc60b8..11f916f8722d1 100644 --- a/src/Features/CSharp/Portable/CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/CodeFixes/AddInheritdoc/AddInheritdocCodeFixProvider.cs @@ -41,8 +41,6 @@ public AddInheritdocCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(CS1591); - internal override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; diff --git a/src/Features/CSharp/Portable/CodeFixes/FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs b/src/Features/CSharp/Portable/CodeFixes/FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs index 9a34aa77c5a5a..bcd70a639da1b 100644 --- a/src/Features/CSharp/Portable/CodeFixes/FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/CodeFixes/FixReturnType/CSharpFixReturnTypeCodeFixProvider.cs @@ -39,8 +39,6 @@ public CSharpFixReturnTypeCodeFixProvider() { } - internal override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; diff --git a/src/Features/CSharp/Portable/CodeFixes/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixProvider.cs b/src/Features/CSharp/Portable/CodeFixes/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixProvider.cs index 5954268d1726a..f7ab582f2d4e9 100644 --- a/src/Features/CSharp/Portable/CodeFixes/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/CodeFixes/MakeStatementAsynchronous/CSharpMakeStatementAsynchronousCodeFixProvider.cs @@ -34,8 +34,6 @@ public CSharpMakeStatementAsynchronousCodeFixProvider() // error CS8418: 'IAsyncDisposable': type used in a using statement must be implicitly convertible to 'System.IDisposable'. Did you mean 'await using' rather than 'using'? public sealed override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create("CS8414", "CS8418"); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); diff --git a/src/Features/CSharp/Portable/CodeFixes/Nullable/CSharpDeclareAsNullableCodeFixProvider.cs b/src/Features/CSharp/Portable/CodeFixes/Nullable/CSharpDeclareAsNullableCodeFixProvider.cs index a332643629287..24eb36fa2a840 100644 --- a/src/Features/CSharp/Portable/CodeFixes/Nullable/CSharpDeclareAsNullableCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/CodeFixes/Nullable/CSharpDeclareAsNullableCodeFixProvider.cs @@ -44,8 +44,6 @@ public CSharpDeclareAsNullableCodeFixProvider() // warning CS8618: Non-nullable property is uninitialized public sealed override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create("CS8603", "CS8600", "CS8625", "CS8618"); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); diff --git a/src/Features/CSharp/Portable/CodeFixes/UseInterpolatedVerbatimString/CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs b/src/Features/CSharp/Portable/CodeFixes/UseInterpolatedVerbatimString/CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs index fbeabc2b41b9e..4f61fe029862e 100644 --- a/src/Features/CSharp/Portable/CodeFixes/UseInterpolatedVerbatimString/CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/CodeFixes/UseInterpolatedVerbatimString/CSharpUseInterpolatedVerbatimStringCodeFixProvider.cs @@ -35,8 +35,6 @@ public CSharpUseInterpolatedVerbatimStringCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create("CS8401"); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - private const string InterpolatedVerbatimText = "$@\""; public override Task RegisterCodeFixesAsync(CodeFixContext context) diff --git a/src/Features/CSharp/Portable/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs b/src/Features/CSharp/Portable/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs index 37eda381c1831..852be55ded761 100644 --- a/src/Features/CSharp/Portable/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/DisambiguateSameVariable/CSharpDisambiguateSameVariableCodeFixProvider.cs @@ -39,9 +39,6 @@ public CSharpDisambiguateSameVariableCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(CS1717, CS1718); - internal override CodeFixCategory CodeFixCategory - => CodeFixCategory.Compile; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; diff --git a/src/Features/CSharp/Portable/MakeLocalFunctionStatic/MakeLocalFunctionStaticCodeFixProvider.cs b/src/Features/CSharp/Portable/MakeLocalFunctionStatic/MakeLocalFunctionStaticCodeFixProvider.cs index 3e058351eef3c..d987d0c642bb4 100644 --- a/src/Features/CSharp/Portable/MakeLocalFunctionStatic/MakeLocalFunctionStaticCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/MakeLocalFunctionStatic/MakeLocalFunctionStaticCodeFixProvider.cs @@ -30,8 +30,6 @@ public MakeLocalFunctionStaticCodeFixProvider() public override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.MakeLocalFunctionStaticDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeQuality; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix(new MyCodeAction( diff --git a/src/Features/CSharp/Portable/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProvider.cs b/src/Features/CSharp/Portable/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProvider.cs index e82692de0fcc7..6ab2eb858e8c9 100644 --- a/src/Features/CSharp/Portable/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/MakeLocalFunctionStatic/PassInCapturedVariablesAsArgumentsCodeFixProvider.cs @@ -30,8 +30,6 @@ public PassInCapturedVariablesAsArgumentsCodeFixProvider() // "CS8421: A static local function can't contain a reference to ." public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create("CS8421"); - internal override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); diff --git a/src/Features/CSharp/Portable/RemoveUnusedLocalFunction/CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs b/src/Features/CSharp/Portable/RemoveUnusedLocalFunction/CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs index e36b3845a235a..815fb2eba8d64 100644 --- a/src/Features/CSharp/Portable/RemoveUnusedLocalFunction/CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/RemoveUnusedLocalFunction/CSharpRemoveUnusedLocalFunctionCodeFixProvider.cs @@ -36,8 +36,6 @@ public CSharpRemoveUnusedLocalFunctionCodeFixProvider() public sealed override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(CS8321); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeQuality; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( diff --git a/src/Features/CSharp/Portable/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs b/src/Features/CSharp/Portable/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs index 19dbb99b310eb..501ca38ca08b1 100644 --- a/src/Features/CSharp/Portable/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/UseLocalFunction/CSharpUseLocalFunctionCodeFixProvider.cs @@ -41,8 +41,6 @@ public CSharpUseLocalFunctionCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseLocalFunctionDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) => !diagnostic.IsSuppressed; diff --git a/src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs b/src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs index 77045f1fd4069..a1364f058ddfd 100644 --- a/src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/UsePatternMatching/CSharpIsAndCastCheckWithoutNameCodeFixProvider.cs @@ -35,8 +35,6 @@ public CSharpIsAndCastCheckWithoutNameCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.InlineIsTypeWithoutNameCheckDiagnosticsId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( diff --git a/src/Features/Core/Portable/AddAnonymousTypeMemberName/AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs b/src/Features/Core/Portable/AddAnonymousTypeMemberName/AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs index 74461187ac38f..3e521d5bc1001 100644 --- a/src/Features/Core/Portable/AddAnonymousTypeMemberName/AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs +++ b/src/Features/Core/Portable/AddAnonymousTypeMemberName/AbstractAddAnonymousTypeMemberNameCodeFixProvider.cs @@ -34,8 +34,6 @@ protected AbstractAddAnonymousTypeMemberNameCodeFixProvider() protected abstract TAnonymousObjectMemberDeclaratorSyntax WithName(TAnonymousObjectMemberDeclaratorSyntax declarator, SyntaxToken name); protected abstract IEnumerable GetAnonymousObjectMemberNames(TAnonymousObjectInitializer initializer); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; diff --git a/src/Features/Core/Portable/AddObsoleteAttribute/AbstractAddObsoleteAttributeCodeFixProvider.cs b/src/Features/Core/Portable/AddObsoleteAttribute/AbstractAddObsoleteAttributeCodeFixProvider.cs index 3d8a78d4c50c4..f45e4a8a97f2b 100644 --- a/src/Features/Core/Portable/AddObsoleteAttribute/AbstractAddObsoleteAttributeCodeFixProvider.cs +++ b/src/Features/Core/Portable/AddObsoleteAttribute/AbstractAddObsoleteAttributeCodeFixProvider.cs @@ -30,8 +30,6 @@ protected AbstractAddObsoleteAttributeCodeFixProvider( _title = title; } - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var cancellationToken = context.CancellationToken; diff --git a/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs b/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs index 8b32808fe75a2..fcdf5613937a9 100644 --- a/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs +++ b/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs @@ -31,8 +31,6 @@ internal abstract partial class AbstractAddExplicitCastCodeFixProvider SyntaxFacts = syntaxFacts; - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile; - protected ISyntaxFacts SyntaxFacts { get; } protected abstract SyntaxNode ApplyFix(SyntaxNode currentRoot, TExpressionSyntax targetNode, ITypeSymbol conversionType); protected abstract CommonConversion ClassifyConversion(SemanticModel semanticModel, TExpressionSyntax expression, ITypeSymbol type); diff --git a/src/Features/Core/Portable/CodeStyle/AbstractCodeStyleProvider.Fixing.cs b/src/Features/Core/Portable/CodeStyle/AbstractCodeStyleProvider.Fixing.cs index 133f4b76d99b7..cfe719b06103c 100644 --- a/src/Features/Core/Portable/CodeStyle/AbstractCodeStyleProvider.Fixing.cs +++ b/src/Features/Core/Portable/CodeStyle/AbstractCodeStyleProvider.Fixing.cs @@ -40,8 +40,6 @@ protected CodeFixProvider() FixableDiagnosticIds = ImmutableArray.Create(_codeStyleProvider._descriptorId); } - internal override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public sealed override ImmutableArray FixableDiagnosticIds { get; } public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) diff --git a/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonDetectionCodeFixProvider.cs b/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonDetectionCodeFixProvider.cs index ba58b37a4d19d..cf3811b79e64d 100644 --- a/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonDetectionCodeFixProvider.cs +++ b/src/Features/Core/Portable/EmbeddedLanguages/Json/LanguageServices/AbstractJsonDetectionCodeFixProvider.cs @@ -30,8 +30,6 @@ protected AbstractJsonDetectionCodeFixProvider( protected abstract void AddComment(SyntaxEditor editor, SyntaxToken stringLiteral, string commentContents); - internal override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(AbstractJsonDetectionAnalyzer.DiagnosticId); diff --git a/src/Features/Core/Portable/Formatting/FormattingCodeFixProvider.cs b/src/Features/Core/Portable/Formatting/FormattingCodeFixProvider.cs index ba339b3690055..88bb28d94b3ec 100644 --- a/src/Features/Core/Portable/Formatting/FormattingCodeFixProvider.cs +++ b/src/Features/Core/Portable/Formatting/FormattingCodeFixProvider.cs @@ -30,8 +30,6 @@ public FormattingCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.FormattingDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { foreach (var diagnostic in context.Diagnostics) diff --git a/src/Features/Core/Portable/MakeClassAbstract/AbstractMakeTypeAbstractCodeFixProvider.cs b/src/Features/Core/Portable/MakeClassAbstract/AbstractMakeTypeAbstractCodeFixProvider.cs index 357c93d403cf8..6eb4d716ae6fd 100644 --- a/src/Features/Core/Portable/MakeClassAbstract/AbstractMakeTypeAbstractCodeFixProvider.cs +++ b/src/Features/Core/Portable/MakeClassAbstract/AbstractMakeTypeAbstractCodeFixProvider.cs @@ -19,8 +19,6 @@ internal abstract class AbstractMakeTypeAbstractCodeFixProvider CodeFixCategory.Compile; - public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { if (IsValidRefactoringContext(context.Diagnostics[0].Location?.FindNode(context.CancellationToken), out _)) diff --git a/src/Features/Core/Portable/MakeMemberStatic/AbstractMakeMemberStaticCodeFixProvider.cs b/src/Features/Core/Portable/MakeMemberStatic/AbstractMakeMemberStaticCodeFixProvider.cs index 9e1ebb32365e3..f0a64f60e2c6c 100644 --- a/src/Features/Core/Portable/MakeMemberStatic/AbstractMakeMemberStaticCodeFixProvider.cs +++ b/src/Features/Core/Portable/MakeMemberStatic/AbstractMakeMemberStaticCodeFixProvider.cs @@ -16,8 +16,6 @@ namespace Microsoft.CodeAnalysis.MakeMemberStatic { internal abstract class AbstractMakeMemberStaticCodeFixProvider : SyntaxEditorBasedCodeFixProvider { - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.Compile; - protected abstract bool TryGetMemberDeclaration(SyntaxNode node, [NotNullWhen(true)] out SyntaxNode? memberDeclaration); public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) diff --git a/src/Features/Core/Portable/PreferFrameworkType/PreferFrameworkTypeCodeFixProvider.cs b/src/Features/Core/Portable/PreferFrameworkType/PreferFrameworkTypeCodeFixProvider.cs index 2a3b4719204a1..6824099a1b9cb 100644 --- a/src/Features/Core/Portable/PreferFrameworkType/PreferFrameworkTypeCodeFixProvider.cs +++ b/src/Features/Core/Portable/PreferFrameworkType/PreferFrameworkTypeCodeFixProvider.cs @@ -31,8 +31,6 @@ public PreferFrameworkTypeCodeFixProvider() public sealed override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create( IDEDiagnosticIds.PreferBuiltInOrFrameworkTypeDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics[0]; diff --git a/src/Features/Core/Portable/RemoveAsyncModifier/AbstractRemoveAsyncModifierCodeFixProvider.cs b/src/Features/Core/Portable/RemoveAsyncModifier/AbstractRemoveAsyncModifierCodeFixProvider.cs index 0a40a44e153cd..53fa9700d504c 100644 --- a/src/Features/Core/Portable/RemoveAsyncModifier/AbstractRemoveAsyncModifierCodeFixProvider.cs +++ b/src/Features/Core/Portable/RemoveAsyncModifier/AbstractRemoveAsyncModifierCodeFixProvider.cs @@ -22,8 +22,6 @@ internal abstract class AbstractRemoveAsyncModifierCodeFixProvider CodeFixCategory.Compile; - protected abstract bool IsAsyncSupportingFunctionSyntax(SyntaxNode node); protected abstract SyntaxNode RemoveAsyncModifier(SyntaxGenerator generator, SyntaxNode methodLikeNode); protected abstract SyntaxNode? ConvertToBlockBody(SyntaxNode node, TExpressionSyntax expressionBody); diff --git a/src/Features/Core/Portable/RemoveUnusedVariable/AbstractRemoveUnusedVariableCodeFixProvider.cs b/src/Features/Core/Portable/RemoveUnusedVariable/AbstractRemoveUnusedVariableCodeFixProvider.cs index 1df259c9d8b35..da4733c59c204 100644 --- a/src/Features/Core/Portable/RemoveUnusedVariable/AbstractRemoveUnusedVariableCodeFixProvider.cs +++ b/src/Features/Core/Portable/RemoveUnusedVariable/AbstractRemoveUnusedVariableCodeFixProvider.cs @@ -36,8 +36,6 @@ internal abstract class AbstractRemoveUnusedVariableCodeFixProvider CodeFixCategory.CodeQuality; - public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); diff --git a/src/Features/Core/Portable/SimplifyThisOrMe/AbstractSimplifyThisOrMeCodeFixProvider.cs b/src/Features/Core/Portable/SimplifyThisOrMe/AbstractSimplifyThisOrMeCodeFixProvider.cs index d2bb1bc54e419..3c44c6d15dc40 100644 --- a/src/Features/Core/Portable/SimplifyThisOrMe/AbstractSimplifyThisOrMeCodeFixProvider.cs +++ b/src/Features/Core/Portable/SimplifyThisOrMe/AbstractSimplifyThisOrMeCodeFixProvider.cs @@ -34,8 +34,6 @@ protected AbstractSimplifyThisOrMeCodeFixProvider() public sealed override ImmutableArray FixableDiagnosticIds { get; } = ImmutableArray.Create(IDEDiagnosticIds.RemoveQualificationDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; diff --git a/src/Features/Core/Portable/SimplifyTypeNames/AbstractSimplifyTypeNamesCodeFixProvider.cs b/src/Features/Core/Portable/SimplifyTypeNames/AbstractSimplifyTypeNamesCodeFixProvider.cs index 7ba5655242a23..b44484e27c55c 100644 --- a/src/Features/Core/Portable/SimplifyTypeNames/AbstractSimplifyTypeNamesCodeFixProvider.cs +++ b/src/Features/Core/Portable/SimplifyTypeNames/AbstractSimplifyTypeNamesCodeFixProvider.cs @@ -40,8 +40,6 @@ protected AbstractSimplifyTypeNamesCodeFixProvider( IDEDiagnosticIds.SimplifyMemberAccessDiagnosticId, IDEDiagnosticIds.PreferBuiltInOrFrameworkTypeDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory => CodeFixCategory.CodeStyle; - private (SyntaxNode, string diagnosticId) GetNodeToSimplify( SyntaxNode root, SemanticModel model, TextSpan span, OptionSet optionSet, CancellationToken cancellationToken) diff --git a/src/Features/VisualBasic/Portable/RemoveSharedFromModuleMembers/VisualBasicRemoveSharedFromModuleMembersCodeFixProvider.vb b/src/Features/VisualBasic/Portable/RemoveSharedFromModuleMembers/VisualBasicRemoveSharedFromModuleMembersCodeFixProvider.vb index 37cf39950bde1..de058e88e2974 100644 --- a/src/Features/VisualBasic/Portable/RemoveSharedFromModuleMembers/VisualBasicRemoveSharedFromModuleMembersCodeFixProvider.vb +++ b/src/Features/VisualBasic/Portable/RemoveSharedFromModuleMembers/VisualBasicRemoveSharedFromModuleMembersCodeFixProvider.vb @@ -36,8 +36,6 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.RemoveSharedFromModuleMembers Public Overrides ReadOnly Property FixableDiagnosticIds As ImmutableArray(Of String) = ImmutableArray.Create( BC30433, BC30434, BC30503, BC30593) - Friend Overrides ReadOnly Property CodeFixCategory As CodeFixCategory = CodeFixCategory.Compile - Public Overrides Function RegisterCodeFixesAsync(context As CodeFixContext) As Task For Each diagnostic In context.Diagnostics Dim tokenToRemove = diagnostic.Location.FindToken(context.CancellationToken) From 4bc2a21bf7cd52e2d1a67482ff8512f35f5e3a1b Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Sat, 2 Apr 2022 20:24:19 +0200 Subject: [PATCH 112/131] Remove unnecessary ` - - - - false @@ -72,4 +68,4 @@ Designer - \ No newline at end of file + From ca0c17c6c5d317cb16941f44242fe9cb604950ae Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Mon, 4 Apr 2022 09:38:10 +0200 Subject: [PATCH 113/131] Address review comment --- .../AddImports/IAddImportsService.cs | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs index e29753b2de1ba..3929b0465ec9f 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Workspace/Core/LanguageServices/AddImports/IAddImportsService.cs @@ -26,39 +26,37 @@ internal record struct AddImportPlacementOptions( [property: DataMember(Order = 1)] bool PlaceImportsInsideNamespaces, [property: DataMember(Order = 2)] bool AllowInHiddenRegions) { -#if !CODE_STYLE public static async Task FromDocumentAsync(Document document, CancellationToken cancellationToken) - => FromDocument(document, await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false)); - - public static AddImportPlacementOptions FromDocument(Document document, OptionSet documentOptions) { - var service = document.GetRequiredLanguageService(); - - return new( - PlaceSystemNamespaceFirst: documentOptions.GetOption(GenerationOptions.PlaceSystemNamespaceFirst, document.Project.Language), - PlaceImportsInsideNamespaces: service.PlaceImportsInsideNamespaces(documentOptions), - AllowInHiddenRegions: CanAddImportsInHiddenRegions(document)); +#if CODE_STYLE + var options = document.Project.AnalyzerOptions.GetAnalyzerOptionSet(await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false), cancellationToken); +#else + var options = await document.GetOptionsAsync(cancellationToken).ConfigureAwait(false); +#endif + return FromDocument(document, options); } private static bool CanAddImportsInHiddenRegions(Document document) { +#if CODE_STYLE + return false; +#else // Normally we don't allow generation into a hidden region in the file. However, if we have a // modern span mapper at our disposal, we do allow it as that host span mapper can handle mapping // our edit to their domain appropriate. var spanMapper = document.Services.GetService(); return spanMapper != null && spanMapper.SupportsMappingImportDirectives; +#endif } -#else - public static async Task FromDocumentAsync(Document document, CancellationToken cancellationToken) + + public static AddImportPlacementOptions FromDocument(Document document, OptionSet documentOptions) { var service = document.GetRequiredLanguageService(); - var options = document.Project.AnalyzerOptions.GetAnalyzerOptionSet(await document.GetRequiredSyntaxTreeAsync(cancellationToken).ConfigureAwait(false), cancellationToken); return new( - PlaceSystemNamespaceFirst: options.GetOption(GenerationOptions.PlaceSystemNamespaceFirst), - PlaceImportsInsideNamespaces: service.PlaceImportsInsideNamespaces(options), - AllowInHiddenRegions: false); + PlaceSystemNamespaceFirst: documentOptions.GetOption(GenerationOptions.PlaceSystemNamespaceFirst, document.Project.Language), + PlaceImportsInsideNamespaces: service.PlaceImportsInsideNamespaces(documentOptions), + AllowInHiddenRegions: CanAddImportsInHiddenRegions(document)); } -#endif } internal interface IAddImportsService : ILanguageService From 42f00f18d57b7e7305024272c1e1873ccb2f87d2 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Mon, 4 Apr 2022 11:21:51 +0200 Subject: [PATCH 114/131] Cleanup unused resources in Features layer --- .../GenerateType/GenerateTypeTests.cs | 4 +- .../GenerateType/GenerateTypeTests.vb | 6 +- .../Portable/CSharpFeaturesResources.resx | 37 ------ .../xlf/CSharpFeaturesResources.cs.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.de.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.es.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.fr.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.it.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.ja.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.ko.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.pl.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.pt-BR.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.ru.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.tr.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.zh-Hans.xlf | 60 ---------- .../xlf/CSharpFeaturesResources.zh-Hant.xlf | 60 ---------- .../Core/Portable/FeaturesResources.resx | 66 +---------- .../Portable/xlf/FeaturesResources.cs.xlf | 105 ------------------ .../Portable/xlf/FeaturesResources.de.xlf | 105 ------------------ .../Portable/xlf/FeaturesResources.es.xlf | 105 ------------------ .../Portable/xlf/FeaturesResources.fr.xlf | 105 ------------------ .../Portable/xlf/FeaturesResources.it.xlf | 105 ------------------ .../Portable/xlf/FeaturesResources.ja.xlf | 105 ------------------ .../Portable/xlf/FeaturesResources.ko.xlf | 105 ------------------ .../Portable/xlf/FeaturesResources.pl.xlf | 105 ------------------ .../Portable/xlf/FeaturesResources.pt-BR.xlf | 105 ------------------ .../Portable/xlf/FeaturesResources.ru.xlf | 105 ------------------ .../Portable/xlf/FeaturesResources.tr.xlf | 105 ------------------ .../xlf/FeaturesResources.zh-Hans.xlf | 105 ------------------ .../xlf/FeaturesResources.zh-Hant.xlf | 105 ------------------ .../Portable/VBFeaturesResources.resx | 27 ----- .../Portable/xlf/VBFeaturesResources.cs.xlf | 40 ------- .../Portable/xlf/VBFeaturesResources.de.xlf | 40 ------- .../Portable/xlf/VBFeaturesResources.es.xlf | 40 ------- .../Portable/xlf/VBFeaturesResources.fr.xlf | 40 ------- .../Portable/xlf/VBFeaturesResources.it.xlf | 40 ------- .../Portable/xlf/VBFeaturesResources.ja.xlf | 40 ------- .../Portable/xlf/VBFeaturesResources.ko.xlf | 40 ------- .../Portable/xlf/VBFeaturesResources.pl.xlf | 40 ------- .../xlf/VBFeaturesResources.pt-BR.xlf | 40 ------- .../Portable/xlf/VBFeaturesResources.ru.xlf | 40 ------- .../Portable/xlf/VBFeaturesResources.tr.xlf | 40 ------- .../xlf/VBFeaturesResources.zh-Hans.xlf | 40 ------- .../xlf/VBFeaturesResources.zh-Hant.xlf | 40 ------- 44 files changed, 6 insertions(+), 2799 deletions(-) diff --git a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs index 4cbadb49c6f86..6b6124785e54b 100644 --- a/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs +++ b/src/EditorFeatures/CSharpTest/Diagnostics/GenerateType/GenerateTypeTests.cs @@ -4747,7 +4747,7 @@ public async Task TestDisplayStringForGlobalNamespace() { await TestSmartTagTextAsync( @"class C : [|Goo|]", -string.Format(FeaturesResources.Generate_0_1_in_new_file, "class", "Goo", FeaturesResources.Global_Namespace)); +string.Format(FeaturesResources.Generate_0_1_in_new_file, "class", "Goo")); } [WorkItem(543853, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543853")] @@ -4854,7 +4854,7 @@ static void Main(string[] args) await TestExactActionSetOfferedAsync(code, new[] { - string.Format(FeaturesResources.Generate_0_1_in_new_file, "class", "Goo", FeaturesResources.Global_Namespace), + string.Format(FeaturesResources.Generate_0_1_in_new_file, "class", "Goo"), string.Format(FeaturesResources.Generate_nested_0_1, "class", "Goo", "Program"), FeaturesResources.Generate_new_type }); diff --git a/src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateType/GenerateTypeTests.vb b/src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateType/GenerateTypeTests.vb index 75234dd27cf34..6d3c1fa0eeca8 100644 --- a/src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateType/GenerateTypeTests.vb +++ b/src/EditorFeatures/VisualBasicTest/Diagnostics/GenerateType/GenerateTypeTests.vb @@ -1239,7 +1239,7 @@ Class Program End Class #End ExternalSource .NormalizedValue, -{String.Format(FeaturesResources.Generate_0_1_in_new_file, "class", "Goo", FeaturesResources.Global_Namespace), String.Format(FeaturesResources.Generate_nested_0_1, "class", "Goo", "Program"), FeaturesResources.Generate_new_type}) +{String.Format(FeaturesResources.Generate_0_1_in_new_file, "class", "Goo"), String.Format(FeaturesResources.Generate_nested_0_1, "class", "Goo"), FeaturesResources.Generate_new_type}) End Function @@ -1258,8 +1258,8 @@ Class Bar End Class #End ExternalSource .NormalizedValue, -{String.Format(FeaturesResources.Generate_0_1_in_new_file, "class", "Goo", FeaturesResources.Global_Namespace), -String.Format(FeaturesResources.Generate_0_1, "class", "Goo", FeaturesResources.Global_Namespace), +{String.Format(FeaturesResources.Generate_0_1_in_new_file, "class", "Goo"), +String.Format(FeaturesResources.Generate_0_1, "class", "Goo"), String.Format(FeaturesResources.Generate_nested_0_1, "class", "Goo"), FeaturesResources.Generate_new_type}) End Function diff --git a/src/Features/CSharp/Portable/CSharpFeaturesResources.resx b/src/Features/CSharp/Portable/CSharpFeaturesResources.resx index f044789c39656..1329eb6c1b4da 100644 --- a/src/Features/CSharp/Portable/CSharpFeaturesResources.resx +++ b/src/Features/CSharp/Portable/CSharpFeaturesResources.resx @@ -134,12 +134,6 @@ Add 'await' and 'ConfigureAwait(false)' {Locked="await"} "await" is a C# keyword and should not be localized. - - Simplify lambda expression - - - Simplify all occurrences - <lambda expression> @@ -152,12 +146,6 @@ Autoselect disabled due to possible explicitly named anonymous type member creation. - - <element name> : - - - Autoselect disabled due to possible tuple type element creation. - <pattern variable> @@ -185,9 +173,6 @@ Remove 'this' qualification - - Name can be simplified - Can't determine valid range of statements to extract @@ -197,9 +182,6 @@ Selection does not contain a valid node - - Invalid selection. - Contains invalid selection. @@ -242,9 +224,6 @@ Organize Usings - - Insert 'await'. - Make {0} return Task instead of void. @@ -429,9 +408,6 @@ attribute target - - '{0}' does not contain a constructor that takes that many arguments. - The name '{0}' does not exist in the current context. @@ -522,9 +498,6 @@ Add required braces for single-line control statements - - Apply 'this.' qualification preferences - Apply expression/block body preferences @@ -566,9 +539,6 @@ Warning: Inlining temporary variable may change code meaning. - - Warning: Expression may have side effects. Code meaning may change. - local variable declaration @@ -592,10 +562,6 @@ Compare to '{0}' - - Apply preferred 'using' placement preferences - 'using' is a C# keyword and should not be localized - Remove 'in' keyword {Locked="in"} "in" is a C# keyword and should not be localized. @@ -657,9 +623,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply parameter null preferences diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf index 85c8bbbd044d4..0ea840ad2fded 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.cs.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - Použít předvolby kvalifikace this. - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - Použít upřednostňované předvolby umístění using - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ Výběr nemůže obsahovat příkazy nejvyšší úrovně. - - Simplify lambda expression - Zjednodušit výraz lambda - - - - Simplify all occurrences - Zjednodušit všechny výskyty - - Unseal class '{0}' Rozpečetit třídu {0} @@ -287,11 +262,6 @@ Použít rekurzivní vzory - - Warning: Expression may have side effects. Code meaning may change. - Upozornění: Výraz může mít vedlejší účinky. Význam kódu se může změnit. - - Warning: Inlining temporary into conditional method call. Upozornění: dočasné vkládání do volání podmíněné metody. @@ -342,16 +312,6 @@ Automatický výběr je zakázaný kvůli možnému vytvoření explicitně pojmenovaného člena anonymního typu. - - <element name> : - <název prvku>: - - - - Autoselect disabled due to possible tuple type element creation. - Automatický výběr je zakázaný kvůli možnému vytvoření elementu typu řazená kolekce členů. - - <pattern variable> <proměnná vzoru> @@ -382,11 +342,6 @@ Odebrat kvalifikaci this - - Name can be simplified - Název může být zjednodušený. - - Can't determine valid range of statements to extract Nemůže určit platný rozsah příkazů k extrakci. @@ -402,11 +357,6 @@ Výběr neobsahuje platný uzel. - - Invalid selection. - Neplatný výběr - - Contains invalid selection. Obsahuje neplatný výběr. @@ -477,11 +427,6 @@ Uspořádat direktivy using - - Insert 'await'. - Vložit operátor Await - - Make {0} return Task instead of void. Nastavit, že {0} má místo hodnoty typu Void vracet hodnotu Task @@ -727,11 +672,6 @@ cíl atributu - - '{0}' does not contain a constructor that takes that many arguments. - {0} neobsahuje konstruktor, který přebírá tolik argumentů. - - The name '{0}' does not exist in the current context. Název {0} v aktuálním kontextu neexistuje. diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf index c12082919f2b8..27b31785f30c7 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.de.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - Einstellungen zur Qualifikation "this." anwenden - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - Bevorzugte using-Platzierungseinstellungen anwenden - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ Die Auswahl darf keine Anweisungen der obersten Ebene enthalten. - - Simplify lambda expression - Lambdaausdruck vereinfachen - - - - Simplify all occurrences - Alle Vorkommen vereinfachen - - Unseal class '{0}' Versiegelung der Klasse "{0}" aufheben @@ -287,11 +262,6 @@ Verwenden rekursiver Muster - - Warning: Expression may have side effects. Code meaning may change. - Warnung: Der Ausdruck kann Nebeneffekte haben. Die Bedeutung des Codes kann sich ändern. - - Warning: Inlining temporary into conditional method call. Warnung: temporäres Inlining in bedingtem Methodenaufruf. @@ -342,16 +312,6 @@ Automatische Auswahl aufgrund der möglichen Erstellung eines explizit genannten anonymen Typmembers deaktiviert. - - <element name> : - <Elementname> : - - - - Autoselect disabled due to possible tuple type element creation. - Die automatische Auswahl wurde aufgrund einer möglichen Tupeltyp-Elementerstellung deaktiviert. - - <pattern variable> <Mustervariable> @@ -382,11 +342,6 @@ Qualifikation 'this' entfernen - - Name can be simplified - Der Name kann vereinfacht werden - - Can't determine valid range of statements to extract Ein gültiger Bereich der zu extrahierenden Anweisungen kann nicht ermittelt werden. @@ -402,11 +357,6 @@ Auswahl enthält keinen gültigen Knoten. - - Invalid selection. - Ungültige Auswahl. - - Contains invalid selection. Enthält eine ungültige Auswahl. @@ -477,11 +427,6 @@ Using-Direktiven organisieren - - Insert 'await'. - "await" einfügen. - - Make {0} return Task instead of void. "{0}" in Rückgabeaufgabe umwandeln, statt leer zu lassen. @@ -727,11 +672,6 @@ Attributziel - - '{0}' does not contain a constructor that takes that many arguments. - "{0}" enthält keinen Konstruktor, der viele Argumente verwendet. - - The name '{0}' does not exist in the current context. Der Name "{0}" ist im aktuellen Kontext nicht vorhanden. diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf index 80ab9c22659f4..a667b4420e930 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.es.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - Aplicar preferencias de calificación “this.” - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - Aplicar preferencias de selección de ubicación de "using" - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ La selección no puede incluir instrucciones de nivel superior - - Simplify lambda expression - Simplificar expresión lambda - - - - Simplify all occurrences - Simplificar todas las repeticiones - - Unseal class '{0}' Quitar el sello de la clase "{0}" @@ -287,11 +262,6 @@ Usar patrones recursivos - - Warning: Expression may have side effects. Code meaning may change. - Advertencia: la expresión puede tener efectos secundarios. El significado del código puede cambiar. - - Warning: Inlining temporary into conditional method call. Advertencia: Inserción de una llamada temporal en otra de método condicional. @@ -342,16 +312,6 @@ La selección automática se ha deshabilitado debido a la creación de un miembro de tipo anónimo nombrado explícitamente. - - <element name> : - <nombre de elemento> : - - - - Autoselect disabled due to possible tuple type element creation. - La selección automática se deshabilitó debido a la posible creación de elementos de tipo de tupla. - - <pattern variable> <variable de patrón> @@ -382,11 +342,6 @@ Quitar calificación 'this' - - Name can be simplified - El nombre se puede simplificar - - Can't determine valid range of statements to extract No se puede determinar el intervalo válido de instrucciones para extraer. @@ -402,11 +357,6 @@ La selección no contiene un nodo válido - - Invalid selection. - Selección no válida. - - Contains invalid selection. Contiene una selección no válida. @@ -477,11 +427,6 @@ Organizar instrucciones Using - - Insert 'await'. - Insertar 'await'. - - Make {0} return Task instead of void. Hacer que {0} devuelva Tarea en lugar de void. @@ -727,11 +672,6 @@ destino de atributo - - '{0}' does not contain a constructor that takes that many arguments. - '{0}' no contiene un constructor que tome tantos argumentos. - - The name '{0}' does not exist in the current context. El nombre '{0}' no existe en el contexto actual. diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf index 01e211a5331a2..0638bc1055007 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.fr.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - Appliquer les préférences de qualification 'this.' - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - Appliquer les préférences de placement de 'using' par défaut - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ La sélection ne peut pas inclure d'instructions de niveau supérieur - - Simplify lambda expression - Simplifier l'expression lambda - - - - Simplify all occurrences - Simplifier toutes les occurrences - - Unseal class '{0}' Classe unsealed '{0}' @@ -287,11 +262,6 @@ Utiliser des modèles récursifs - - Warning: Expression may have side effects. Code meaning may change. - Avertissement : L'expression peut avoir des effets secondaires. La signification du code peut changer. - - Warning: Inlining temporary into conditional method call. Avertissement : Inlining temporaire dans un appel de méthode conditionnel. @@ -342,16 +312,6 @@ Sélection automatique désactivée en raison de la création éventuelle d'un membre de type anonyme nommé explicitement. - - <element name> : - <nom d'élément> : - - - - Autoselect disabled due to possible tuple type element creation. - Sélection automatique désactivée en raison de la création possible d'un élément de type tuple. - - <pattern variable> <variable de modèle> @@ -382,11 +342,6 @@ Supprimer la qualification 'this' - - Name can be simplified - Le nom peut être simplifié - - Can't determine valid range of statements to extract Impossible de déterminer la plage valide d'instructions à extraire @@ -402,11 +357,6 @@ La sélection ne contient pas un nœud valide - - Invalid selection. - Sélection incorrecte. - - Contains invalid selection. Contient une sélection incorrecte. @@ -477,11 +427,6 @@ Organiser les instructions Using - - Insert 'await'. - Insérez 'await'. - - Make {0} return Task instead of void. {0} doit retourner Task au lieu de void. @@ -727,11 +672,6 @@ cible d'attribut - - '{0}' does not contain a constructor that takes that many arguments. - '{0}' ne contient pas de constructeur prenant en charge autant d'arguments. - - The name '{0}' does not exist in the current context. Le nom '{0}' n'existe pas dans le contexte actuel. diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf index b9c2e6a6c5a2b..89c6738fce05a 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.it.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - Applica le preferenze relative alla qualificazione 'this.' - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - Applica le preferenze di posizionamento per 'using' - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ La selezione non può includere istruzioni di primo livello - - Simplify lambda expression - Semplifica l'espressione lambda - - - - Simplify all occurrences - Semplifica tutte le occorrenze - - Unseal class '{0}' Rimuovi seal dalla classe '{0}' @@ -287,11 +262,6 @@ Usa criteri ricorsivi - - Warning: Expression may have side effects. Code meaning may change. - Avviso: l'espressione può avere effetti collaterali. Il significato del codice può cambiare. - - Warning: Inlining temporary into conditional method call. Avviso: incorporamento dell'elemento temporaneo nella chiamata a un metodo condizionale. @@ -342,16 +312,6 @@ La selezione automatica è disabilitata a causa della creazione di possibili membri di tipo anonimo denominati in modo esplicito. - - <element name> : - <nome elemento>: - - - - Autoselect disabled due to possible tuple type element creation. - La selezione automatica è disabilitata a causa della potenziale creazione di elementi di tipo tupla. - - <pattern variable> <variabile di criterio> @@ -382,11 +342,6 @@ Rimuove la qualificazione 'this' - - Name can be simplified - Il nome può essere semplificato - - Can't determine valid range of statements to extract Non è possibile determinare l'intervallo valido di istruzioni da estrarre @@ -402,11 +357,6 @@ La selezione non contiene un nodo valido - - Invalid selection. - Selezione non valida. - - Contains invalid selection. Contiene una selezione non valida. @@ -477,11 +427,6 @@ Organizza using - - Insert 'await'. - Inserire 'await'. - - Make {0} return Task instead of void. Fa in modo che {0} restituisca Task invece di void. @@ -727,11 +672,6 @@ destinazione dell'attributo - - '{0}' does not contain a constructor that takes that many arguments. - '{0}' non contiene un costruttore che accetta un tale numero di argomenti. - - The name '{0}' does not exist in the current context. Il nome '{0}' non esiste nel contesto corrente. diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf index 1f9b8b637eaff..a1e0d8b0af932 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ja.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - 'this.' 修飾の基本設定を適用します - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - 優先する 'using' 配置設定を適用する - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ 選択に最上位レベルのステートメントを含めることはできません - - Simplify lambda expression - ラムダ式の簡略化 - - - - Simplify all occurrences - すべての出現箇所を簡素化します - - Unseal class '{0}' クラス '{0}' のシールを解除 @@ -287,11 +262,6 @@ 再帰パターンを使用する - - Warning: Expression may have side effects. Code meaning may change. - 警告: 式に副作用がある可能性があります。コードの意味が変更される可能性があります。 - - Warning: Inlining temporary into conditional method call. 警告: 一時メソッド呼び出しを条件付きメソッド呼び出しにインライン展開しています。 @@ -342,16 +312,6 @@ 明示的に指定された匿名型メンバーの作成である可能性があるため、自動選択は無効になっています。 - - <element name> : - <要素名> : - - - - Autoselect disabled due to possible tuple type element creation. - タプル型の要素が作成された可能性があるため、自動選択は無効になっています。 - - <pattern variable> <pattern variable> @@ -382,11 +342,6 @@ this' 修飾子を削除します - - Name can be simplified - 名前を簡素化できます - - Can't determine valid range of statements to extract 抽出するステートメントの有効な範囲を決定できません @@ -402,11 +357,6 @@ 選択には有効なノードは含まれません - - Invalid selection. - 選択が無効です。 - - Contains invalid selection. 無効な選択が含まれています。 @@ -477,11 +427,6 @@ using の整理 - - Insert 'await'. - await' を挿入します。 - - Make {0} return Task instead of void. {0} が void ではなくタスクを返すようにします。 @@ -727,11 +672,6 @@ 属性ターゲット - - '{0}' does not contain a constructor that takes that many arguments. - '{0}' には、多数の引数を指定できるコンストラクターがありません。 - - The name '{0}' does not exist in the current context. 名前 '{0}' は、現在のコンテキストに存在しません。 diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf index 1de66d4ea5304..443fefb5618b9 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ko.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - 'this.' 한정자 기본 설정 적용 - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - 기본 'using' 배치 기본 설정 적용 - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ 선택 영역에는 최상위 문을 포함할 수 없습니다. - - Simplify lambda expression - 람다 식 단순화 - - - - Simplify all occurrences - 모든 항목 단순화 - - Unseal class '{0}' '{0}' 클래스 봉인 해제 @@ -287,11 +262,6 @@ 재귀 패턴 사용 - - Warning: Expression may have side effects. Code meaning may change. - 경고: 식에 부작용이 있을 수 있습니다. 코드 의미가 변경될 수 있습니다. - - Warning: Inlining temporary into conditional method call. 경고: 임시 작업을 조건부 메서드 호출로 인라인 처리합니다. @@ -342,16 +312,6 @@ 명시적으로 이름이 지정된 익명 형식 멤버가 만들어질 수 있어 자동 선택을 사용하지 않도록 설정했습니다. - - <element name> : - <요소 이름>: - - - - Autoselect disabled due to possible tuple type element creation. - 가능한 튜플 형식 요소 만들기로 인해 자동 선택을 사용할 수 없습니다. - - <pattern variable> <pattern variable> @@ -382,11 +342,6 @@ this' 한정자 제거 - - Name can be simplified - 이름을 단순화할 수 있습니다. - - Can't determine valid range of statements to extract 추출할 문의 유효한 범위를 결정할 수 없습니다. @@ -402,11 +357,6 @@ 선택 항목에 유효한 노드가 포함되어 있지 않습니다. - - Invalid selection. - 잘못된 선택 항목입니다. - - Contains invalid selection. 잘못된 선택 항목을 포함합니다. @@ -477,11 +427,6 @@ Using 구성 - - Insert 'await'. - Await'를 삽입합니다. - - Make {0} return Task instead of void. {0}에서 void 대신 Task를 반환하도록 설정합니다. @@ -727,11 +672,6 @@ 특성 대상 - - '{0}' does not contain a constructor that takes that many arguments. - '{0}'에 해당 개수의 인수를 사용하는 생성자가 없습니다. - - The name '{0}' does not exist in the current context. 이름 '{0}'이(가) 현재 컨텍스트에 없습니다. diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf index fa44f615f1c3b..4993fb6e3ed79 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pl.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - Zastosuj preferencje kwalifikacji „this.” - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - Zastosuj preferowane preferencje umieszczania elementu „using” - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ Zaznaczenie nie może zawierać instrukcji najwyższego poziomu - - Simplify lambda expression - Uprość wyrażenie lambda - - - - Simplify all occurrences - Uprość wszystkie wystąpienia - - Unseal class '{0}' Odpieczętuj klasę „{0}” @@ -287,11 +262,6 @@ Używanie wzorców rekursywnych - - Warning: Expression may have side effects. Code meaning may change. - Ostrzeżenie: wyrażenie może mieć efekty uboczne. Znaczenie kodu może ulec zmianie. - - Warning: Inlining temporary into conditional method call. Ostrzeżenie: tymczasowe wbudowywanie do wywołania metody warunkowej. @@ -342,16 +312,6 @@ Automatyczne zaznaczanie zostało wyłączone z powodu możliwego utworzenia jawnie nazwanej anonimowej składowej typu. - - <element name> : - <nazwa elementu>: - - - - Autoselect disabled due to possible tuple type element creation. - Funkcja automatycznego wyboru została wyłączona ze względu na prawdopodobne utworzenie elementu typu krotki. - - <pattern variable> <zmienna wzorca> @@ -382,11 +342,6 @@ Usuń kwalifikację „this” - - Name can be simplified - Nazwę można uprościć - - Can't determine valid range of statements to extract Nie można określić prawidłowego zakresu instrukcji do wyodrębnienia @@ -402,11 +357,6 @@ Zaznaczenie nie zawiera prawidłowego węzła - - Invalid selection. - Nieprawidłowe zaznaczenie. - - Contains invalid selection. Zawiera nieprawidłowe zaznaczenie. @@ -477,11 +427,6 @@ Organizuj użycia - - Insert 'await'. - Wstaw element „await”. - - Make {0} return Task instead of void. Ustaw element {0}, aby zwracał zadanie zamiast elementu void. @@ -727,11 +672,6 @@ cel atrybutu - - '{0}' does not contain a constructor that takes that many arguments. - 'Element „{0}” nie zawiera konstruktora, który przyjmuje wiele argumentów. - - The name '{0}' does not exist in the current context. Nazwa „{0}” nie istnieje w bieżącym kontekście. diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf index 7007a8aa54150..7185bd6671b77 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.pt-BR.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - Aplicar as preferências de qualificação 'this.' - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - Aplicar preferências de posicionamento preferencial 'using' - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ A seleção não pode incluir instruções de nível superior - - Simplify lambda expression - Simplificar expressão lambda - - - - Simplify all occurrences - Simplificar todas as ocorrências - - Unseal class '{0}' Desselar a classe '{0}' @@ -287,11 +262,6 @@ Usar padrões recursivos - - Warning: Expression may have side effects. Code meaning may change. - Aviso: A expressão pode ter efeitos colaterais. O significado do código pode alterar. - - Warning: Inlining temporary into conditional method call. Aviso: embutindo a chamada de método temporária na condicional. @@ -342,16 +312,6 @@ Seleção automática desabilitada devido à possível criação de membros do tipo anônimo nomeados explicitamente. - - <element name> : - <nome do elemento> : - - - - Autoselect disabled due to possible tuple type element creation. - Seleção automática desabilitada devido a uma possível criação de elemento do tipo tupla. - - <pattern variable> <variável de padrão> @@ -382,11 +342,6 @@ Remover qualificação ''this'' - - Name can be simplified - O nome pode ser simplificado - - Can't determine valid range of statements to extract Não é possível determinar o intervalo válido de instruções para extrair @@ -402,11 +357,6 @@ A seleção não contém um nó válido - - Invalid selection. - Seleção inválida. - - Contains invalid selection. Contém uma seleção inválida. @@ -477,11 +427,6 @@ Organizar Usos - - Insert 'await'. - Inserir "aguardar". - - Make {0} return Task instead of void. Fazer com que {0} retorne Tarefa em vez de nulo. @@ -727,11 +672,6 @@ destino do atributo - - '{0}' does not contain a constructor that takes that many arguments. - '{0}' não tem um construtor que aceite que muitos argumentos. - - The name '{0}' does not exist in the current context. O nome '{0}' não existe no contexto atual. diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf index b2a6c537e66e3..7e4800916a2e4 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.ru.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - Применять предпочтения для квалификации this. - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - Применить предпочтительные параметры размещения "using" - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ Выбор не может включать операторы верхнего уровня - - Simplify lambda expression - Упростить лямбда-выражение - - - - Simplify all occurrences - Упростить все вхождения - - Unseal class '{0}' Распечатать класс "{0}" @@ -287,11 +262,6 @@ Использовать рекурсивные шаблоны - - Warning: Expression may have side effects. Code meaning may change. - Внимание! Выражение может иметь побочные эффекты. Значение кода может измениться. - - Warning: Inlining temporary into conditional method call. Предупреждение: встраивание временных элементов в условный вызов метода. @@ -342,16 +312,6 @@ Автовыбор отключен из-за возможного создания явно названного участника анонимного типа. - - <element name> : - <имя элемента>: - - - - Autoselect disabled due to possible tuple type element creation. - Автовыбор отключен из-за возможного создания элемента типа кортежа. - - <pattern variable> <переменная шаблона> @@ -382,11 +342,6 @@ Удаление квалификации this - - Name can be simplified - Имя может быть упрощено - - Can't determine valid range of statements to extract Невозможно определить допустимый диапазон операторов для извлечения @@ -402,11 +357,6 @@ Выделение не содержит допустимый узел - - Invalid selection. - Недопустимое выделение. - - Contains invalid selection. Содержит недопустимое выделение. @@ -477,11 +427,6 @@ Упорядочение Using - - Insert 'await'. - Вставьте "await". - - Make {0} return Task instead of void. Сделать {0} задачей возврата вместо void. @@ -727,11 +672,6 @@ назначение атрибута - - '{0}' does not contain a constructor that takes that many arguments. - "{0}" не содержит конструктор, который принимает такое количество аргументов. - - The name '{0}' does not exist in the current context. Имя "{0}" не существует в текущем контексте. diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf index 0c473c063dddf..2ac691e051b42 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.tr.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - 'this.' nitelemesi tercihlerini uygula - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - Tercih edilen 'using' yerleştirme tercihlerini uygulayın - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ Seçim en üst düzey deyimleri içeremez - - Simplify lambda expression - Lambda ifadesini basitleştir - - - - Simplify all occurrences - Tüm yinelemeleri basitleştir - - Unseal class '{0}' '{0}' sınıfının mührünü aç @@ -287,11 +262,6 @@ Özyinelemeli desenler kullan - - Warning: Expression may have side effects. Code meaning may change. - Uyarı: İfadenin yan etkileri olabilir. Kod anlamı değişebilir. - - Warning: Inlining temporary into conditional method call. Uyarı: Koşullu yöntem çağrısında geçici öğe satır içinde kullanılıyor. @@ -342,16 +312,6 @@ Otomatik seçim, olası açık adlı anonim tür üyesi oluşturma nedeniyle devre dışı bırakıldı. - - <element name> : - <öğe adı>: - - - - Autoselect disabled due to possible tuple type element creation. - Olası demet türü öğe oluşturma işleminden dolayı Otomatik seçim devre dışı bırakıldı. - - <pattern variable> <desen değişkeni> @@ -382,11 +342,6 @@ this' nitelemesini kaldır - - Name can be simplified - Ad basitleştirilebilir - - Can't determine valid range of statements to extract Ayıklanacak deyimlerin geçerli aralığı belirlenemiyor @@ -402,11 +357,6 @@ Seçim, geçerli bir düğüm içermiyor - - Invalid selection. - Geçersiz seçim. - - Contains invalid selection. Geçersiz seçimi içerir. @@ -477,11 +427,6 @@ Kullanımları Düzenle - - Insert 'await'. - await' ekle. - - Make {0} return Task instead of void. {0} öğesi boşluk yerine Görev döndürsün. @@ -727,11 +672,6 @@ öznitelik hedefi - - '{0}' does not contain a constructor that takes that many arguments. - '{0}' bu kadar çok sayıda bağımsız değişken alan bir oluşturucu içermiyor. - - The name '{0}' does not exist in the current context. '{0}' adı geçerli bağlamda yok. diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf index 6c100501b63c1..55326efe8ee60 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hans.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - 应用 “this.” 资格首选项 - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - 应用首选的 "using" 放置首选项 - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ 所选内容不能包含顶级语句 - - Simplify lambda expression - 简化 lambda 表达式 - - - - Simplify all occurrences - 简化所有事件 - - Unseal class '{0}' Unseal 类 "{0}" @@ -287,11 +262,6 @@ 使用递归模式 - - Warning: Expression may have side effects. Code meaning may change. - 警告: 表达式可能有副作用。代码含义可能更改。 - - Warning: Inlining temporary into conditional method call. 警告: 即将在条件方法调用中内联临时内容。 @@ -342,16 +312,6 @@ 由于可能导致创建显式命名的匿名类型成员,自动选择已禁用。 - - <element name> : - <元素名称>: - - - - Autoselect disabled due to possible tuple type element creation. - 由于可能的元组类型元素创建,已禁用自动选择。 - - <pattern variable> <模式变量> @@ -382,11 +342,6 @@ 删除 "this" 资格 - - Name can be simplified - 可简化名称 - - Can't determine valid range of statements to extract 无法确定要提取的语句的有效范围 @@ -402,11 +357,6 @@ 所选内容不包含有效节点 - - Invalid selection. - 无效的选择。 - - Contains invalid selection. 包含无效的选择。 @@ -477,11 +427,6 @@ 组织 Using - - Insert 'await'. - 插入“await”。 - - Make {0} return Task instead of void. 使 {0} 返回 Task,而不是 void。 @@ -727,11 +672,6 @@ 属性目标 - - '{0}' does not contain a constructor that takes that many arguments. - “{0}”不包含采用许多参数的构造函数。 - - The name '{0}' does not exist in the current context. 当前上下文中不存在名称“{0}”。 diff --git a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf index f496739b07296..bf0550849a1ab 100644 --- a/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf +++ b/src/Features/CSharp/Portable/xlf/CSharpFeaturesResources.zh-Hant.xlf @@ -87,11 +87,6 @@ Apply new() preferences - - Apply object collection initialization preferences - Apply object collection initialization preferences - - Apply parameter null preferences Apply parameter null preferences @@ -112,21 +107,11 @@ Apply static local function preferences - - Apply 'this.' qualification preferences - 套用 'this.' 資格喜好設定 - - Apply throw expression preferences Apply throw expression preferences - - Apply preferred 'using' placement preferences - 套用慣用的 'using' 放置喜好設定 - 'using' is a C# keyword and should not be localized - Apply using statement preferences Apply using statement preferences @@ -267,16 +252,6 @@ 選取範圍不能包含最上層陳述式 - - Simplify lambda expression - 簡化 Lambda 運算式 - - - - Simplify all occurrences - 簡化所有項目 - - Unseal class '{0}' 為類別 '{0}' 解密 @@ -287,11 +262,6 @@ 使用遞迴模式 - - Warning: Expression may have side effects. Code meaning may change. - 警告: 運算式可能有副作用。代碼意義可能變更。 - - Warning: Inlining temporary into conditional method call. 警告: 內嵌臨時加入條件式方法呼叫。 @@ -342,16 +312,6 @@ 由於可能會建立明確命名的匿名類型成員,所以停用自動選取。 - - <element name> : - <元素名稱>: - - - - Autoselect disabled due to possible tuple type element creation. - 因為可能建立元組類型元素,所以停用自動選擇。 - - <pattern variable> <樣式變數> @@ -382,11 +342,6 @@ 移除 'this' 限定性條件 - - Name can be simplified - 可以簡化名稱 - - Can't determine valid range of statements to extract 無法判斷要擷取的有效陳述式範圍 @@ -402,11 +357,6 @@ 選取範圍沒有包含有效的節點 - - Invalid selection. - 無效的選取範圍。 - - Contains invalid selection. 包含無效的選取範圍。 @@ -477,11 +427,6 @@ 組合管理 Using - - Insert 'await'. - 插入 'await'。 - - Make {0} return Task instead of void. 使 {0} 傳回 Task 而不是 void。 @@ -727,11 +672,6 @@ 屬性目標 - - '{0}' does not contain a constructor that takes that many arguments. - '{0}' 不包含接受許多引數的建構函式。 - - The name '{0}' does not exist in the current context. 目前內容中沒有名稱 '{0}'。 diff --git a/src/Features/Core/Portable/FeaturesResources.resx b/src/Features/Core/Portable/FeaturesResources.resx index 41b1e6733cf0b..c7a1a563e0a4a 100644 --- a/src/Features/Core/Portable/FeaturesResources.resx +++ b/src/Features/Core/Portable/FeaturesResources.resx @@ -252,9 +252,6 @@ Generate nested {0} '{1}' - - Global Namespace - Implement all members explicitly @@ -558,10 +555,6 @@ Modifying {0} which contains the stackalloc operator requires restarting the application. {Locked="stackalloc"} "stackalloc" is C# keyword and should not be localized. - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying {0} which contains an Aggregate, Group By, or Join query clauses requires restarting the application. {Locked="Aggregate"}{Locked="Group By"}{Locked="Join"} are VB keywords and should not be localized. @@ -584,9 +577,6 @@ Unexpected interface member kind: {0} - - Unknown symbol kind - Generate abstract property '{0}' @@ -596,9 +586,6 @@ Generate method '{0}' - - Requested assembly already loaded from '{0}'. - The symbol does not have an icon. @@ -710,18 +697,6 @@ Do you want to continue? Suppress {0} - - Re-triage {0}(currently '{1}') - - - Argument cannot have a null element. - - - Argument cannot be empty. - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - Computing fix all occurrences code fix... @@ -908,9 +883,6 @@ This version used in: {2} Interfaces - - Locals - Methods @@ -1005,18 +977,6 @@ This version used in: {2} Snippets - - All lowercase - - - All uppercase - - - First word capitalized - - - Pascal Case - Remove document '{0}' @@ -1131,9 +1091,6 @@ This version used in: {2} in {0} (project {1}) - - Add accessibility modifiers - Move declaration near reference @@ -1167,9 +1124,6 @@ This version used in: {2} Warning: Iteration variable crossed function boundary. - - Warning: Collection may be modified during iteration. - Convert to LINQ @@ -1391,9 +1345,6 @@ This version used in: {2} Rude edit - - Edit and Continue disallowed by module - Cannot apply changes -- unexpected error: '{0}' @@ -1403,9 +1354,6 @@ This version used in: {2} Changes made in project '{0}' require restarting the application: {1} - - Changes made in project '{0}' will not be applied while the application is running - The current content of source file '{0}' does not match the built source. Any changes made to this file while debugging won't be applied until its content matches the built source. @@ -2310,9 +2258,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra Two or more character ranges can be concatenated. For example, to specify the range of decimal digits from "0" through "9", the range of lowercase letters from "a" through "f", and the range of uppercase letters from "A" through "F", use [0-9a-fA-F]. - - negative character range - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. @@ -2793,9 +2738,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Inline and keep '{0}' - - Pull member(s) up to new base class... - Operators @@ -2817,9 +2759,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Sort accessibility modifiers - - Format document - Error creating instance of CodeFixProvider @@ -2854,9 +2793,6 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Convert to record - - Introduce parameter - Introduce parameter for '{0}' @@ -3211,4 +3147,4 @@ Zero-width positive lookbehind assertions are typically used at the beginning of Sort Imports or usings - + \ No newline at end of file diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf index 5fd5033967618..296f8f8db2da1 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.cs.xlf @@ -425,11 +425,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Když se běh zastaví na výjimce, změny se nepovolují. - - Changes made in project '{0}' will not be applied while the application is running - Změny provedené v projektu {0} se nepoužijí, dokud je aplikace spuštěná. - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime Výsledkem jedné nebo více změn je, že kompilátor vytvoří nový typ, což vyžaduje restartování aplikace, protože tuto akci modul runtime nepodporuje. @@ -640,11 +635,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Upravit a pokračovat - - Edit and Continue disallowed by module - Modul zakázal funkci Upravit a pokračovat. - - Changes made in project '{0}' require restarting the application: {1} Změny provedené v projektu {0} vyžadují restartování aplikace: {1} @@ -735,11 +725,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Opravit překlep {0} - - Format document - Formátovat dokument - - Formatting document Formátuje se dokument. @@ -980,11 +965,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Zavést místní - - Introduce parameter - Zavést parametr - - Introduce parameter for '{0}' Zavést parametr pro{0} @@ -1165,11 +1145,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Úprava příkazu try/catch/finally, když je aktivní blok finally, vyžaduje restartování aplikace. - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - Úprava aktivního {0} s příkazy On Error nebo Resume vyžaduje restartování aplikace. - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. Úprava těla {0} vyžaduje restartování aplikace, protože je v něm příliš mnoho příkazů. @@ -1335,11 +1310,6 @@ Ujistěte se, že specifikátor tt použijete pro jazyky, pro které je nezbytn Povýšit členy na základní typ... - - Pull member(s) up to new base class... - Načíst členy do nové základní třídy... - - Quantifier {x,y} following nothing Před kvantifikátorem {x,y} není nic uvedeno. @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra Je možné zřetězit dva nebo více rozsahů znaků. Pokud chcete například zadat rozsah desítkových číslic od 0 do 9, rozsah malých písmen od a do f a rozsah velkých písmen od A do F, použijte [0-9A-fA-F]. - - negative character range - negativní rozsah znaků - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. Konstruktor regulárního výrazu \P{ name } odpovídá libovolnému znaku, který nepatří do obecné kategorie Unicode nebo pojmenovaného bloku, kde name je zkratka pro kategorii nebo název pojmenovaného bloku. @@ -3765,11 +3730,6 @@ Pokud se specifikátor formátu M použije bez dalších specifikátorů vlastn Generovat vnořené {0} {1} - - Global Namespace - Globální obor názvů - - Implement interface abstractly Implementovat rozhraní abstraktně @@ -3954,16 +3914,6 @@ Pokud se specifikátor formátu g použije bez dalších specifikátorů vlastn Neočekávaný druh člena rozhraní: {0} - - Unknown symbol kind - Neznámý druh symbolu - - - - Requested assembly already loaded from '{0}'. - Požadované sestavení je už načtené z {0}. - - The symbol does not have an icon. Symbol nemá ikonu. @@ -4095,26 +4045,6 @@ Chcete pokračovat? Implementovat rozhraní se vzorem Dispose - - Re-triage {0}(currently '{1}') - Nové určení priorit podle dostupnosti zdrojů {0}(aktuálně {1}) - - - - Argument cannot have a null element. - Argument nemůže mít element, který je null. - - - - Argument cannot be empty. - Argument nemůže být prázdný. - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - Ohlášená diagnostika s ID {0} se v analyzátoru nepodporuje. - - Computing fix all occurrences code fix... Vypočítává se oprava kódu pro opravu všech výskytů... @@ -4540,11 +4470,6 @@ Tato verze se používá zde: {2}. Rozhraní - - Locals - Místní hodnoty - - Methods Metody @@ -4670,26 +4595,6 @@ Tato verze se používá zde: {2}. Fragmenty - - All lowercase - Všechna písmena malá - - - - All uppercase - Všechna písmena velká - - - - First word capitalized - Velké první písmeno prvního slova - - - - Pascal Case - PascalCase - - Remove document '{0}' Odebrat dokument {0} @@ -4850,11 +4755,6 @@ Tato verze se používá zde: {2}. v {0} (projekt {1}) - - Add accessibility modifiers - Přidat Modifikátory dostupnosti - - Move declaration near reference Přesunout deklaraci do blízkosti odkazu @@ -4905,11 +4805,6 @@ Tato verze se používá zde: {2}. Upozornění: Proměnná iterace překročila hranici funkce. - - Warning: Collection may be modified during iteration. - Upozornění: Během iterace se kolekce může změnit. - - universal full date/time univerzální datum a čas diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf index 226519d25c171..dca250f99a77a 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.de.xlf @@ -425,11 +425,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Änderungen sind nicht zulässig, solange der Vorgang bei einer Ausnahme angehalten ist. - - Changes made in project '{0}' will not be applied while the application is running - Im Projekt "{0}" vorgenommene Änderungen werden nicht angewendet, während die Anwendung ausgeführt wird. - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime Eine oder mehrere Änderungen führen dazu, dass ein neuer Typ vom Compiler erstellt wird, der einen Neustart der Anwendung erfordert, da er von der Laufzeit nicht unterstützt wird. @@ -640,11 +635,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Bearbeiten und Fortfahren - - Edit and Continue disallowed by module - Bearbeiten und Fortfahren durch Modul untersagt - - Changes made in project '{0}' require restarting the application: {1} Änderungen, die im Projekt "{0}" vorgenommen wurden, erfordern einen Neustart der Anwendung: {1} @@ -735,11 +725,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Tippfehler "{0}" korrigieren - - Format document - Dokument formatieren - - Formatting document Dokument wird formatiert @@ -980,11 +965,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Lokale Variable einführen - - Introduce parameter - Parameter einführen - - Introduce parameter for '{0}' Parameter für "{0}" einführen @@ -1165,11 +1145,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Das Ändern einer Try-/Catch-/Finally-Anweisung bei aktiviertem endgültigen Block erfordert einen Neustart der Anwendung. - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - Das Ändern einer aktiven {0}, das die Anweisungen „On Error“ oder „Resume“ enthält, erfordert einen Neustart der Anwendung. - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. Das Ändern des Texts von {0} erfordert einen Neustart der Anwendung, da der Text zu viele Anweisungen enthält. @@ -1335,11 +1310,6 @@ Stellen Sie sicher, dass Sie den Bezeichner "tt" für Sprachen verwenden, für d Member zum Basistyp ziehen... - - Pull member(s) up to new base class... - Member auf neue Basisklasse ziehen... - - Quantifier {x,y} following nothing Quantifizierer {x,y} nach nichts. @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra Mehrere Zeichenbereiche können verkettet werden. Um beispielsweise den Bereich der Dezimalstellen von "0" bis "9", den Bereich der Kleinbuchstaben von "a" bis "f" und den Bereich der Großbuchstaben von "A" bis "F" anzugeben, verwenden Sie "[0-9a-fA-F]". - - negative character range - Negativer Zeichenbereich - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. Das Konstrukt des regulären Ausdrucks "\P{ name }" entspricht einem beliebigen Zeichen, das zu keiner allgemeinen Unicode-Kategorie bzw. keinem benannten Block gehört, wobei "name" der Kategorieabkürzung oder dem Namen des benannten Blocks entspricht. @@ -3765,11 +3730,6 @@ Bei Verwendung des Formatbezeichners "M" ohne weitere benutzerdefinierte Formatb Geschachteltes {0}-Objekt "{1}" generieren - - Global Namespace - Globaler Namespace - - Implement interface abstractly Schnittstelle abstrakt implementieren @@ -3954,16 +3914,6 @@ Bei Verwendung des Formatbezeichners "g" ohne weitere benutzerdefinierte Formatb Unerwartete Schnittstellenelementart: {0} - - Unknown symbol kind - Unbekannte Symbolart - - - - Requested assembly already loaded from '{0}'. - Angefordertes Assembly wurde bereits von "{0}" geladen. - - The symbol does not have an icon. Das Symbol hat kein Symbolbild. @@ -4095,26 +4045,6 @@ Möchten Sie fortfahren? Schnittstelle mit Dispose-Muster implementieren - - Re-triage {0}(currently '{1}') - Erneute Triage {0} (zurzeit "{1}") - - - - Argument cannot have a null element. - Argument darf kein Nullelement enthalten. - - - - Argument cannot be empty. - Argument darf nicht leer sein. - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - Die gemeldete Diagnose mit ID "{0}" wird vom Diagnoseanalysetool nicht unterstützt. - - Computing fix all occurrences code fix... Berechnen der Codefehlerbehebung für alle Vorkommen... @@ -4540,11 +4470,6 @@ Diese Version wird verwendet in: {2} Schnittstellen - - Locals - Lokal - - Methods Methoden @@ -4670,26 +4595,6 @@ Diese Version wird verwendet in: {2} Codeschnipsel - - All lowercase - Alles Kleinbuchstaben - - - - All uppercase - Alles Großbuchstaben - - - - First word capitalized - Erstes Wort groß geschrieben - - - - Pascal Case - Pascal-Schreibweise - - Remove document '{0}' Dokument "{0}" entfernen @@ -4850,11 +4755,6 @@ Diese Version wird verwendet in: {2} in "{0}" (Projekt "{1}") - - Add accessibility modifiers - Zugriffsmodifizierer hinzufügen - - Move declaration near reference Deklaration nahe Referenz verschieben @@ -4905,11 +4805,6 @@ Diese Version wird verwendet in: {2} Warnung: Die Iterationsvariable hat die Funktionsgrenze überschritten. - - Warning: Collection may be modified during iteration. - Warnung: Die Sammlung wird bei der Iteration möglicherweise geändert. - - universal full date/time Universelle(s) vollständige(s) Datum/Uhrzeit diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf index 3a948000364b2..2c8b4b27d0c02 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.es.xlf @@ -425,11 +425,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa No se permiten cambios durante una parada por una excepción - - Changes made in project '{0}' will not be applied while the application is running - Los cambios realizados en el proyecto "{0}" no se aplicarán mientras se esté ejecutando la aplicación - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime Uno o varios cambios provocan que el compilador cree un nuevo tipo, lo que requiere reiniciar la aplicación porque no es compatible con el tiempo de ejecución. @@ -640,11 +635,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Editar y continuar - - Edit and Continue disallowed by module - El módulo no permite editar y continuar - - Changes made in project '{0}' require restarting the application: {1} Los cambios realizados en el proyecto "{0}" requieren reiniciar la aplicación: {1} @@ -735,11 +725,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Corregir error de escritura "{0}" - - Format document - Dar formato al documento - - Formatting document Aplicando formato al documento @@ -980,11 +965,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Introducir local - - Introduce parameter - Introducir parámetro - - Introduce parameter for '{0}' Parámetro Introduce para '{0}' @@ -1165,11 +1145,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Para modificar una instrucción try/catch/finally cuando el bloque finally está activo se requiere reiniciar la aplicación. - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - Para modificar una {0} de acción que contiene instrucciones On Error o Resume se requiere reiniciar la aplicación. - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. Para modificar el cuerpo de {0}se requiere reiniciar la aplicación porque el cuerpo tiene demasiadas instrucciones. @@ -1335,11 +1310,6 @@ Asegúrese de usar el especificador "tt" para los idiomas para los que es necesa Extraer miembros hasta el tipo de base... - - Pull member(s) up to new base class... - Extraer miembros a una nueva clase base... - - Quantifier {x,y} following nothing Cuantificador {x, y} después de nada @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra Se pueden concatenar dos o más intervalos de caracteres. Por ejemplo, para especificar el intervalo de dígitos decimales de "0" a "9", el intervalo de letras minúsculas de "a" a "f" y el intervalo de letras mayúsculas de "A" a "F", utilice [0-9a-fA-F]. - - negative character range - intervalo de caracteres negativos - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. La construcción de expresión regular \P{ name } coincide con cualquier carácter que no pertenezca a una categoría general o bloque con nombre de Unicode, donde el nombre es la abreviatura de la categoría o el nombre del bloque con nombre. @@ -3765,11 +3730,6 @@ Si el especificador de formato "M" se usa sin otros especificadores de formato p Generar {0} anidado '{1}' - - Global Namespace - Espacio de nombres global - - Implement interface abstractly Implementar interfaz de forma abstracta @@ -3954,16 +3914,6 @@ Si el especificador de formato "g" se usa sin otros especificadores de formato p Tipo de miembro de interfaz inesperado: {0} - - Unknown symbol kind - Tipo de símbolo desconocido - - - - Requested assembly already loaded from '{0}'. - El ensamblado solicitado ya se ha cargado desde '{0}'. - - The symbol does not have an icon. El símbolo no tiene un icono. @@ -4095,26 +4045,6 @@ Do you want to continue? Implementar la interfaz con el patrón de Dispose - - Re-triage {0}(currently '{1}') - Volver a evaluar prioridades de {0}(valor actual: '{1}') - - - - Argument cannot have a null element. - El argumento no puede tener un elemento nulo. - - - - Argument cannot be empty. - El argumento no puede estar vacío. - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - El analizador no admite el diagnóstico notificado con identificador '{0}'. - - Computing fix all occurrences code fix... Calculando corrección de todas las repeticiones de corrección de código... @@ -4540,11 +4470,6 @@ Esta versión se utiliza en: {2} Interfaces - - Locals - Variables locales - - Methods Métodos @@ -4670,26 +4595,6 @@ Esta versión se utiliza en: {2} Fragmentos de código - - All lowercase - Todo minúsculas - - - - All uppercase - Todo mayúsculas - - - - First word capitalized - Primera palabra en mayúsculas - - - - Pascal Case - Pascal Case - - Remove document '{0}' Quitar documento "{0}" @@ -4850,11 +4755,6 @@ Esta versión se utiliza en: {2} en {0} (proyecto {1}) - - Add accessibility modifiers - Agregar modificadores de accesibilidad - - Move declaration near reference Mover la declaración cerca de la referencia @@ -4905,11 +4805,6 @@ Esta versión se utiliza en: {2} Advertencia: límite de función cruzada de variable de iteración. - - Warning: Collection may be modified during iteration. - Advertencia: es posible que la colección se modifique durante la iteración. - - universal full date/time fecha/hora completa universal diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf index d2ee7c45cf50b..99c140fb8565b 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.fr.xlf @@ -425,11 +425,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Aucun changement n'est autorisé en cas d'arrêt à la suite d'une exception - - Changes made in project '{0}' will not be applied while the application is running - Les changements apportés au projet '{0}' ne sont pas appliqués tant que l'application est en cours d'exécution - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime Une ou plusieurs modifications entraînent la création d’un nouveau type par le compilateur, ce qui requiert le redémarrage de l’application, car il n’est pas pris en charge par le runtime @@ -640,11 +635,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Modifier et continuer - - Edit and Continue disallowed by module - Fonctionnalité Modifier et Continuer interdite par le module - - Changes made in project '{0}' require restarting the application: {1} Les modifications apportées au projet « {0} » nécessitent le redémarrage de l’application : {1} @@ -735,11 +725,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Corriger la faute de frappe '{0}' - - Format document - Mettre en forme le document - - Formatting document Mise en forme du document @@ -980,11 +965,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Introduire un élément local - - Introduce parameter - Introduire le paramètre - - Introduce parameter for '{0}' Introduire le paramètre pour '{0}' @@ -1165,11 +1145,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai La modification d'une instruction try/catch/finally lorsque le bloc finally est actif requiert le redémarrage de l’application. - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - La modification d’un {0} actif qui contient des instructions On Error ou Resume requiert le redémarrage de l’application. - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. La modification du corps de {0} requiert le redémarrage de l’application, car le corps contient trop d’instructions. @@ -1335,11 +1310,6 @@ Veillez à utiliser le spécificateur "tt" pour les langues où il est nécessai Tirer les membres jusqu'au type de base... - - Pull member(s) up to new base class... - Tirer (pull) le ou les membres jusqu'à la nouvelle classe de base... - - Quantifier {x,y} following nothing Le quantificateur {x,y} ne suit rien @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra Vous pouvez concaténer au moins deux plages de caractères. Par exemple, pour spécifier la plage de chiffres décimaux allant de "0" à "9", la plage de lettres minuscules allant de "a" à "f" et la plage de lettres majuscules allant de "A" à "F", utilisez [0-9a-fA-F]. - - negative character range - plage de caractères négative - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. La construction d'expression régulière \P{ nom } correspond aux caractères qui n'appartiennent pas à une catégorie générale Unicode ou à un bloc nommé, nom étant l'abréviation de la catégorie ou le nom du bloc nommé. @@ -3765,11 +3730,6 @@ Si le spécificateur de format "M" est utilisé sans autres spécificateurs de f Générer un {0} '{1}' imbriqué - - Global Namespace - Espace de noms global - - Implement interface abstractly Implémenter l'interface abstraitement @@ -3954,16 +3914,6 @@ Si le spécificateur de format "g" est utilisé sans autres spécificateurs de f Genre de membre d'interface inattendu : {0} - - Unknown symbol kind - Genre de symbole inconnu - - - - Requested assembly already loaded from '{0}'. - L'assembly demandé est déjà chargé à partir de '{0}'. - - The symbol does not have an icon. Le symbole ne possède pas d'icône. @@ -4095,26 +4045,6 @@ Voulez-vous continuer ? Implémenter l'interface avec le modèle Dispose - - Re-triage {0}(currently '{1}') - Répétition du triage {0}(actuellement '{1}') - - - - Argument cannot have a null element. - L'argument ne peut pas avoir un élément null. - - - - Argument cannot be empty. - L'argument ne peut pas être vide. - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - Le diagnostic signalé avec l'ID '{0}' n'est pas pris en charge par l'analyseur. - - Computing fix all occurrences code fix... Calcul de la correction de toutes les occurrences (correction du code)... @@ -4540,11 +4470,6 @@ Version utilisée dans : {2} Interfaces - - Locals - Variables locales - - Methods Méthodes @@ -4670,26 +4595,6 @@ Version utilisée dans : {2} Extraits - - All lowercase - Tout en minuscules - - - - All uppercase - Tout en majuscules - - - - First word capitalized - Premier mot en majuscule - - - - Pascal Case - Casse Pascal - - Remove document '{0}' Supprimer le document '{0}' @@ -4850,11 +4755,6 @@ Version utilisée dans : {2} dans {0} (projet {1}) - - Add accessibility modifiers - Ajouter des modificateurs d'accessibilité - - Move declaration near reference Déplacer la déclaration près de la référence @@ -4905,11 +4805,6 @@ Version utilisée dans : {2} Avertissement : La variable d'itération a traversé la limite de fonction. - - Warning: Collection may be modified during iteration. - Avertissement : La collection risque d'être modifiée durant l'itération. - - universal full date/time date/heure complète universelle diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf index 455443fce332d..0dd5e200c9250 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.it.xlf @@ -425,11 +425,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Le modifiche non sono consentite in caso di arresto in corrispondenza dell'eccezione - - Changes made in project '{0}' will not be applied while the application is running - Le modifiche apportate al progetto '{0}' non verranno applicate mentre l'applicazione è in esecuzione - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime Una o più modifiche determinano la creazione di un nuovo tipo da parte del compilatore e tale operazione richiede il riavvio dell'applicazione perché non è supportata dal runtime @@ -640,11 +635,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Modifica e continuazione - - Edit and Continue disallowed by module - Modifica e continuazione non consentito dal modulo - - Changes made in project '{0}' require restarting the application: {1} Le modifiche apportate nel progetto '{0}' richiedono il riavvio dell'applicazione: {1} @@ -735,11 +725,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Correggi l'errore di ortografia '{0}' - - Format document - Formatta documento - - Formatting document Formattazione del documento @@ -980,11 +965,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Introduci variabile locale - - Introduce parameter - Introduci parametro - - Introduce parameter for '{0}' Introduci parametro per '{0}' @@ -1165,11 +1145,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Se si modifica un'istruzione try/catch/finally quando il blocco finally è attivo, è necessario riavviare l'applicazione. - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - Se si modifica un elemento {0} attivo che contiene istruzioni On Error o Resume, è necessario riavviare l'applicazione. - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. Se si modifica il corpo di {0}, è necessario riavviare l'applicazione perché il corpo contiene troppe istruzioni. @@ -1335,11 +1310,6 @@ Assicurarsi di usare l'identificatore "tt" per le lingue per le quali è necessa Esegui pull dei membri fino al tipo di base... - - Pull member(s) up to new base class... - Esegui pull dei membri fino alla nuova classe di base... - - Quantifier {x,y} following nothing Il quantificatore {x,y} non segue alcun elemento @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra Due o più intervalli di caratteri possono essere concatenati. Ad esempio, per specificare l'intervallo di cifre decimali comprese tra "0" e "9", l'intervallo di lettere minuscole comprese tra "a" e "f" e l'intervallo di lettere maiuscole comprese tra "A" e "F", usare [0-9a-fA-F]. - - negative character range - intervallo di caratteri negativi - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. Il costrutto di espressione regolare \P{ name } corrisponde a qualsiasi carattere non appartenente a una categoria generale Unicode o a un blocco denominato, dove name è l'abbreviazione della categoria o il nome del blocco denominato. @@ -3765,11 +3730,6 @@ Se l'identificatore di formato "M" viene usato senza altri identificatori di for Genera l'elemento {0} '{1}' annidato - - Global Namespace - Spazio dei nomi globale - - Implement interface abstractly Implementa l'interfaccia in modo astratto @@ -3954,16 +3914,6 @@ Se l'identificatore di formato "g" viene usato senza altri identificatori di for Tipo di membro di interfaccia imprevisto: {0} - - Unknown symbol kind - Tipo di simbolo sconosciuto - - - - Requested assembly already loaded from '{0}'. - L'assembly richiesto è già stato caricato da '{0}'. - - The symbol does not have an icon. Per il simbolo non esiste un'icona. @@ -4095,26 +4045,6 @@ Continuare? Implementa l'interfaccia con il criterio Dispose - - Re-triage {0}(currently '{1}') - Valuta di nuovo {0} (attualmente '{1}') - - - - Argument cannot have a null element. - L'argomento non può contenere un elemento Null. - - - - Argument cannot be empty. - L'argomento non può essere vuoto. - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - La diagnostica restituita con ID '{0}' non è supportata dall'analizzatore. - - Computing fix all occurrences code fix... Calcolo di tutte le occorrenze da correggere nel codice... @@ -4540,11 +4470,6 @@ Questa versione è usata {2} Interfacce - - Locals - Variabili locali - - Methods Metodi @@ -4670,26 +4595,6 @@ Questa versione è usata {2} Frammenti - - All lowercase - Tutto minuscole - - - - All uppercase - Tutto maiuscole - - - - First word capitalized - Prima lettera maiuscola - - - - Pascal Case - Notazione Pascal - - Remove document '{0}' Rimuovi il documento '{0}' @@ -4850,11 +4755,6 @@ Questa versione è usata {2} in {0} (progetto {1}) - - Add accessibility modifiers - Aggiungi i modificatori di accessibilità - - Move declaration near reference Sposta la dichiarazione accanto al riferimento @@ -4905,11 +4805,6 @@ Questa versione è usata {2} Avviso: la variabile di iterazione ha superato il limite della funzione. - - Warning: Collection may be modified during iteration. - Avviso: è possibile che la raccolta venga modificata durante l'iterazione. - - universal full date/time Data/ora estesa universale diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf index ea39b7008256a..a89a3503a7291 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ja.xlf @@ -425,11 +425,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 例外で停止中は変更できません - - Changes made in project '{0}' will not be applied while the application is running - プロジェクト '{0}' で行った変更は、アプリケーションの実行中には適用されません - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime 1 つ以上の変更によって、新しい型がコンパイラによって作成されています。これはランタイムでサポートされていないため、アプリケーションを再起動する必要があります。 @@ -640,11 +635,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma エディット コンティニュ - - Edit and Continue disallowed by module - エディット コンティニュはモジュールで許可されませんでした - - Changes made in project '{0}' require restarting the application: {1} プロジェクト '{0}' で加えられた変更にはアプリケーションの再起動が必要です: {1} @@ -735,11 +725,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma '{0}' の入力ミスを修正します - - Format document - ドキュメントのフォーマット - - Formatting document ドキュメントの書式設定 @@ -980,11 +965,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma ローカルを導入します - - Introduce parameter - パラメーターを導入する - - Introduce parameter for '{0}' '{0}' のパラメーターを導入する @@ -1165,11 +1145,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma finally ブロックがアクティブのときに try/catch/finally ステートメントを変更するには、アプリケーションを再起動する必要があります。 - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - On Error ステートメントまたは Resume ステートメントを含むアクティブ {0} を変更するには、アプリケーションを再起動する必要があります。 - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. 本文のステートメントが多すぎるため、{0} の本文を変更するには、アプリケーションを再起動する必要があります。 @@ -1335,11 +1310,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 基本型のメンバーをプル... - - Pull member(s) up to new base class... - メンバーを新しい基底クラスに引き上げます... - - Quantifier {x,y} following nothing 量指定子 {x,y} の前に何もありません @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra 2 つ以上の文字範囲を連結することができます。たとえば、"0" から "9" の範囲の 10 進数、"a" から "f" の範囲の小文字、"A" から "F" の範囲の大文字を指定するには、[0-9a-fA-F] を使用します。 - - negative character range - 文字範囲の否定 - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. 正規表現のコンストラクト \P{ name } は、Unicode 一般カテゴリにも名前付きブロックにも属さない任意の文字と一致します。ここで、name はカテゴリの省略形または名前付きブロックの名前です。 @@ -3765,11 +3730,6 @@ If the "M" format specifier is used without other custom format specifiers, it's 入れ子 {0} '{1}' を生成する - - Global Namespace - グローバル名前空間 - - Implement interface abstractly インタ フェースを抽象的に実装します @@ -3954,16 +3914,6 @@ If the "g" format specifier is used without other custom format specifiers, it's 予期しないインターフェイス メンバーの種類: {0} - - Unknown symbol kind - 不明なシンボルの種類 - - - - Requested assembly already loaded from '{0}'. - 要求されたアセンブリは、既に '{0}' から読み込まれています。 - - The symbol does not have an icon. シンボルにアイコンがありません。 @@ -4095,26 +4045,6 @@ Do you want to continue? 破棄パターンを使ってインターフェイスを実装します - - Re-triage {0}(currently '{1}') - 再トリアージ {0} (現在は '{1}') - - - - Argument cannot have a null element. - 引数に null 要素は指定できません。 - - - - Argument cannot be empty. - 引数を空にすることはできません。 - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - ID '{0}' の報告済みの診断はアナライザーによってサポートされていません。 - - Computing fix all occurrences code fix... 出現箇所をすべて修正するコード修正プログラムを計算しています... @@ -4540,11 +4470,6 @@ This version used in: {2} インターフェイス - - Locals - ローカル - - Methods メソッド @@ -4670,26 +4595,6 @@ This version used in: {2} スニペット - - All lowercase - すべて小文字 - - - - All uppercase - すべて大文字 - - - - First word capitalized - 最初の文字を大文字にする - - - - Pascal Case - パスカル ケース - - Remove document '{0}' ドキュメント '{0}' の削除 @@ -4850,11 +4755,6 @@ This version used in: {2} {0} (プロジェクト{1}) - - Add accessibility modifiers - アクセシビリティ修飾子を追加します - - Move declaration near reference 宣言を参照の近くに移動します @@ -4905,11 +4805,6 @@ This version used in: {2} 警告: 繰り返し変数が関数の境界を超えました。 - - Warning: Collection may be modified during iteration. - 警告: 反復処理中にコレクションが変更される可能性があります。 - - universal full date/time 世界共通の完全な日付/時刻 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf index 65b3282185426..7a27e6dc900ba 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ko.xlf @@ -425,11 +425,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 예외에서 중지된 동안에는 변경할 수 없습니다. - - Changes made in project '{0}' will not be applied while the application is running - 애플리케이션이 실행되는 동안에는 '{0}' 프로젝트의 변경 내용이 적용되지 않습니다. - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime 하나 이상의 변경으로 인해 컴파일러에서 새 유형이 생성되며 런타임에서 지원하지 않기 때문에 응용 프로그램을 다시 시작해야 합니다. @@ -640,11 +635,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 편집하며 계속하기 - - Edit and Continue disallowed by module - 모듈에서 편집하며 계속하기를 허용하지 않음 - - Changes made in project '{0}' require restarting the application: {1} ' {0}' 프로젝트에서 변경한 내용을 적용하려면 응용 프로그램 ‘{1}’을(를) 다시 시작 해야 합니다. @@ -735,11 +725,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 오타 '{0}' 수정 - - Format document - 문서 서식 - - Formatting document 문서 서식을 지정하는 중 @@ -980,11 +965,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 로컬 소개 - - Introduce parameter - 매개 변수 지정 - - Introduce parameter for '{0}' '{0}'에 대한 매개 변수 지정 @@ -1165,11 +1145,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma finally 블록이 활성 상태일 때 try/catch/finally 문을 수정하려면 응용 프로그램을 다시 시작해야 합니다. - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - On Error 또는 Resume 문이 포함된 활성 {0}을 수정하려면 응용 프로그램을 다시 시작해야 합니다. - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. 본문에 문이 너무 많기 때문에 {0}의 본문을 수정하려면 애플리케이션을 다시 시작해야 합니다. @@ -1335,11 +1310,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 기본 형식까지 멤버를 풀... - - Pull member(s) up to new base class... - 새 기본 클래스까지 멤버를 풀하세요... - - Quantifier {x,y} following nothing 수량자 {x,y} 앞에 아무 것도 없습니다. @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra 둘 이상의 문자 범위를 연결할 수 있습니다. 예를 들어 "0"에서 "9"까지의 10진수 범위, "a"에서 "f"까지의 소문자 범위 및 "A"에서 "F"까지의 대문자 범위를 지정하려면 [0-9a-fA-F]를 사용합니다. - - negative character range - 부정 문자 범위 - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. 정규식 구문 \P{ name }는 유니코드 일반 범주 또는 명명된 블록에 속하지 않는 모든 문자와 일치시킵니다. 여기서, name은 범주 약어 또는 명명된 블록 이름입니다. @@ -3765,11 +3730,6 @@ If the "M" format specifier is used without other custom format specifiers, it's 중첩된 {0} '{1}' 생성 - - Global Namespace - 전역 네임스페이스 - - Implement interface abstractly 추상적으로 인터페이스 구현 @@ -3954,16 +3914,6 @@ If the "g" format specifier is used without other custom format specifiers, it's 예기치 않은 인터페이스 멤버 종류: {0} - - Unknown symbol kind - 알 수 없는 기호 종류 - - - - Requested assembly already loaded from '{0}'. - 요청한 어셈블리가 이미 '{0}'에서 로드되었습니다. - - The symbol does not have an icon. 기호에 아이콘이 없습니다. @@ -4095,26 +4045,6 @@ Do you want to continue? 인터페이스를 Dispose 패턴으로 구현 - - Re-triage {0}(currently '{1}') - {0}(현재 '{1}') 다시 심사 - - - - Argument cannot have a null element. - 인수에는 null 요소가 있을 수 없습니다. - - - - Argument cannot be empty. - 인수는 비워 둘 수 없습니다. - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - ID가 '{0}'인 보고된 진단이 분석기에서 지원되지 않습니다. - - Computing fix all occurrences code fix... 모든 항목 코드 수정 사항을 계산하는 중... @@ -4540,11 +4470,6 @@ This version used in: {2} 인터페이스 - - Locals - 로컬 항목 - - Methods 메서드 @@ -4670,26 +4595,6 @@ This version used in: {2} 코드 조각 - - All lowercase - 모두 소문자 - - - - All uppercase - 모두 대문자 - - - - First word capitalized - 첫 글자 대문자로 표시 - - - - Pascal Case - 파스칼식 대/소문자 - - Remove document '{0}' 문서 '{0}' 제거 @@ -4850,11 +4755,6 @@ This version used in: {2} {0}(프로젝트 {1}) - - Add accessibility modifiers - 접근성 한정자 추가 - - Move declaration near reference 참조 근처로 선언 이동 @@ -4905,11 +4805,6 @@ This version used in: {2} 경고: 반복 변수가 함수 경계를 벗어났습니다. - - Warning: Collection may be modified during iteration. - 경고: 반복 계산 중 컬렉션이 수정될 수 있습니다. - - universal full date/time 범용 전체 날짜/시간 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf index 1b29d30dc64db..0d28cbed426b0 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pl.xlf @@ -425,11 +425,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Zmiany nie są dozwolone, gdy wyjątek został zatrzymany - - Changes made in project '{0}' will not be applied while the application is running - Zmiany wprowadzone w projekcie „{0}” nie zostaną zastosowane, gdy aplikacja jest uruchomiona - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime Co najmniej jedna zmiana powoduje utworzenie nowego typu przez kompilator, co wymaga ponownego uruchomienia aplikacji, ponieważ nie jest ona obsługiwana przez środowisko uruchomieniowe @@ -640,11 +635,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Edytuj i kontynuuj - - Edit and Continue disallowed by module - Edycja i kontynuowanie niedozwolone przez moduł - - Changes made in project '{0}' require restarting the application: {1} Zmiany wprowadzone w projekcie „{0}” wymagają ponownego uruchomienia aplikacji: {1} @@ -735,11 +725,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Popraw błąd pisowni „{0}” - - Format document - Formatuj dokument - - Formatting document Trwa formatowanie dokumentu... @@ -980,11 +965,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Wprowadź zmienną lokalną - - Introduce parameter - Wprowadź parametr - - Introduce parameter for '{0}' Wprowadź parametr dla elementu "{0}" @@ -1165,11 +1145,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Modyfikowanie instrukcji try/catch/finally, gdy blok finally jest aktywny, wymaga ponownego uruchomienia aplikacji. - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - Modyfikowanie aktywnego słowa kluczowego {0}, które zawiera w instrukcjach On Error lub Resume, wymaga ponownego uruchomienia aplikacji. - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. Modyfikacja treści elementu {0} wymaga ponownego uruchomienia aplikacji, ponieważ treść zawiera zbyt wiele instrukcji. @@ -1335,11 +1310,6 @@ Pamiętaj, aby nie używać specyfikatora „tt” dla wszystkich języków, w k Ściągnij składowe aż do typu bazowego... - - Pull member(s) up to new base class... - Ściągnij skladowe do nowej klasy bazowej... - - Quantifier {x,y} following nothing Nic nie występuje przed kwantyfikatorem {x,y} @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra Można połączyć dwa lub więcej zakresów znaków. Na przykład aby określić zakres cyfr dziesiętnych od „0” do „9”, zakres małych liter od „a” do „f” i zakres wielkich liter od „A” do „F”, użyj elementu [0-9A-fA-F]. - - negative character range - negatywny zakres znaków - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. Konstrukcja wyrażenia regularnego \P{ nazwa } pasuje do dowolnego znaku, który nie należy do kategorii ogólnej znaków Unicode ani do bloku nazwanego, gdzie „nazwa” to skrót kategorii lub nazwa bloku nazwanego. @@ -3765,11 +3730,6 @@ Jeśli specyfikator formatu „M” jest używany bez innych niestandardowych sp Generuj zagnieżdżony element {0} „{1}” - - Global Namespace - Globalna przestrzeń nazw - - Implement interface abstractly Implementuj interfejs abstrakcyjnie @@ -3954,16 +3914,6 @@ Jeśli specyfikator formatu „g” jest używany bez innych niestandardowych sp Nieoczekiwany rodzaj składowej interfejsu: {0} - - Unknown symbol kind - Nieznany rodzaj symbolu - - - - Requested assembly already loaded from '{0}'. - Żądany zestaw został już załadowany z elementu „{0}”. - - The symbol does not have an icon. Symbol nie ma ikony. @@ -4095,26 +4045,6 @@ Czy chcesz kontynuować? Implementuj interfejs za pomocą wzorca likwidacji - - Re-triage {0}(currently '{1}') - Sklasyfikuj ponownie element {0} (obecnie „{1}”) - - - - Argument cannot have a null element. - Argument nie może zawierać elementu o wartości null. - - - - Argument cannot be empty. - Argument nie może być pusty. - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - Zgłoszona diagnostyka z identyfikatorem „{0}” nie jest obsługiwana przez analizatora. - - Computing fix all occurrences code fix... Trwa obliczanie poprawki kodu naprawiającej wszystkie obliczenia... @@ -4540,11 +4470,6 @@ Ta wersja jest używana wersja: {2} Interfejsy - - Locals - Elementy lokalne - - Methods Metody @@ -4670,26 +4595,6 @@ Ta wersja jest używana wersja: {2} Fragmenty kodu - - All lowercase - Same małe litery - - - - All uppercase - Same wielkie litery - - - - First word capitalized - Pierwsze słowo wielką literą - - - - Pascal Case - PascalCase - - Remove document '{0}' Usuń dokument „{0}” @@ -4850,11 +4755,6 @@ Ta wersja jest używana wersja: {2} w {0} (projekt {1}) - - Add accessibility modifiers - Dodaj modyfikatory dostępności - - Move declaration near reference Przenieś deklarację blisko odwołania @@ -4905,11 +4805,6 @@ Ta wersja jest używana wersja: {2} Ostrzeżenie: zmienna iteracji przekroczyła granicę funkcji. - - Warning: Collection may be modified during iteration. - Ostrzeżenie: kolekcja mogła zostać zmodyfikowana podczas iteracji. - - universal full date/time uniwersalna pełna data/godzina diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf index 487b33031fcaf..36fa438eb0eb8 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.pt-BR.xlf @@ -425,11 +425,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Não são permitidas alterações durante uma interrupção em exceção - - Changes made in project '{0}' will not be applied while the application is running - As alterações feitas no projeto '{0}' não serão aplicadas enquanto o aplicativo estiver em execução - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime Uma ou mais alterações resultam no compilador criando um novo tipo, o que requer a reinicialização do aplicativo porque não há suporte para ele no runtime @@ -640,11 +635,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Editar e Continuar - - Edit and Continue disallowed by module - Pelo módulo, não é permitido Editar e Continuar - - Changes made in project '{0}' require restarting the application: {1} As alterações feitas no projeto '{0}' requerem a reinicialização do aplicativo: {1} @@ -735,11 +725,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Corrigir erro de digitação '{0}' - - Format document - Formatar o documento - - Formatting document Formatando documento @@ -980,11 +965,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Introduzir o local - - Introduce parameter - Apresentar parâmetro - - Introduce parameter for '{0}' Apresentar parâmetro para '{0}' @@ -1165,11 +1145,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Modificar uma instrução try/catch/finally quando o bloco finally estiver ativo requer a reinicialização do aplicativo. - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - Modificar um {0} ativo que contém instruções On Error ou Resume requer a reinicialização do aplicativo. - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. Modificar o corpo de {0} requer reiniciar o aplicativo porque o corpo tem muitas instruções. @@ -1335,11 +1310,6 @@ Verifique se o especificador "tt" foi usado para idiomas para os quais é necess Efetuar pull de membros até o tipo base... - - Pull member(s) up to new base class... - Efetuar pull de membros até a nova classe base... - - Quantifier {x,y} following nothing Nada precede o quantificador {x,y} @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra Dois ou mais intervalos de caracteres podem ser concatenados. Por exemplo, para especificar o intervalo de dígitos decimais de "0" a "9", o intervalo de letras minúsculas de "a" até "f" e o intervalo de letras maiúsculas de "A" até "F", use [0-9a-fA-F]. - - negative character range - intervalo de caracteres negativos - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. O constructo de expressão regular \P{ name } corresponde a qualquer caractere que não pertença a uma categoria Unicode genérica nem a um bloco nomeado, em que o nome seja a abreviação da categoria ou o nome do bloco nomeado. @@ -3765,11 +3730,6 @@ Se o especificador de formato "M" for usado sem outros especificadores de format Gerar {0} '{1}' aninhado - - Global Namespace - Namespace Global - - Implement interface abstractly Implementar interface de forma abstrata @@ -3954,16 +3914,6 @@ Se o especificador de formato "g" for usado sem outros especificadores de format Tipo de membro de interface inesperado: {0} - - Unknown symbol kind - Tipo de símbolo desconhecido - - - - Requested assembly already loaded from '{0}'. - Assembly solicitado já carregado de "{0}". - - The symbol does not have an icon. O símbolo não tem um ícone. @@ -4095,26 +4045,6 @@ Deseja continuar? Implementar interface com Padrão de descarte - - Re-triage {0}(currently '{1}') - Fazer nova triagem de {0}(no momento, "{1}") - - - - Argument cannot have a null element. - O argumento não pode ter um elemento nulo. - - - - Argument cannot be empty. - O argumento não pode estar vazio. - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - O analisador não dá suporte ao diagnóstico relatado com ID '{0}'. - - Computing fix all occurrences code fix... Computando a correção de todas as correções de código de ocorrências… @@ -4540,11 +4470,6 @@ Essa versão é usada no: {2} Interfaces - - Locals - Locais - - Methods Métodos @@ -4670,26 +4595,6 @@ Essa versão é usada no: {2} Snippets - - All lowercase - Tudo em minúsculas - - - - All uppercase - Tudo em maiúsculas - - - - First word capitalized - Primeira palavra em maiúsculas - - - - Pascal Case - Pascal Case - - Remove document '{0}' Remover documento '{0}' @@ -4850,11 +4755,6 @@ Essa versão é usada no: {2} em {0} (projeto {1}) - - Add accessibility modifiers - Adicionar modificadores de acessibilidade - - Move declaration near reference Mover declaração para próximo da referência @@ -4905,11 +4805,6 @@ Essa versão é usada no: {2} Aviso: a variável de iteração passou o limite da função. - - Warning: Collection may be modified during iteration. - Aviso: a coleção pode ser modificada durante a iteração. - - universal full date/time data/hora universal por extenso diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf index 66948a7297ce7..128c0be453e68 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.ru.xlf @@ -425,11 +425,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Изменения запрещены, когда выполнение остановлено при исключении - - Changes made in project '{0}' will not be applied while the application is running - Изменения, внесенные в проект "{0}", не будут применены во время выполнения приложения. - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime Одно или несколько изменений приведут к созданию нового типа компилятором. Это не поддерживается средой выполнения, поэтому требуется перезапустить приложение. @@ -640,11 +635,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Операция "Изменить и продолжить" - - Edit and Continue disallowed by module - Операция "Изменить и продолжить" запрещена модулем - - Changes made in project '{0}' require restarting the application: {1} После внесения изменений в проект "{0}" необходимо перезапустить приложение: {1} @@ -735,11 +725,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Исправьте опечатку "{0}" - - Format document - Форматировать документ - - Formatting document Форматирование документа @@ -980,11 +965,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Добавить локальный оператор - - Introduce parameter - Ввести параметр - - Introduce parameter for '{0}' Ввести параметр для "{0}" @@ -1165,11 +1145,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Для изменения оператора try/catch/finally при активном блоке finally требуется перезапустить приложение. - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - Для изменения активного {0} с операторами On Error или Resume требуется перезапустить приложение. - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. Для изменения тела {0} требуется перезапустить приложение, так как в теле содержится слишком много операторов. @@ -1335,11 +1310,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma Извлечь элементы до базового типа... - - Pull member(s) up to new base class... - Получение элементов для нового базового класса... - - Quantifier {x,y} following nothing Отсутствуют элементы перед квантификатором {x,y} @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra Можно сцепить два или более диапазонов символов. Например, чтобы указать диапазон десятичных цифр от 0 до 9, диапазон строчных букв от a до f и диапазон прописных букв от A до F, используйте [0-9a-fA-F]. - - negative character range - отрицательный диапазон символов - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. Конструкция регулярного выражения \P{ имя } соответствует любому символу, который не относится к общей категории Юникода или именованному блоку, где "имя" — это сокращение названия категории или имя именованного блока. @@ -3765,11 +3730,6 @@ If the "M" format specifier is used without other custom format specifiers, it's Создать вложенный {0} "{1}" - - Global Namespace - Глобальное пространство имен - - Implement interface abstractly Реализовать интерфейс абстрактно @@ -3954,16 +3914,6 @@ If the "g" format specifier is used without other custom format specifiers, it's Непредвиденный тип члена интерфейса: {0} - - Unknown symbol kind - Неизвестный тип символа - - - - Requested assembly already loaded from '{0}'. - Запрошенная сборка уже загружена из "{0}". - - The symbol does not have an icon. Символ не имеет значка. @@ -4095,26 +4045,6 @@ Do you want to continue? Внедрите интерфейс с шаблоном освобождения - - Re-triage {0}(currently '{1}') - Повторное рассмотрение {0} (в настоящее время "{1}") - - - - Argument cannot have a null element. - Аргумент не может содержать элемент NULL. - - - - Argument cannot be empty. - Аргумент не может быть пустым. - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - Зарегистрированное диагностическое событие с идентификатором "{0}" не поддерживается в анализаторе. - - Computing fix all occurrences code fix... Вычисление изменения кода для исправления всех вхождений... @@ -4540,11 +4470,6 @@ This version used in: {2} Интерфейсы - - Locals - Локальные переменные - - Methods Методы @@ -4670,26 +4595,6 @@ This version used in: {2} Фрагменты кода - - All lowercase - Все строчные - - - - All uppercase - Все прописные - - - - First word capitalized - Первое слово с прописной буквы - - - - Pascal Case - ВсеЧастиСПрописнойБуквы - - Remove document '{0}' Удалить документ "{0}" @@ -4850,11 +4755,6 @@ This version used in: {2} в {0} (проект {1}) - - Add accessibility modifiers - Добавьте модификаторы доступности - - Move declaration near reference Переместить объявление рядом со ссылкой @@ -4905,11 +4805,6 @@ This version used in: {2} Внимание! Переменная итерации вышла за границу функции. - - Warning: Collection may be modified during iteration. - Внимание! Коллекция может быть изменена во время итерации. - - universal full date/time Универсальный полный формат даты-времени diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf index d3018db78b3f1..8af91c4f865b1 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.tr.xlf @@ -425,11 +425,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Özel durum sırasında durdurulduğunda değişikliklere izin verilmez - - Changes made in project '{0}' will not be applied while the application is running - '{0}' projesinde yapılan değişiklikler, uygulama çalışırken uygulanmayacak - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime Bir veya daha fazla değişiklik, derleyici tarafından yeni bir türün oluşturulmasına neden olur ve bu, çalışma zamanı tarafından desteklenmediği için uygulamanın yeniden başlatılmasını gerektirir. @@ -640,11 +635,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Düzenle ve Devam Et - - Edit and Continue disallowed by module - Düzenle ve Devam Et'e modül tarafından izin verilmiyor - - Changes made in project '{0}' require restarting the application: {1} '{0}' projesinde yapılan değişiklikler uygulamanın yeniden başlatılmasını gerektiriyor: {1} @@ -735,11 +725,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be '{0}' yazım hatasını düzeltin - - Format document - Belgeyi biçimlendir - - Formatting document Belge biçimlendiriliyor @@ -980,11 +965,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Yerel ekle - - Introduce parameter - Parametre ekle - - Introduce parameter for '{0}' {0} için parametre ekle @@ -1165,11 +1145,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Finally bloğu etkin olduğunda bir try/catch/finally deyimini değiştirme, uygulamanın yeniden başlatılmasını gerektirir. - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - On Error veya Resume ifadelerini içeren etkin bir {0} öğesinin değiştirilmesi uygulamanın yeniden başlatılmasını gerektirir. - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. {0} öğesinin gövdesinin değiştirilmesi, gövdenin çok fazla ifadesi olduğundan uygulamanın yeniden başlatılmasını gerektirir. @@ -1335,11 +1310,6 @@ AM ve PM arasındaki farkın korunmasının gerekli olduğu diller için "tt" be Üyeleri temel türe çek... - - Pull member(s) up to new base class... - Üyeleri yeni temel sınıfa çek... - - Quantifier {x,y} following nothing Niceleyici {x, y} hiçbir şeyi takip etmiyor @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra İki veya daha fazla karakter aralığı art arda eklenebilir. Örneğin, "0" ile "9" arasındaki ondalık sayıların aralığını, "a" ile "f" arasında küçük harflerin aralığını ve "A" ile "F" arasındaki büyük harflerin aralığını belirtmek için [0-9a-fA-F] kullanın. - - negative character range - negatif karakter aralığı - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. \P{ name } normal ifade yapısı, Unicode genel kategorisine veya adın kategori kısaltması ya da adlandırılmış blok adı olduğu adlandırılmış bloğa ait olmayan herhangi bir karakterle eşleşir. @@ -3765,11 +3730,6 @@ If the "M" format specifier is used without other custom format specifiers, it's İç içe {0} '{1}' oluştur - - Global Namespace - Genel Ad Uzayı - - Implement interface abstractly Arabirimi soyut olarak uygula @@ -3954,16 +3914,6 @@ If the "g" format specifier is used without other custom format specifiers, it's Beklenmeyen arabirim üyesi türü: {0} - - Unknown symbol kind - Bilinmeyen sembol türü - - - - Requested assembly already loaded from '{0}'. - '{0}' kaynağından zaten yüklenmiş olan derleme istendi. - - The symbol does not have an icon. Sembolde simge bulunmuyor. @@ -4095,26 +4045,6 @@ Devam etmek istiyor musunuz? Ara birimi Dispose düzeniyle uygula - - Re-triage {0}(currently '{1}') - {0} öğesini yeniden değerlendir (şu an '{1}') - - - - Argument cannot have a null element. - Bağımsız değişken null öğe içeremez. - - - - Argument cannot be empty. - Bağımsız değişken boş olamaz. - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - '{0}' kimliği ile bildirilen tanılama, çözümleyici tarafından desteklenmiyor. - - Computing fix all occurrences code fix... Geçtiği her yerde düzeltme kod düzeltmesi hesaplanıyor... @@ -4540,11 +4470,6 @@ Bu sürüm şurada kullanılır: {2} Arabirimler - - Locals - Yerel Öğeler - - Methods Metotlar @@ -4670,26 +4595,6 @@ Bu sürüm şurada kullanılır: {2} Kod Parçacıkları - - All lowercase - Tümü küçük harf - - - - All uppercase - Tümü büyük harf - - - - First word capitalized - İlk sözcüğün baş harfi büyük - - - - Pascal Case - Baş Harfleri Büyük Olmak Üzere Bitişik - - Remove document '{0}' '{0}' belgesini kaldır @@ -4850,11 +4755,6 @@ Bu sürüm şurada kullanılır: {2} {0} içinde (proje {1}) - - Add accessibility modifiers - Erişilebilirlik değiştiricileri Ekle - - Move declaration near reference Bildirimi başvurunun yanına taşı @@ -4905,11 +4805,6 @@ Bu sürüm şurada kullanılır: {2} Uyarı: Yineleme değişkeni, işlev sınırını geçti. - - Warning: Collection may be modified during iteration. - Uyarı: Yineleme sırasında koleksiyon değiştirilebilir. - - universal full date/time evrensel tam tarih/saat diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf index a0c4ec25789a1..d5958107e1408 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hans.xlf @@ -425,11 +425,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 在出现异常而停止时禁止更改 - - Changes made in project '{0}' will not be applied while the application is running - 在应用程序运行时,将不应用在项目“{0}”中所作的更改 - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime 一个或多个更改导致编译器创建新类型,这需要重新启动应用程序,因为运行时不支持该应用程序 @@ -640,11 +635,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 编辑并继续 - - Edit and Continue disallowed by module - 模块已禁用“编辑并继续” - - Changes made in project '{0}' require restarting the application: {1} 在项目“{0}”中所做的更改要求重新启动应用程序: {1} @@ -735,11 +725,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 修正笔误“{0}” - - Format document - 设置文档的格式 - - Formatting document 设置文档格式 @@ -980,11 +965,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 引入局部 - - Introduce parameter - 引入参数 - - Introduce parameter for '{0}' 为 '{0}' 引入参数 @@ -1165,11 +1145,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 在 finally 块处于活动状态时修改 try/catch/finally 语句需要重新启动应用程序。 - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - 修改包含 On Error 或 Resume 语句的活动 {0} 需要重新启动应用程序。 - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. 修改 {0} 的正文需要重启应用程序,因为正文的语句太多。 @@ -1335,11 +1310,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 将成员拉到基类... - - Pull member(s) up to new base class... - 将成员拉取到新的基类... - - Quantifier {x,y} following nothing 限定符 {x,y} 前没有任何内容 @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra 可以连接两个或更多字符范围。例如,若要指定从 "0" 到 "9" 的十进制数字范围、从 "a" 到 "f" 的小写字母范围以及从 "A" 到 "F" 的大写字母范围,请使用 [0-9a-fA-F]。 - - negative character range - 负字符范围 - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. 正则表达式构造 \P{name} 匹配不属于 Unicode 通用类别或命名块的任何字符,其中 "name" 是类别缩写或命名块名称。 @@ -3765,11 +3730,6 @@ If the "M" format specifier is used without other custom format specifiers, it's 生成嵌套的 {0}“{1}” - - Global Namespace - 全局命名空间 - - Implement interface abstractly 以抽象方式实现接口 @@ -3954,16 +3914,6 @@ If the "g" format specifier is used without other custom format specifiers, it's 意外的接口成员种类:{0} - - Unknown symbol kind - 未知符号种类 - - - - Requested assembly already loaded from '{0}'. - 已从“{0}”中加载请求的程序集。 - - The symbol does not have an icon. 此符号无图标。 @@ -4095,26 +4045,6 @@ Do you want to continue? 通过释放模式实现接口 - - Re-triage {0}(currently '{1}') - 对 {0}(当前为“{1}”) 进行重新分类 - - - - Argument cannot have a null element. - 参数不能具有 null 元素。 - - - - Argument cannot be empty. - 参数不能为空。 - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - 分析器不支持 ID 为“{0}”的报告的诊断。 - - Computing fix all occurrences code fix... 正在计算“修复所有出现的地方”代码修复... @@ -4540,11 +4470,6 @@ This version used in: {2} 接口 - - Locals - 局部变量 - - Methods 方法 @@ -4670,26 +4595,6 @@ This version used in: {2} 片段 - - All lowercase - 全部小写 - - - - All uppercase - 全部大写 - - - - First word capitalized - 第一个单词首字母大写 - - - - Pascal Case - 帕斯卡拼写法 - - Remove document '{0}' 删除文档“{0}” @@ -4850,11 +4755,6 @@ This version used in: {2} 在 {0} (项目 {1})中 - - Add accessibility modifiers - 添加可访问性修饰符 - - Move declaration near reference 将声明移动至引用附近 @@ -4905,11 +4805,6 @@ This version used in: {2} 警告: 迭代变量跨函数边界。 - - Warning: Collection may be modified during iteration. - 警告: 迭代期间可能修改集合。 - - universal full date/time 通用完整日期/时间 diff --git a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf index b99c88ed17b96..8d00760abc400 100644 --- a/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf +++ b/src/Features/Core/Portable/xlf/FeaturesResources.zh-Hant.xlf @@ -425,11 +425,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 於例外狀況停止時不允許變更 - - Changes made in project '{0}' will not be applied while the application is running - 將不會在應用程式執行時套用在專案 '{0}' 中所做的變更 - - One or more changes result in a new type being created by the compiler, which requires restarting the application because it is not supported by the runtime 一個或多個變更會產生由編譯器所建立的新類型,而這需要重新啟動應用程式,因為執行階段不支援它 @@ -640,11 +635,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 編輯並繼續 - - Edit and Continue disallowed by module - 模組不允許編輯和繼續 - - Changes made in project '{0}' require restarting the application: {1} 在專案 '{0}' 中所做的變更需要重新啟動應用程式: {1} @@ -735,11 +725,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 修正錯字 '{0}' - - Format document - 格式化文件 - - Formatting document 正在將文件格式化 @@ -980,11 +965,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 引進區域函式 - - Introduce parameter - 引入參數 - - Introduce parameter for '{0}' 引入 '{0}' 的參數 @@ -1165,11 +1145,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 當 Finally 區塊仍在作用中時修改 try/catch/finally 陳述式,需要重新啟動應用程式。 - - Modifying an active {0} which contains On Error or Resume statements requires restarting the application. - 修改包含 On Error 或 Resume 陳述式的作用中 {0} 需要重新啟動應用程式。 - {Locked="On Error"}{Locked="Resume"} is VB keyword and should not be localized. - Modifying the body of {0} requires restarting the application because the body has too many statements. 修改 {0} 的本文需要重新啟動應用程式,因為本文有太多陳述式。 @@ -1335,11 +1310,6 @@ Make sure to use the "tt" specifier for languages for which it's necessary to ma 將成員提取直到基底類型... - - Pull member(s) up to new base class... - 將成員提取至新的基底類別... - - Quantifier {x,y} following nothing 數量詞 {x,y} 前面沒有任何項目 @@ -2011,11 +1981,6 @@ Two or more character ranges can be concatenated. For example, to specify the ra 可串連二或多個字元範圍。舉例來說,如果要指定十進位數字的範圍 (從 "0" 到 "9"),則小寫字母的範圍為 "a" 到 "f",大寫字母的範圍為 "A" 到 "F",使用 [0-9a-fA-F]。 - - negative character range - 負值字元範圍 - - The regular expression construct \P{ name } matches any character that does not belong to a Unicode general category or named block, where name is the category abbreviation or named block name. 規則運算式建構 \P{ name } 會比對任何不屬於 Unicode 一般分類或具名區塊的字元,其中名稱為分類縮寫或具名區塊名稱。 @@ -3765,11 +3730,6 @@ If the "M" format specifier is used without other custom format specifiers, it's 產生巢狀 {0} '{1}' - - Global Namespace - 全域命名空間 - - Implement interface abstractly 以抽象方式實作介面 @@ -3954,16 +3914,6 @@ If the "g" format specifier is used without other custom format specifiers, it's 未預期的介面成員種類: {0} - - Unknown symbol kind - 符號種類不明 - - - - Requested assembly already loaded from '{0}'. - 已從 '{0}' 載入所要求的組件。 - - The symbol does not have an icon. 這個符號沒有圖示。 @@ -4095,26 +4045,6 @@ Do you want to continue? 使用 Dispose 模式實作介面 - - Re-triage {0}(currently '{1}') - 重新分級 {0}(目前為 '{1}') - - - - Argument cannot have a null element. - 引數不能有 null 元素。 - - - - Argument cannot be empty. - 引數不可為空白。 - - - - Reported diagnostic with ID '{0}' is not supported by the analyzer. - 分析器不支援識別碼為 '{0}' 的回報診斷。 - - Computing fix all occurrences code fix... 正在計算修正所有出現程式碼修正之處... @@ -4540,11 +4470,6 @@ This version used in: {2} 介面 - - Locals - 區域變數 - - Methods 方法 @@ -4670,26 +4595,6 @@ This version used in: {2} 程式碼片段 - - All lowercase - 允許小寫 - - - - All uppercase - 允許大寫 - - - - First word capitalized - 第一個字大寫 - - - - Pascal Case - Pascal 命名法的大小寫 - - Remove document '{0}' 移除文件 '{0}' @@ -4850,11 +4755,6 @@ This version used in: {2} 在 {0} 中 (專案 {1}) - - Add accessibility modifiers - 新增協助工具修飾元 - - Move declaration near reference 將宣告移近參考 @@ -4905,11 +4805,6 @@ This version used in: {2} 警告: 反覆運算變數已跨越函式界線 - - Warning: Collection may be modified during iteration. - 警告: 集合可能於反覆運算期間被修改 - - universal full date/time 國際完整日期/時間 diff --git a/src/Features/VisualBasic/Portable/VBFeaturesResources.resx b/src/Features/VisualBasic/Portable/VBFeaturesResources.resx index 1dcbc463afa9d..9c2d5b3a96c39 100644 --- a/src/Features/VisualBasic/Portable/VBFeaturesResources.resx +++ b/src/Features/VisualBasic/Portable/VBFeaturesResources.resx @@ -226,9 +226,6 @@ Remove 'Me' qualification {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - can't determine valid range of statements to extract out @@ -271,9 +268,6 @@ no valid statement range to extract out - - Invalid selection - Deprecated @@ -441,9 +435,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2] Specifies the group that the loop variable in a For Each statement is to traverse. - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. @@ -956,9 +947,6 @@ Sub(<parameterList>) <statement> Enables reporting of specified warnings in the portion of the source file below the current line. - - Insert 'Await'. - Make {0} an Async Function. @@ -1127,9 +1115,6 @@ Sub(<parameterList>) <statement> attributes - - Too many arguments to '{0}'. - Type '{0}' is not defined. @@ -1225,18 +1210,6 @@ Sub(<parameterList>) <statement> Make '{0}' inheritable - - Apply Me qualification preferences - {Locked="Me"} "Me" is a VB keyword and should not be localized. - - - Apply Imports directive placement preferences - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Make private field ReadOnly when possible - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Organize Imports {Locked="Import"} diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf index d2e2a67c7f45f..69f14e7a3040a 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.cs.xlf @@ -27,16 +27,6 @@ Přidat Shadows {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - Použít předvolby pro umístění direktiv Import - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - Použít předvolby pro kvalifikaci Me - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ Nastavit dědičnost pro {0} - - Make private field ReadOnly when possible - Pokud je to možné, nastavit privátní pole jako ReadOnly - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. Přesuňte příkaz {0} na řádek {1}. @@ -262,11 +247,6 @@ Odebrat kvalifikaci Me {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - Název může být zjednodušený. - - can't determine valid range of statements to extract out nemůže určit platný rozsah příkazů k extrakci ven @@ -337,11 +317,6 @@ žádný platný rozsah příkazů pro extrakci ven - - Invalid selection - Neplatný výběr - - Deprecated Zastaralé @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]Určuje skupinu, kterou má projít proměnná smyčky v příkazu For Each. - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - Určuje skupinu, kterou má proměnná smyčky projít v příkazu For Each, nebo určuje proměnnou rozsahu v příkazu. - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. Způsobí, že aktuální třída nebo rozhraní zdědí atributy, proměnné, vlastnosti, procedury a události z jiné třídy nebo sady rozhraní. @@ -1492,11 +1462,6 @@ Sub(<seznam_parametrů>) <výraz> Povolí hlášení určených upozornění v části zdrojového souboru pod aktuálním řádkem. - - Insert 'Await'. - Vlož "Await". - - Make {0} an Async Function. Převeď {0} na asynchronní funkci Async. @@ -1702,11 +1667,6 @@ Sub(<seznam_parametrů>) <výraz> atributy - - Too many arguments to '{0}'. - {0} má moc argumentů. - - Type '{0}' is not defined. Typ {0} není definovaný. diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf index ad3347120f439..aa4e369c15681 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.de.xlf @@ -27,16 +27,6 @@ "Shadows" hinzufügen {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - Platzierungseinstellungen für Import-Direktiven anwenden - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - Me-Qualifizierungseinstellungen anwenden - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ "{0}" als vererbbar festlegen - - Make private field ReadOnly when possible - Privates Feld nach Möglichkeit als "ReadOnly" festlegen - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. Verschieben Sie die "{0}"-Anweisung zu Zeile {1}. @@ -262,11 +247,6 @@ Qualifikation "Me" entfernen {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - Der Name kann vereinfacht werden - - can't determine valid range of statements to extract out gültiger Bereich der zu extrahierenden Anweisungen kann nicht bestimmt werden @@ -337,11 +317,6 @@ kein gültiger Anweisungsbereich für die Extraktion - - Invalid selection - Ungültige Auswahl - - Deprecated Veraltet @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]Gibt die Gruppe an, die die Schleifenvariable in einer For Each-Anweisung durchlaufen soll. - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - Gibt die Gruppe an, die die Schleifenvariable in einer For Each-Anweisung durchlaufen soll, oder gibt die Bereichsvariable in einer Abfrage an. - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. Führt dazu, dass die aktuelle Klasse oder Schnittstelle die Attribute, Variablen, Eigenschaften, Prozeduren und Ereignisse von einer anderen Klasse oder Gruppe von Schnittstellen erbt. @@ -1492,11 +1462,6 @@ Sub(<Parameterliste>) <Ausdruck> Aktiviert die Berichterstattung angegebener Warnungen im Teil der Quelldatei unter der aktuellen Zeile. - - Insert 'Await'. - "Await" einfügen - - Make {0} an Async Function. "{0}" in eine Async-Funktion umwandeln. @@ -1702,11 +1667,6 @@ Sub(<Parameterliste>) <Ausdruck> Attribute - - Too many arguments to '{0}'. - Zu viele Argumente für "{0}". - - Type '{0}' is not defined. Der Typ "{0}" ist nicht definiert. diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf index 07a349d500ac5..124a915e4194a 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.es.xlf @@ -27,16 +27,6 @@ Agregar "Shadows" {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - Aplicar las preferencias de ubicación de directivas Import - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - Aplicar las preferencias de calificación Me - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ Hacer "{0}" heredable - - Make private field ReadOnly when possible - Hacer que el campo privado sea ReadOnly cuando sea posible - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. Mueva la instrucción "{0}" a la línea {1}. @@ -262,11 +247,6 @@ Quitar calificación "Me" {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - El nombre se puede simplificar - - can't determine valid range of statements to extract out no se puede determinar el intervalo válido de instrucciones para extraer @@ -337,11 +317,6 @@ ningún intervalo de instrucciones válido para extraer - - Invalid selection - Selección no válida - - Deprecated En desuso @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]Especifica el grupo que la variable de bucle de una instrucción For Each tiene que atravesar. - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - Especifica el grupo que la variable de bucle debe atravesar en una instrucción For Each o especifica la variable de rango de una consulta. - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. Permite que la clase o interfaz actual herede los atributos, variables, propiedades, procedimientos y eventos de otra clase o conjunto de interfaces. @@ -1492,11 +1462,6 @@ Sub(<listaDeParámetros>) <instrucción>wo laopo fuke Habilita la creación de informes de advertencias concretas en la parte del archivo de código fuente situada debajo de la línea actual. - - Insert 'Await'. - Inserte "Await". - - Make {0} an Async Function. Convertir {0} en una función Async. @@ -1702,11 +1667,6 @@ Sub(<listaDeParámetros>) <instrucción>wo laopo fuke atributos - - Too many arguments to '{0}'. - Demasiados argumentos para "{0}". - - Type '{0}' is not defined. No está definido el tipo '{0}'. diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf index a78971dde3458..fc8a8c7c42c95 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.fr.xlf @@ -27,16 +27,6 @@ Ajouter 'Shadows' {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - Appliquer les préférences de placement de la directive Imports - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - Appliquer les préférences de qualification pour Me - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ Rendre '{0}' héritable - - Make private field ReadOnly when possible - Rendre le champ privé ReadOnly quand cela est possible - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. Déplacez l'instruction '{0}' à la ligne {1}. @@ -262,11 +247,6 @@ Supprimer la qualification 'Me' {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - Le nom peut être simplifié - - can't determine valid range of statements to extract out impossible de déterminer la plage valide d'instructions à extraire @@ -337,11 +317,6 @@ Aucune plage d'instructions valides à extraire - - Invalid selection - Sélection non valide - - Deprecated Déconseillé @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]Spécifie le groupe que la variable de boucle doit parcourir dans une instruction For Each. - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - Spécifie le groupe que la variable de boucle doit parcourir dans une instruction For Each, ou spécifie la variable de plage dans une requête. - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. Oblige la classe ou l'interface actuelle à hériter des attributs, variables, propriétés, procédures et événements d'une autre classe ou d'un autre ensemble d'interfaces. @@ -1492,11 +1462,6 @@ Sub(<parameterList>) <statement> Active la création de rapports des avertissements spécifiés dans la partie du fichier source en dessous de la ligne active. - - Insert 'Await'. - Insérez 'Await'. - - Make {0} an Async Function. Faire de {0} une fonction Async. @@ -1702,11 +1667,6 @@ Sub(<parameterList>) <statement> attributs - - Too many arguments to '{0}'. - Arguments trop nombreux pour '{0}'. - - Type '{0}' is not defined. Le type '{0}' n'est pas défini. diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf index b4e6165ea2dd0..97221aabc8df4 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.it.xlf @@ -27,16 +27,6 @@ Aggiungi 'Shadows' {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - Applica le preferenze di posizionamento per le direttive Import - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - Applica le preferenze relative alla qualificazione Me - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ Imposta '{0}' come ereditabile - - Make private field ReadOnly when possible - Imposta il campo privato come ReadOnly quando possibile - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. Spostare l'istruzione '{0}' alla riga {1}. @@ -262,11 +247,6 @@ Rimuovi qualificazione 'Me' {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - Il nome può essere semplificato - - can't determine valid range of statements to extract out non è possibile determinare l'intervallo valido di istruzioni da estrarre @@ -337,11 +317,6 @@ l'intervallo di istruzioni non è valido per l'estrazione - - Invalid selection - Selezione non valida - - Deprecated Deprecato @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]Specifica il gruppo che deve essere attraversato dalla variabile di ciclo in un'istruzione For Each. - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - Specifica il gruppo che deve essere attraversato dalla variabile di ciclo in un'istruzione For Each oppure specifica la variabile di intervallo in una query. - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. Fa sì che la classe o l'interfaccia corrente erediti gli attributi, le variabili, le proprietà, le procedure e gli eventi da un'altra classe o un altro set di interfacce. @@ -1492,11 +1462,6 @@ Sub(<elencoParametri>) <istruzione> Abilita la segnalazione di avvisi specificati nella parte del file di origine sotto la riga corrente. - - Insert 'Await'. - Inserire 'Await'. - - Make {0} an Async Function. Trasformare {0} in una funzione asincrona. @@ -1702,11 +1667,6 @@ Sub(<elencoParametri>) <istruzione> attributi - - Too many arguments to '{0}'. - Il numero di argomenti per '{0}' è eccessivo. - - Type '{0}' is not defined. Il tipo '{0}' non è definito. diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf index 5ed260cb3630e..ba13f188c8ddd 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ja.xlf @@ -27,16 +27,6 @@ 'Shadows' の追加 {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - Import ディレクティブの配置設定を適用する - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - Me 修飾設定を適用する - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ '{0}' を継承可能にします - - Make private field ReadOnly when possible - 可能な場合、プライベート フィールドを ReadOnly にする - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. '{0}' ステートメントを行 {1} に移動します。 @@ -262,11 +247,6 @@ 修飾子 'Me' を削除します {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - 名前を簡素化できます - - can't determine valid range of statements to extract out 抽出するステートメントの有効な範囲を決定できません @@ -337,11 +317,6 @@ 抽出する有効なステートメントの範囲がありません - - Invalid selection - 無効な選択 - - Deprecated 非推奨 @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]ループ変数が For Each ステートメント内で繰り返し処理するグループを指定します。 - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - ループ変数が For Each ステートメントで繰り返し処理するグループを指定するか、クエリ内の範囲変数を指定します。 - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. 現在のクラスまたはインターフェイスが、属性、変数、プロパティ、プロシージャ、およびイベントを別のクラスまたは一連のインターフェイスから継承するようにします。 @@ -1492,11 +1462,6 @@ Sub(<parameterList>) <statement> 現在の行以降のソース ファイルの部分で指定された警告のレポートを有効にします。 - - Insert 'Await'. - Await' を挿入します。 - - Make {0} an Async Function. {0} を Async Function にします。 @@ -1702,11 +1667,6 @@ Sub(<parameterList>) <statement> 属性 - - Too many arguments to '{0}'. - '{0}' の引数が多すぎます。 - - Type '{0}' is not defined. 型 '{0}' は定義されていません。 diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf index 40af68794a182..17ce600540c80 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ko.xlf @@ -27,16 +27,6 @@ 'Shadows' 추가 {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - Import 지시문 배치 기본 설정 적용 - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - Me 한정 기본 설정 적용 - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ '{0}'을(를) 상속 가능으로 지정 - - Make private field ReadOnly when possible - 가능한 경우 프라이빗 필드를 ReadOnly로 만들기 - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. '{0}' 문을 {1} 줄로 이동합니다. @@ -262,11 +247,6 @@ Me' 한정자 제거 {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - 이름을 단순화할 수 있습니다. - - can't determine valid range of statements to extract out 추출할 문에 유효한 범위를 결정할 수 없습니다. @@ -337,11 +317,6 @@ 추출하는 데 유효한 문 범위가 없습니다. - - Invalid selection - 잘못된 선택 영역입니다. - - Deprecated 사용되지 않음 @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]For Each 문에서 루프 변수가 트래버스하는 그룹을 지정합니다. - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - For Each 문에서 루프 변수가 트래버스하는 그룹을 지정하거나 쿼리의 범위 변수를 지정합니다. - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. 현재 클래스 또는 인터페이스가 다른 클래스나 인터페이스 집합에서 특성, 변수, 속성, 프로시저 및 이벤트를 상속하도록 합니다. @@ -1492,11 +1462,6 @@ Sub(<parameterList>) <statement> 현재 줄 아래의 소스 파일 부분에서 지정한 경고를 보고합니다. - - Insert 'Await'. - Await'를 삽입합니다. - - Make {0} an Async Function. {0}을(를) 비동기 함수로 설정합니다. @@ -1702,11 +1667,6 @@ Sub(<parameterList>) <statement> 특성 - - Too many arguments to '{0}'. - '{0}'에 대한 인수가 너무 많습니다. - - Type '{0}' is not defined. '{0}' 형식이 정의되지 않았습니다. diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf index 39329a5c74db4..4f448dba5e0eb 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pl.xlf @@ -27,16 +27,6 @@ Dodaj modyfikatory „Shadows” {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - Zastosuj preferencje umieszczania dyrektyw Import - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - Zastosuj preferencje kwalifikacji Me - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ Ustaw element „{0}” jako dziedziczony - - Make private field ReadOnly when possible - Ustaw pole prywatne jako ReadOnly, gdy to możliwe - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. Przenieś instrukcję „{0}” do wiersza {1}. @@ -262,11 +247,6 @@ Usuń kwalifikację „Me” {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - Nazwę można uprościć - - can't determine valid range of statements to extract out nie można określić prawidłowego zakresu instrukcji do wyodrębnienia @@ -337,11 +317,6 @@ brak prawidłowego zakresu instrukcji do wyodrębnienia - - Invalid selection - Nieprawidłowy wybór - - Deprecated Przestarzały @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]Określa grupę, przez którą ma przejść zmienna pętli For Each. - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - Określa grupę, przez którą ma przejść zmienna pętli For Each, lub określa zmienną zakresu w zapytaniu. - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. Powoduje dziedziczenie przez bieżącą klasę lub interfejs atrybutów, zmiennych, właściwości, procedur i zdarzeń z innej klasy lub zestawu interfejsów. @@ -1492,11 +1462,6 @@ Sub(<listaParametrów>) <instrukcja> Włącza raportowanie określonych ostrzeżeń we fragmencie pliku źródłowego poniżej bieżącego wiersza. - - Insert 'Await'. - Wstaw element „Await”. - - Make {0} an Async Function. Ustaw funkcję {0} jako funkcję asynchroniczną. @@ -1702,11 +1667,6 @@ Sub(<listaParametrów>) <instrukcja> atrybuty - - Too many arguments to '{0}'. - Za dużo argumentów elementu „{0}”. - - Type '{0}' is not defined. Typ „{0}” nie został zdefiniowany. diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf index 960458d1bff70..d35e39e5a40b4 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.pt-BR.xlf @@ -27,16 +27,6 @@ Adicionar 'Shadows' {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - Aplicar as preferências de posicionamento de diretiva de Imports - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - Aplicar as preferências de qualificação de Me - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ Alterar '{0}' para herdável - - Make private field ReadOnly when possible - Fazer com que o campo privado seja ReadOnly quando possível - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. Mova a instrução "{0}" para a linha {1}. @@ -262,11 +247,6 @@ Remover qualificação 'Me' {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - O nome pode ser simplificado - - can't determine valid range of statements to extract out não pode determinar o intervalo válido de instruções para extrair @@ -337,11 +317,6 @@ nenhum intervalo de instrução válido para extrair - - Invalid selection - Seleção inválida - - Deprecated Preterido @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]Especifica o grupo que a variável de loop em uma instrução For Each deve percorrer. - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - Especifica o grupo que a variável de loop deve percorrer em uma instrução For Each ou especifica a variável de intervalo em uma consulta. - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. Faz com que a classe ou interface atual herde os atributos, variáveis, propriedades, procedimentos e eventos de outra classe ou conjunto de interfaces. @@ -1492,11 +1462,6 @@ Sub(<parameterList>) <statement> Habilita a emissão de relatórios de avisos especificados na parte do arquivo de origem abaixo da linha atual. - - Insert 'Await'. - Inserir 'Aguardar'. - - Make {0} an Async Function. Tornar {0} uma Função Assíncrona. @@ -1702,11 +1667,6 @@ Sub(<parameterList>) <statement> atributos - - Too many arguments to '{0}'. - Muitos argumentos para "{0}". - - Type '{0}' is not defined. O tipo '{0}' não está definido. diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf index 7dbd767442ed9..3385d79e699b7 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.ru.xlf @@ -27,16 +27,6 @@ Добавить "Shadows" {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - Применить параметры размещения директивы Import - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - Применить параметры квалификации Me - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ Сделать "{0}" наследуемым - - Make private field ReadOnly when possible - Сделать закрытое поле доступным для чтения (ReadOnly), если это возможно - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. Перемещение оператора "{0}" в строку {1}. @@ -262,11 +247,6 @@ Удаление квалификации Me {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - Имя может быть упрощено - - can't determine valid range of statements to extract out Невозможно определить допустимый диапазон операторов для извлечения. @@ -337,11 +317,6 @@ Отсутствует допустимый диапазон оператора для извлечения. - - Invalid selection - Недопустимый выделенный фрагмент - - Deprecated Нерекомендуемый @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]Определяет группу, которую будет проходить переменная цикла в операторе For Each. - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - Определяет группу, которую будет проходить переменная цикла для оператора For Each, или определяет переменную диапазона в запросе. - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. Приводит к унаследованию атрибутов, переменных, свойств, процедур и событий из другого класса или набора интерфейсов для текущего класса или интерфейса. @@ -1492,11 +1462,6 @@ Sub(<parameterList>) <statement> Включает отчетность для указанных предупреждений в части исходного файла ниже текущей строки. - - Insert 'Await'. - Вставить "Await". - - Make {0} an Async Function. Сделать {0} асинхронной функцией. @@ -1702,11 +1667,6 @@ Sub(<parameterList>) <statement> атрибуты - - Too many arguments to '{0}'. - Слишком много аргументов для "{0}". - - Type '{0}' is not defined. Тип "{0}" не определен. diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf index 268ada03192eb..2eaaae02e5d1e 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.tr.xlf @@ -27,16 +27,6 @@ 'Shadows' ekle {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - Import yönerge yerleştirme tercihlerini uygula - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - Me yeterlilik tercihlerini uygula - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ '{0}' öğesini devralınabilir hale getir - - Make private field ReadOnly when possible - Mümkün olduğunda özel alanı ReadOnly yap - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. '{0}' deyimini {1} satırına taşıyın. @@ -262,11 +247,6 @@ Me' nitelemesini kaldır {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - Ad basitleştirilebilir - - can't determine valid range of statements to extract out Dışarıya ayıklanacak deyimlerin geçerli aralığı belirlenemiyor @@ -337,11 +317,6 @@ Dışarıya ayıklanacak geçerli deyim aralığı yok - - Invalid selection - Geçersiz seçim - - Deprecated Kullanım Dışı @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]Bir For Each deyimi içinde, döngü değişkeninin içinde gezeceği grubu belirtir. - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - Bir For Each deyimi içinde, döngü değişkeninin gezeceği grubu belirtir ya da bir sorgu içinde aralık değişkenini belirtir. - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. Geçerli sınıfın ya da arabirimin öznitelikleri, değişkenleri, özellikleri, yordamları ve olayları başka bir sınıf veya arabirim kümesinden devralmasına neden olur. @@ -1492,11 +1462,6 @@ Sub(<parameterList>) <statement> Geçerli satır altındaki kaynak dosyasının bir bölümünde belirtilen uyarıların raporlamasını etkinleştirir. - - Insert 'Await'. - Await' ekleyin. - - Make {0} an Async Function. {0} öğesini bir Zaman Uyumsuz İşlev yap. @@ -1702,11 +1667,6 @@ Sub(<parameterList>) <statement> öznitelikler - - Too many arguments to '{0}'. - '{0}' için çok fazla bağımsız değişken var. - - Type '{0}' is not defined. '{0}' türü tanımlı değil. diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf index 7a4acca09dff7..03bbd53ad9bff 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hans.xlf @@ -27,16 +27,6 @@ 添加 “Shadows” {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - 应用 Import 指令放置首选项 - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - 应用 Me 资格首选项 - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ 使 "{0}" 可继承 - - Make private field ReadOnly when possible - 尽可能将私有字段设为 ReadOnly - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. 将“{0}”语句移动到第 {1} 行。 @@ -262,11 +247,6 @@ 删除 "Me" 资格 {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - 可简化名称 - - can't determine valid range of statements to extract out 无法确定要提取的语句的有效范围 @@ -337,11 +317,6 @@ 没有可供提取的有效语句范围 - - Invalid selection - 无效选择 - - Deprecated 已弃用 @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]指定 For Each 语句中循环变量要遍历的组。 - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - 指定 For Each 语句中循环变量要遍历的组,或者指定查询中的范围变量。 - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. 导致当前类或接口继承其他类或接口集的属性(attribute)、变量、属性(property)、过程和事件。 @@ -1492,11 +1462,6 @@ Sub(<parameterList>) <statement> 在当前行下方的源文件部分中启用指定警告的报告。 - - Insert 'Await'. - 插入“Await”。 - - Make {0} an Async Function. 使 {0} 为异步函数。 @@ -1702,11 +1667,6 @@ Sub(<parameterList>) <statement> 属性 - - Too many arguments to '{0}'. - “{0}”的参数太多。 - - Type '{0}' is not defined. 未定义类型“{0}”。 diff --git a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf index a7e38ee503a33..2b3a95836ccaf 100644 --- a/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf +++ b/src/Features/VisualBasic/Portable/xlf/VBFeaturesResources.zh-Hant.xlf @@ -27,16 +27,6 @@ 新增 'Shadows' {Locked="Shadows"} "Shadows" is a VB keyword and should not be localized. - - Apply Imports directive placement preferences - 套用 Import 指示詞放置喜好設定 - {Locked="Import"} "Import" is a VB keyword and should not be localized. - - - Apply Me qualification preferences - 套用 Me 資格喜好設定 - {Locked="Me"} "Me" is a VB keyword and should not be localized. - Apply IsNot preferences Apply IsNot preferences @@ -102,11 +92,6 @@ 將 '{0}' 設為可繼承 - - Make private field ReadOnly when possible - 盡可能地將私人欄位設為 ReadOnly - {Locked="ReadOnly"} "ReadOnly" is a VB keyword and should not be localized. - Move the '{0}' statement to line {1}. 將 '{0}' 陳述式移至行 {1}。 @@ -262,11 +247,6 @@ 移除 'Me' 限定性條件 {Locked="Me"} "Me" is a VB keyword and should not be localized. - - Name can be simplified - 可以簡化名稱 - - can't determine valid range of statements to extract out 無法決定要擷取的有效陳述式範圍 @@ -337,11 +317,6 @@ 沒有可擷取內容的有效陳述式範圍 - - Invalid selection - 選取範圍無效 - - Deprecated 取代 @@ -622,11 +597,6 @@ Dim {<var> [As [New] dataType [(boundList)]][= initializer]}[, var2]指定 For Each 陳述式中迴圈變數要周遊的群組。 - - Specifies the group that the loop variable is to traverse in a For Each statement, or specifies the range variable in a query. - 指定 For Each 陳述式中迴圈變數要周遊的群組,或指定查詢中的範圍變數。 - - Causes the current class or interface to inherit the attributes, variables, properties, procedures, and events from another class or set of interfaces. 讓目前的類別或介面,從另一個類別或介面集合繼承屬性 (Attribute)、變數、屬性 (Property)、程序及事件。 @@ -1492,11 +1462,6 @@ Sub(<parameterList>) <statement> 啟用目前這一行下方原始程式檔部分中,指定之警告的回報功能。 - - Insert 'Await'. - 插入 'Await'。 - - Make {0} an Async Function. 讓 {0} 成為非同步函式。 @@ -1702,11 +1667,6 @@ Sub(<parameterList>) <statement> 屬性 - - Too many arguments to '{0}'. - '{0}' 的引數太多。 - - Type '{0}' is not defined. 類型 '{0}' 未定義。 From 89a0b8fb502dd2598616cf385f11d0da90e8881e Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Mon, 4 Apr 2022 17:13:29 +0200 Subject: [PATCH 115/131] Update Roslyn.Diagnostics.Analyzers and remove RS0005 suppressions --- .editorconfig | 4 ---- eng/Versions.props | 2 +- eng/config/globalconfigs/NonShipping.globalconfig | 2 -- eng/config/globalconfigs/Shipping.globalconfig | 2 -- ...bstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs | 3 --- ...nCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs | 3 --- .../FixAllOccurrences/DefaultFixAllProviderHelpers.cs | 4 ---- 7 files changed, 1 insertion(+), 19 deletions(-) diff --git a/.editorconfig b/.editorconfig index 54698466925f7..3a08978605e93 100644 --- a/.editorconfig +++ b/.editorconfig @@ -245,10 +245,6 @@ csharp_preserve_single_line_statements = true # https://github.com/dotnet/roslyn/pull/54259 has been published. dotnet_style_allow_statement_immediately_after_block_experimental = false -[src/CodeStyle/**.{cs,vb}] -# warning RS0005: Do not use generic CodeAction.Create to create CodeAction -dotnet_diagnostic.RS0005.severity = none - [src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures,VisualStudio}/**/*.{cs,vb}] # IDE0011: Add braces diff --git a/eng/Versions.props b/eng/Versions.props index 943f5688f65af..3342c7e8206f8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -19,7 +19,7 @@ - 3.3.4-beta1.22160.2 + 3.3.4-beta1.22204.1 6.0.0-rc1.21366.2 1.1.2-beta1.22122.4 0.1.132-beta diff --git a/eng/config/globalconfigs/NonShipping.globalconfig b/eng/config/globalconfigs/NonShipping.globalconfig index 7523f70490077..b606135bcebad 100644 --- a/eng/config/globalconfigs/NonShipping.globalconfig +++ b/eng/config/globalconfigs/NonShipping.globalconfig @@ -20,8 +20,6 @@ dotnet_diagnostic.RS1026.severity = none dotnet_diagnostic.RS1032.severity = none # Define diagnostic description correctly dotnet_diagnostic.RS1033.severity = none -# Do not use generic CodeAction.Create to create CodeAction - not useful for tests -dotnet_diagnostic.RS0005.severity = none # Do not call 'GetTestAccessor()' from production code: does not apply to tests dotnet_diagnostic.RS0043.severity = none diff --git a/eng/config/globalconfigs/Shipping.globalconfig b/eng/config/globalconfigs/Shipping.globalconfig index f5d5ed9e48545..f474ff296597b 100644 --- a/eng/config/globalconfigs/Shipping.globalconfig +++ b/eng/config/globalconfigs/Shipping.globalconfig @@ -3,7 +3,5 @@ is_global = true dotnet_diagnostic.CA1802.severity = warning dotnet_diagnostic.CA2007.severity = warning -dotnet_diagnostic.RS0005.severity = warning - # CA2016: Forward the 'CancellationToken' parameter to methods dotnet_diagnostic.CA2016.severity = warning diff --git a/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs b/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs index f996ab9889318..3fc63d39a17a9 100644 --- a/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs +++ b/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.PragmaBatchFixHelpers.cs @@ -31,14 +31,11 @@ public static CodeAction CreateBatchPragmaFix( FixAllState fixAllState, CancellationToken cancellationToken) { - // This is a temporary generated code action, which doesn't need telemetry, hence suppressing RS0005. -#pragma warning disable RS0005 // Do not use generic CodeAction.Create to create CodeAction return CodeAction.Create( ((CodeAction)pragmaActions[0]).Title, createChangedDocument: ct => BatchPragmaFixesAsync(suppressionFixProvider, document, pragmaActions, pragmaDiagnostics, cancellationToken), equivalenceKey: fixAllState.CodeActionEquivalenceKey); -#pragma warning restore RS0005 // Do not use generic CodeAction.Create to create CodeAction } private static async Task BatchPragmaFixesAsync( diff --git a/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs b/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs index 9c310dbe6a5a1..0df4f432e0d33 100644 --- a/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs +++ b/src/Features/Core/Portable/CodeFixes/Suppression/AbstractSuppressionCodeFixProvider.RemoveSuppressionCodeAction.BatchFixer.cs @@ -145,13 +145,10 @@ public override async Task TryGetMergedFixAsync( currentSolution = currentSolution.WithDocumentSyntaxRoot(document.Id, newRoot); } - // This is a temporary generated code action, which doesn't need telemetry, hence suppressing RS0005. -#pragma warning disable RS0005 // Do not use generic CodeAction.Create to create CodeAction var batchAttributeRemoveFix = CodeAction.Create( attributeRemoveFixes.First().Title, createChangedSolution: ct => Task.FromResult(currentSolution), equivalenceKey: fixAllState.CodeActionEquivalenceKey); -#pragma warning restore RS0005 // Do not use generic CodeAction.Create to create CodeAction newBatchOfFixes.Insert(0, (diagnostic: null, batchAttributeRemoveFix)); } diff --git a/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/DefaultFixAllProviderHelpers.cs b/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/DefaultFixAllProviderHelpers.cs index 04d8e28ab02bd..243b569b7fa7f 100644 --- a/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/DefaultFixAllProviderHelpers.cs +++ b/src/Workspaces/Core/Portable/CodeFixes/FixAllOccurrences/DefaultFixAllProviderHelpers.cs @@ -36,12 +36,8 @@ internal static class DefaultFixAllProviderHelpers if (solution == null) return null; -#pragma warning disable RS0005 // Do not use generic 'CodeAction.Create' to create 'CodeAction' - return CodeAction.Create( title, c => Task.FromResult(solution)); - -#pragma warning disable RS0005 // Do not use generic 'CodeAction.Create' to create 'CodeAction' } private static Task GetDocumentFixesAsync(FixAllContext fixAllContext, FixAllContexts fixAllContextsAsync) From 2c506662ca72e2a718108dbe89ca94ea0947efa4 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Mon, 4 Apr 2022 17:50:50 +0200 Subject: [PATCH 116/131] Remove some 'MyCodeAction's --- .../AddBraces/CSharpAddBracesCodeFixProvider.cs | 13 ++++--------- .../ConvertNamespaceCodeFixProvider.cs | 10 +--------- ...rpMakeStructFieldsWritableCodeFixProvider.cs | 14 ++++---------- ...nnecessaryLambdaExpressionCodeFixProvider.cs | 13 ++++--------- ...pUseImplicitObjectCreationCodeFixProvider.cs | 13 ++++--------- .../UseImplicitTypeCodeFixProvider.cs | 15 ++++----------- .../CSharpUseIndexOperatorCodeFixProvider.cs | 14 ++++---------- ...pUseNullCheckOverTypeCheckCodeFixProvider.cs | 13 ++++--------- .../CSharpUseNotPatternCodeFixProvider.cs | 14 ++++---------- .../CSharpUseTupleSwapCodeFixProvider.cs | 14 ++++---------- .../AddRequiredParenthesesCodeFixProvider.cs | 11 ++--------- ...tractConvertTypeOfToNameOfCodeFixProvider.cs | 17 ++++++----------- ...angeNamespaceToMatchFolderCodeFixProvider.cs | 13 ++++--------- ...bstractQualifyMemberAccessCodeFixProvider.cs | 16 +++++----------- .../RemoveRedundantEqualityCodeFixProvider.cs | 13 +++---------- ...ctRemoveUnnecessaryImportsCodeFixProvider.cs | 16 +++++----------- ...moveUnnecessaryParenthesesCodeFixProvider.cs | 14 ++++---------- ...ssaryAttributeSuppressionsCodeFixProvider.cs | 13 ++++--------- .../SimplifyConditionalCodeFixProvider.cs | 14 ++++---------- .../UpdateLegacySuppressionsCodeFixProvider.cs | 13 ++++--------- .../UseExplicitTupleNameCodeFixProvider.cs | 16 ++++------------ ...tractUseInferredMemberNameCodeFixProvider.cs | 14 ++++---------- ...seIsNullForReferenceEqualsCodeFixProvider.cs | 10 +--------- .../UseThrowExpressionCodeFixProvider.cs | 14 ++++---------- 24 files changed, 91 insertions(+), 236 deletions(-) diff --git a/src/Analyzers/CSharp/CodeFixes/AddBraces/CSharpAddBracesCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/AddBraces/CSharpAddBracesCodeFixProvider.cs index 9d97e81df37fc..dc922f79f679d 100644 --- a/src/Analyzers/CSharp/CodeFixes/AddBraces/CSharpAddBracesCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/AddBraces/CSharpAddBracesCodeFixProvider.cs @@ -35,7 +35,10 @@ public override ImmutableArray FixableDiagnosticIds public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics.First(), c)), + CodeAction.Create( + CSharpAnalyzersResources.Add_braces, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Add_braces)), context.Diagnostics); return Task.CompletedTask; @@ -63,13 +66,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private sealed class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Add_braces, createChangedDocument, CSharpAnalyzersResources.Add_braces) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs index 22408004fec96..6b108cac38007 100644 --- a/src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/ConvertNamespace/ConvertNamespaceCodeFixProvider.cs @@ -47,7 +47,7 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) }); context.RegisterCodeFix( - new MyCodeAction(title, c => FixAsync(context.Document, diagnostic, c), equivalenceKey), + CodeAction.Create(title, c => FixAsync(context.Document, diagnostic, c), equivalenceKey), context.Diagnostics); return Task.CompletedTask; @@ -66,13 +66,5 @@ protected override async Task FixAllAsync( editor.OriginalRoot, await converted.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false)); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(string title, Func> createChangedDocument, string equivalenceKey) - : base(title, createChangedDocument, equivalenceKey) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableCodeFixProvider.cs index 4589db37d1033..cb01375c7b4df 100644 --- a/src/Analyzers/CSharp/CodeFixes/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/MakeStructFieldsWritable/CSharpMakeStructFieldsWritableCodeFixProvider.cs @@ -34,8 +34,10 @@ public override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Make_readonly_fields_writable, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(CSharpAnalyzersResources.Make_readonly_fields_writable)), context.Diagnostics); return Task.CompletedTask; } @@ -73,13 +75,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Make_readonly_fields_writable, createChangedDocument, nameof(CSharpAnalyzersResources.Make_readonly_fields_writable)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryLambdaExpression/CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryLambdaExpression/CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs index 42e754fbb80e1..a8a691c04ee77 100644 --- a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryLambdaExpression/CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryLambdaExpression/CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider.cs @@ -37,7 +37,10 @@ public override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics.First(), c)), + CodeAction.Create( + CSharpAnalyzersResources.Remove_unnecessary_lambda_expression, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Remove_unnecessary_lambda_expression)), context.Diagnostics); return Task.CompletedTask; } @@ -65,13 +68,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Remove_unnecessary_lambda_expression, createChangedDocument, nameof(CSharpRemoveUnnecessaryLambdaExpressionCodeFixProvider)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs index ab7463f40ab3c..f648d20534010 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseImplicitObjectCreation/CSharpUseImplicitObjectCreationCodeFixProvider.cs @@ -39,7 +39,10 @@ protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics.First(), c)), + CodeAction.Create( + CSharpAnalyzersResources.Use_new, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Use_new)), context.Diagnostics); return Task.CompletedTask; } @@ -74,13 +77,5 @@ private static SyntaxToken WithoutTrailingWhitespace(SyntaxToken newKeyword) ? newKeyword.WithoutTrailingTrivia() : newKeyword; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Use_new, createChangedDocument, CSharpAnalyzersResources.Use_new) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseImplicitTypeCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseImplicitTypeCodeFixProvider.cs index 95b776c1e364a..0076a21aa33ee 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseImplicitTypeCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseImplicitTypeCodeFixProvider.cs @@ -36,7 +36,10 @@ public UseImplicitTypeCodeFixProvider() public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics.First(), c)), + CodeAction.Create( + CSharpAnalyzersResources.use_var_instead_of_explicit_type, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.use_var_instead_of_explicit_type)), context.Diagnostics); return Task.CompletedTask; @@ -65,15 +68,5 @@ internal static void ReplaceTypeWithVar(SyntaxEditor editor, TypeSyntax type) editor.ReplaceNode(type, implicitType); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.use_var_instead_of_explicit_type, - createChangedDocument, - CSharpAnalyzersResources.use_var_instead_of_explicit_type) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseIndexOperatorCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseIndexOperatorCodeFixProvider.cs index e3ebdf74ae9f6..ed3589b9a0d07 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseIndexOperatorCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseIndexOperatorCodeFixProvider.cs @@ -36,8 +36,10 @@ public CSharpUseIndexOperatorCodeFixProvider() public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Use_index_operator, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(CSharpAnalyzersResources.Use_index_operator)), context.Diagnostics); return Task.CompletedTask; @@ -59,13 +61,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Use_index_operator, createChangedDocument, CSharpAnalyzersResources.Use_index_operator) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs index a6cf1401a8875..eec9ceb27bf0a 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs @@ -39,7 +39,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, diagnostic, c)), + CodeAction.Create( + CSharpAnalyzersResources.Prefer_null_check_over_type_check, + c => FixAsync(context.Document, diagnostic, c), + nameof(CSharpAnalyzersResources.Prefer_null_check_over_type_check)), context.Diagnostics); return Task.CompletedTask; @@ -70,13 +73,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Prefer_null_check_over_type_check, createChangedDocument, nameof(CSharpAnalyzersResources.Prefer_null_check_over_type_check)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpUseNotPatternCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpUseNotPatternCodeFixProvider.cs index d27e1c0d1b5b9..3b8187308085c 100644 --- a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpUseNotPatternCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpUseNotPatternCodeFixProvider.cs @@ -34,8 +34,10 @@ public override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Use_pattern_matching, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Use_pattern_matching)), context.Diagnostics); return Task.CompletedTask; } @@ -74,13 +76,5 @@ private static void ProcessDiagnostic( negated.WithPrependedLeadingTrivia(notExpression.GetLeadingTrivia()) .WithAppendedTrailingTrivia(notExpression.GetTrailingTrivia())); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Use_pattern_matching, createChangedDocument, nameof(CSharpUseNotPatternCodeFixProvider)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseTupleSwap/CSharpUseTupleSwapCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseTupleSwap/CSharpUseTupleSwapCodeFixProvider.cs index e61c3fa4744b7..fee98bf57f5af 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseTupleSwap/CSharpUseTupleSwapCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseTupleSwap/CSharpUseTupleSwapCodeFixProvider.cs @@ -37,8 +37,10 @@ public CSharpUseTupleSwapCodeFixProvider() public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Use_tuple_to_swap_values, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Use_tuple_to_swap_values)), context.Diagnostics); return Task.CompletedTask; } @@ -75,13 +77,5 @@ private static void FixOne( editor.ReplaceNode(localDeclarationStatement, tupleAssignmentStatement.WithTriviaFrom(localDeclarationStatement)); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Use_tuple_to_swap_values, createChangedDocument, nameof(CSharpAnalyzersResources.Use_tuple_to_swap_values)) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/AddRequiredParentheses/AddRequiredParenthesesCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/AddRequiredParentheses/AddRequiredParenthesesCodeFixProvider.cs index 3098f0ab1180b..56443cecd718e 100644 --- a/src/Analyzers/Core/CodeFixes/AddRequiredParentheses/AddRequiredParenthesesCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/AddRequiredParentheses/AddRequiredParenthesesCodeFixProvider.cs @@ -36,7 +36,8 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) { var firstDiagnostic = context.Diagnostics[0]; context.RegisterCodeFix( - new MyCodeAction( + CodeAction.Create( + AnalyzersResources.Add_parentheses_for_clarity, c => FixAsync(context.Document, firstDiagnostic, c), firstDiagnostic.Properties[AddRequiredParenthesesConstants.EquivalenceKey]!), context.Diagnostics); @@ -63,13 +64,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument, string equivalenceKey) - : base(AnalyzersResources.Add_parentheses_for_clarity, createChangedDocument, equivalenceKey) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/ConvertTypeOfToNameOf/AbstractConvertTypeOfToNameOfCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/ConvertTypeOfToNameOf/AbstractConvertTypeOfToNameOfCodeFixProvider.cs index 118796b8f186e..9823450c46a1d 100644 --- a/src/Analyzers/Core/CodeFixes/ConvertTypeOfToNameOf/AbstractConvertTypeOfToNameOfCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/ConvertTypeOfToNameOf/AbstractConvertTypeOfToNameOfCodeFixProvider.cs @@ -20,11 +20,14 @@ internal abstract class AbstractConvertTypeOfToNameOfCodeFixProvider : SyntaxEdi { public sealed override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.ConvertTypeOfToNameOfDiagnosticId); + public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - GetCodeFixTitle(), - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + var title = GetCodeFixTitle(); + context.RegisterCodeFix(CodeAction.Create( + title, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + title), context.Diagnostics); return Task.CompletedTask; } @@ -54,13 +57,5 @@ public void ConvertTypeOfToNameOf(SemanticModel semanticModel, SyntaxEditor edit protected abstract SyntaxNode GetSymbolTypeExpression(SemanticModel model, SyntaxNode node, CancellationToken cancellationToken); protected abstract string GetCodeFixTitle(); - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(string title, Func> createChangedDocument) - : base(title, createChangedDocument, title) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs index f229e7e3ed114..408f4c464f7ef 100644 --- a/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.cs @@ -27,7 +27,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) if (context.Document.Project.Solution.Workspace.CanApplyChange(ApplyChangesKind.ChangeDocumentInfo)) { context.RegisterCodeFix( - new MyCodeAction(AnalyzersResources.Change_namespace_to_match_folder_structure, cancellationToken => FixAllInDocumentAsync(context.Document, context.Diagnostics, cancellationToken)), + CodeAction.Create( + AnalyzersResources.Change_namespace_to_match_folder_structure, + cancellationToken => FixAllInDocumentAsync(context.Document, context.Diagnostics, cancellationToken), + nameof(AnalyzersResources.Change_namespace_to_match_folder_structure)), context.Diagnostics); } @@ -62,13 +65,5 @@ private static async Task FixAllInDocumentAsync(Document document, Imm public override FixAllProvider? GetFixAllProvider() => CustomFixAllProvider.Instance; - - private sealed class MyCodeAction : CustomCodeActions.SolutionChangeAction - { - public MyCodeAction(string title, Func> createChangedSolution) - : base(title, createChangedSolution, title) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/QualifyMemberAccess/AbstractQualifyMemberAccessCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/QualifyMemberAccess/AbstractQualifyMemberAccessCodeFixProvider.cs index 3800dba1d46f9..33e79e73ada4e 100644 --- a/src/Analyzers/Core/CodeFixes/QualifyMemberAccess/AbstractQualifyMemberAccessCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/QualifyMemberAccess/AbstractQualifyMemberAccessCodeFixProvider.cs @@ -26,9 +26,11 @@ public sealed override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - GetTitle(), - c => FixAsync(context.Document, context.Diagnostics[0], c)), + var title = GetTitle(); + context.RegisterCodeFix(CodeAction.Create( + title, + c => FixAsync(context.Document, context.Diagnostics[0], c), + title), context.Diagnostics); return Task.CompletedTask; } @@ -58,13 +60,5 @@ protected override Task FixAllAsync( } protected abstract TSimpleNameSyntax GetNode(Diagnostic diagnostic, CancellationToken cancellationToken); - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(string title, Func> createChangedDocument) - : base(title, createChangedDocument, title) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/RemoveRedundantEquality/RemoveRedundantEqualityCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveRedundantEquality/RemoveRedundantEqualityCodeFixProvider.cs index dc06e6b518c90..474df681d96a5 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveRedundantEquality/RemoveRedundantEqualityCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveRedundantEquality/RemoveRedundantEqualityCodeFixProvider.cs @@ -34,9 +34,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) { foreach (var diagnostic in context.Diagnostics) { - context.RegisterCodeFix(new MyCodeAction( + context.RegisterCodeFix(CodeAction.Create( AnalyzersResources.Remove_redundant_equality, - c => FixAsync(context.Document, diagnostic, c)), + c => FixAsync(context.Document, diagnostic, c), + nameof(AnalyzersResources.Remove_redundant_equality)), diagnostic); } @@ -82,13 +83,5 @@ static SyntaxNode WithElasticTrailingTrivia(SyntaxNode node) return node.WithTrailingTrivia(node.GetTrailingTrivia().Select(SyntaxTriviaExtensions.AsElastic)); } } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(string title, Func> createChangedDocument) - : base(title, createChangedDocument, title) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryImports/AbstractRemoveUnnecessaryImportsCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryImports/AbstractRemoveUnnecessaryImportsCodeFixProvider.cs index a2c972c64da66..d2dd5596f67ca 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryImports/AbstractRemoveUnnecessaryImportsCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryImports/AbstractRemoveUnnecessaryImportsCodeFixProvider.cs @@ -22,10 +22,12 @@ public sealed override FixAllProvider GetFixAllProvider() public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { + var title = GetTitle(); context.RegisterCodeFix( - new MyCodeAction( - GetTitle(), - c => RemoveUnnecessaryImportsAsync(context.Document, c)), + CodeAction.Create( + title, + c => RemoveUnnecessaryImportsAsync(context.Document, c), + title), context.Diagnostics); return Task.CompletedTask; } @@ -38,13 +40,5 @@ private static Task RemoveUnnecessaryImportsAsync( var service = document.GetRequiredLanguageService(); return service.RemoveUnnecessaryImportsAsync(document, cancellationToken); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(string title, Func> createChangedDocument) - : base(title, createChangedDocument, title) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesCodeFixProvider.cs index 8444e2b14ba92..9b41661db9e06 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnnecessaryParentheses/AbstractRemoveUnnecessaryParenthesesCodeFixProvider.cs @@ -28,8 +28,10 @@ protected abstract bool CanRemoveParentheses( public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( - new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + CodeAction.Create( + AnalyzersResources.Remove_unnecessary_parentheses, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(AnalyzersResources.Remove_unnecessary_parentheses)), context.Diagnostics); return Task.CompletedTask; } @@ -49,13 +51,5 @@ protected override Task FixAllAsync( (_, currentRoot, current) => currentRoot.ReplaceNode(current, syntaxFacts.Unparenthesize(current)), cancellationToken); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Remove_unnecessary_parentheses, createChangedDocument, AnalyzersResources.Remove_unnecessary_parentheses) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs index 2d4ab370fd174..91a8c5b1eba0a 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs @@ -37,7 +37,10 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) if (root.FindNode(diagnostic.Location.SourceSpan) != null) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, diagnostic, c)), + new MyCodeAction( + AnalyzersResources.Remove_unnecessary_suppression, + c => FixAsync(context.Document, diagnostic, c), + nameof(AnalyzersResources.Remove_unnecessary_suppression)), diagnostic); } } @@ -53,13 +56,5 @@ protected override Task FixAllAsync(Document document, ImmutableArray> createChangedDocument) - : base(AnalyzersResources.Remove_unnecessary_suppression, createChangedDocument, nameof(RemoveUnnecessaryAttributeSuppressionsCodeFixProvider)) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/SimplifyBooleanExpression/SimplifyConditionalCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/SimplifyBooleanExpression/SimplifyConditionalCodeFixProvider.cs index 9602b413c003e..6fe02c126c449 100644 --- a/src/Analyzers/Core/CodeFixes/SimplifyBooleanExpression/SimplifyConditionalCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/SimplifyBooleanExpression/SimplifyConditionalCodeFixProvider.cs @@ -34,8 +34,10 @@ public SimplifyConditionalCodeFixProvider() public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Simplify_conditional_expression, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(AnalyzersResources.Simplify_conditional_expression)), context.Diagnostics); return Task.CompletedTask; @@ -74,13 +76,5 @@ protected sealed override async Task FixAllAsync( expr, generatorInternal.AddParentheses(replacement.WithTriviaFrom(expr))); } } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Simplify_conditional_expression, createChangedDocument, AnalyzersResources.Simplify_conditional_expression) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UpdateLegacySuppressions/UpdateLegacySuppressionsCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UpdateLegacySuppressions/UpdateLegacySuppressionsCodeFixProvider.cs index c9ff7acfb47c9..fd66179626dda 100644 --- a/src/Analyzers/Core/CodeFixes/UpdateLegacySuppressions/UpdateLegacySuppressionsCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UpdateLegacySuppressions/UpdateLegacySuppressionsCodeFixProvider.cs @@ -38,7 +38,10 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) root.FindNode(diagnostic.Location.SourceSpan, getInnermostNodeForTie: true) != null) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, diagnostic, c)), + CodeAction.Create( + CodeFixesResources.Update_suppression_format, + c => FixAsync(context.Document, diagnostic, c), + nameof(CodeFixesResources.Update_suppression_format)), diagnostic); } } @@ -55,13 +58,5 @@ protected override Task FixAllAsync(Document document, ImmutableArray> createChangedDocument) - : base(CodeFixesResources.Update_suppression_format, createChangedDocument, nameof(UpdateLegacySuppressionsCodeFixProvider)) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseExplicitTupleName/UseExplicitTupleNameCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseExplicitTupleName/UseExplicitTupleNameCodeFixProvider.cs index c8271ef751b68..219d6bca92b9b 100644 --- a/src/Analyzers/Core/CodeFixes/UseExplicitTupleName/UseExplicitTupleNameCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseExplicitTupleName/UseExplicitTupleNameCodeFixProvider.cs @@ -31,8 +31,10 @@ public UseExplicitTupleNameCodeFixProvider() public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Use_explicitly_provided_tuple_name, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(AnalyzersResources.Use_explicitly_provided_tuple_name)), context.Diagnostics); return Task.CompletedTask; } @@ -58,15 +60,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Use_explicitly_provided_tuple_name, - createChangedDocument, - AnalyzersResources.Use_explicitly_provided_tuple_name) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseInferredMemberName/AbstractUseInferredMemberNameCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseInferredMemberName/AbstractUseInferredMemberNameCodeFixProvider.cs index e9db689b6ee9d..aaaff6fb33f22 100644 --- a/src/Analyzers/Core/CodeFixes/UseInferredMemberName/AbstractUseInferredMemberNameCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseInferredMemberName/AbstractUseInferredMemberNameCodeFixProvider.cs @@ -24,8 +24,10 @@ internal abstract class AbstractUseInferredMemberNameCodeFixProvider : SyntaxEdi public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Use_inferred_member_name, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(AnalyzersResources.Use_inferred_member_name)), context.Diagnostics); return Task.CompletedTask; @@ -45,13 +47,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Use_inferred_member_name, createChangedDocument, AnalyzersResources.Use_inferred_member_name) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseIsNullCheck/AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseIsNullCheck/AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs index 29266e98095ee..fab044b1c660a 100644 --- a/src/Analyzers/Core/CodeFixes/UseIsNullCheck/AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseIsNullCheck/AbstractUseIsNullForReferenceEqualsCodeFixProvider.cs @@ -40,7 +40,7 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) var negated = diagnostic.Properties.ContainsKey(UseIsNullConstants.Negated); var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options); context.RegisterCodeFix( - new MyCodeAction(title, c => FixAsync(context.Document, diagnostic, c)), + CodeAction.Create(title, c => FixAsync(context.Document, diagnostic, c), title), context.Diagnostics); } @@ -82,13 +82,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(string title, Func> createChangedDocument) - : base(title, createChangedDocument, title) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs index ca9f1ff663360..6a2389942d921 100644 --- a/src/Analyzers/Core/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseThrowExpression/UseThrowExpressionCodeFixProvider.cs @@ -38,7 +38,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, diagnostic, c)), + CodeAction.Create( + AnalyzersResources.Use_throw_expression, + c => FixAsync(context.Document, diagnostic, c), + nameof(AnalyzersResources.Use_throw_expression)), diagnostic); return Task.CompletedTask; @@ -68,14 +71,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction( - Func> createChangedDocument) - : base(AnalyzersResources.Use_throw_expression, createChangedDocument, nameof(AnalyzersResources.Use_throw_expression)) - { - } - } } } From 93650e6dbb1920037549d205c336528d53790f4f Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Mon, 4 Apr 2022 18:30:44 +0200 Subject: [PATCH 117/131] Remove more 'MyCodeAction's --- ...tchStatementToExpressionCodeFixProvider.cs | 13 ++++------- .../CSharpInlineDeclarationCodeFixProvider.cs | 16 ++++--------- ...ateWithConditionalAccessCodeFixProvider.cs | 14 ++++------- ...onsecutiveBracePlacementCodeFixProvider.cs | 13 ++++------- ...ctorInitializerPlacementCodeFixProvider.cs | 13 ++++------- ...beddedStatementPlacementCodeFixProvider.cs | 13 ++++------- ...moveConfusingSuppressionCodeFixProvider.cs | 12 ++-------- ...arpRemoveUnnecessaryCastCodeFixProvider.cs | 14 ++++------- ...essaryDiscardDesignationCodeFixProvider.cs | 14 ++++------- ...pSimplifyPropertyPatternCodeFixProvider.cs | 14 ++++------- ...rpTransposeRecordKeywordCodeFixProvider.cs | 14 ++++------- ...mpoundCoalesceAssignmentCodeFixProvider.cs | 14 ++++------- .../CSharpUseDeconstructionCodeFixProvider.cs | 13 ++++------- .../CSharpUseDefaultLiteralCodeFixProvider.cs | 14 ++++------- .../UseExplicitTypeCodeFixProvider.cs | 16 ++++--------- .../CSharpUseRangeOperatorCodeFixProvider.cs | 14 ++++------- ...rCastAndEqualityOperatorCodeFixProvider.cs | 10 +------- ...UseParameterNullCheckingCodeFixProvider.cs | 13 ++++------- .../CSharpAsAndNullCheckCodeFixProvider.cs | 14 ++++------- .../CSharpIsAndCastCheckCodeFixProvider.cs | 14 ++++------- .../UseSimpleUsingStatementCodeFixProvider.cs | 14 ++++------- ...bstractMakeFieldReadonlyCodeFixProvider.cs | 14 ++++------- ...cutiveStatementPlacementCodeFixProvider.cs | 14 ++++------- ...stractMultipleBlankLinesCodeFixProvider.cs | 14 ++++------- .../AbstractOrderModifiersCodeFixProvider.cs | 13 ++++------- .../AbstractPopulateSwitchCodeFixProvider.cs | 23 ++++++++----------- ...essaryPragmaSuppressionsCodeFixProvider.cs | 13 ++++------- ...tractRemoveUnusedMembersCodeFixProvider.cs | 14 ++++------- ...stractRemoveUnusedValuesCodeFixProvider.cs | 10 +------- ...actSimplifyInterpolationCodeFixProvider.cs | 14 ++++------- ...SimplifyLinqExpressionCodeFixProvider`3.cs | 14 ++++------- .../UseCoalesceExpressionCodeFixProvider.cs | 15 ++++-------- ...sceExpressionForNullableCodeFixProvider.cs | 15 ++++-------- ...UseCollectionInitializerCodeFixProvider.cs | 13 ++++------- ...actUseCompoundAssignmentCodeFixProvider.cs | 14 ++++------- ...lExpressionForAssignmentCodeFixProvider.cs | 13 ++++------- ...ionalExpressionForReturnCodeFixProvider.cs | 13 ++++------- ...stractUseNullPropagationCodeFixProvider.cs | 14 ++++------- ...ractUseObjectInitializerCodeFixProvider.cs | 13 ++++------- .../UseSystemHashCodeCodeFixProvider.cs | 14 ++++------- ...icRemoveUnnecessaryByValCodeFixProvider.vb | 14 ++++------- ...sicRemoveUnnecessaryCastCodeFixProvider.vb | 14 ++++------- ...icSimplifyObjectCreationCodeFixProvider.vb | 13 +++-------- ...lBasicUseIsNotExpressionCodeFixProvider.vb | 14 ++++------- 44 files changed, 172 insertions(+), 436 deletions(-) diff --git a/src/Analyzers/CSharp/CodeFixes/ConvertSwitchStatementToExpression/ConvertSwitchStatementToExpressionCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/ConvertSwitchStatementToExpression/ConvertSwitchStatementToExpressionCodeFixProvider.cs index 373b735e8a99b..24a22fe0acc59 100644 --- a/src/Analyzers/CSharp/CodeFixes/ConvertSwitchStatementToExpression/ConvertSwitchStatementToExpressionCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/ConvertSwitchStatementToExpression/ConvertSwitchStatementToExpressionCodeFixProvider.cs @@ -49,7 +49,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) } context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics.First(), c)), + CodeAction.Create( + CSharpAnalyzersResources.Convert_switch_statement_to_expression, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Convert_switch_statement_to_expression)), context.Diagnostics); return Task.CompletedTask; } @@ -113,13 +116,5 @@ protected override async Task FixAllAsync( } } } - - private sealed class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Convert_switch_statement_to_expression, createChangedDocument, nameof(CSharpAnalyzersResources.Convert_switch_statement_to_expression)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/InlineDeclaration/CSharpInlineDeclarationCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/InlineDeclaration/CSharpInlineDeclarationCodeFixProvider.cs index 2dd7c8d841248..5ab335d2f0a3e 100644 --- a/src/Analyzers/CSharp/CodeFixes/InlineDeclaration/CSharpInlineDeclarationCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/InlineDeclaration/CSharpInlineDeclarationCodeFixProvider.cs @@ -49,8 +49,10 @@ public override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Inline_variable_declaration, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Inline_variable_declaration)), context.Diagnostics); return Task.CompletedTask; } @@ -424,15 +426,5 @@ private static bool TryGetSpeculativeSemanticModel( speculativeModel = null; return false; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Inline_variable_declaration, - createChangedDocument, - CSharpAnalyzersResources.Inline_variable_declaration) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs index 8ad1a0deae791..6ba8d251d6e39 100644 --- a/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/InvokeDelegateWithConditionalAccess/InvokeDelegateWithConditionalAccessCodeFixProvider.cs @@ -40,8 +40,10 @@ protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Simplify_delegate_invocation, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Simplify_delegate_invocation)), context.Diagnostics); return Task.CompletedTask; } @@ -158,13 +160,5 @@ private static T AppendTriviaWithoutEndOfLines(T newStatement, IfStatementSyn return newStatement.WithTrailingTrivia(expressionTriviaWithoutEndOfLine.Concat(ifStatementTrivia)); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Simplify_delegate_invocation, createChangedDocument, nameof(CSharpAnalyzersResources.Simplify_delegate_invocation)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/NewLines/ConsecutiveBracePlacement/ConsecutiveBracePlacementCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/NewLines/ConsecutiveBracePlacement/ConsecutiveBracePlacementCodeFixProvider.cs index 27550a8694c53..542304057ffa0 100644 --- a/src/Analyzers/CSharp/CodeFixes/NewLines/ConsecutiveBracePlacement/ConsecutiveBracePlacementCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/NewLines/ConsecutiveBracePlacement/ConsecutiveBracePlacementCodeFixProvider.cs @@ -37,7 +37,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) var document = context.Document; var diagnostic = context.Diagnostics.First(); context.RegisterCodeFix( - new MyCodeAction(c => UpdateDocumentAsync(document, diagnostic, c)), + CodeAction.Create( + CSharpCodeFixesResources.Remove_blank_lines_between_braces, + c => UpdateDocumentAsync(document, diagnostic, c), + nameof(CSharpCodeFixesResources.Remove_blank_lines_between_braces)), context.Diagnostics); return Task.CompletedTask; } @@ -94,13 +97,5 @@ private static void FixOne( public override FixAllProvider GetFixAllProvider() => FixAllProvider.Create(async (context, document, diagnostics) => await FixAllAsync(document, diagnostics, context.CancellationToken).ConfigureAwait(false)); - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpCodeFixesResources.Remove_blank_lines_between_braces, createChangedDocument, CSharpCodeFixesResources.Remove_blank_lines_between_braces) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/NewLines/ConstructorInitializerPlacement/ConstructorInitializerPlacementCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/NewLines/ConstructorInitializerPlacement/ConstructorInitializerPlacementCodeFixProvider.cs index a3ab4712577ff..18a97dca1f1e7 100644 --- a/src/Analyzers/CSharp/CodeFixes/NewLines/ConstructorInitializerPlacement/ConstructorInitializerPlacementCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/NewLines/ConstructorInitializerPlacement/ConstructorInitializerPlacementCodeFixProvider.cs @@ -36,7 +36,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) var document = context.Document; var diagnostic = context.Diagnostics.First(); context.RegisterCodeFix( - new MyCodeAction(c => UpdateDocumentAsync(document, ImmutableArray.Create(diagnostic), c)), + CodeAction.Create( + CSharpCodeFixesResources.Place_colon_on_following_line, + c => UpdateDocumentAsync(document, ImmutableArray.Create(diagnostic), c), + nameof(CSharpCodeFixesResources.Place_colon_on_following_line)), context.Diagnostics); return Task.CompletedTask; } @@ -112,13 +115,5 @@ static SyntaxToken ComputeNewCloseParen(SyntaxToken colonToken, SyntaxToken prev public override FixAllProvider? GetFixAllProvider() => FixAllProvider.Create(async (context, document, diagnostics) => await UpdateDocumentAsync(document, diagnostics, context.CancellationToken).ConfigureAwait(false)); - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpCodeFixesResources.Place_colon_on_following_line, createChangedDocument, CSharpCodeFixesResources.Place_colon_on_following_line) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/NewLines/EmbeddedStatementPlacement/EmbeddedStatementPlacementCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/NewLines/EmbeddedStatementPlacement/EmbeddedStatementPlacementCodeFixProvider.cs index e64daef64661a..dd41a9e4dc596 100644 --- a/src/Analyzers/CSharp/CodeFixes/NewLines/EmbeddedStatementPlacement/EmbeddedStatementPlacementCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/NewLines/EmbeddedStatementPlacement/EmbeddedStatementPlacementCodeFixProvider.cs @@ -37,7 +37,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) var document = context.Document; var diagnostic = context.Diagnostics.First(); context.RegisterCodeFix( - new MyCodeAction(c => UpdateDocumentAsync(document, diagnostic, c)), + CodeAction.Create( + CSharpCodeFixesResources.Place_statement_on_following_line, + c => UpdateDocumentAsync(document, diagnostic, c), + nameof(CSharpCodeFixesResources.Place_statement_on_following_line)), context.Diagnostics); return Task.CompletedTask; } @@ -140,13 +143,5 @@ private static SyntaxToken AddLeadingTrivia(SyntaxToken token, SyntaxTrivia triv public override FixAllProvider GetFixAllProvider() => FixAllProvider.Create( async (context, document, diagnostics) => await FixAllAsync(document, diagnostics, context.CancellationToken).ConfigureAwait(false)); - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpCodeFixesResources.Place_statement_on_following_line, createChangedDocument, CSharpCodeFixesResources.Place_statement_on_following_line) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionCodeFixProvider.cs index f22d1c740f438..0797fd8192caf 100644 --- a/src/Analyzers/CSharp/CodeFixes/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/RemoveConfusingSuppression/CSharpRemoveConfusingSuppressionCodeFixProvider.cs @@ -42,14 +42,14 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) var cancellationToken = context.CancellationToken; context.RegisterCodeFix( - new MyCodeAction( + CodeAction.Create( CSharpAnalyzersResources.Remove_operator_preserves_semantics, c => FixAllAsync(document, diagnostics, negate: false, c), RemoveOperator), context.Diagnostics); context.RegisterCodeFix( - new MyCodeAction( + CodeAction.Create( CSharpAnalyzersResources.Negate_expression_changes_semantics, c => FixAllAsync(document, diagnostics, negate: true, c), NegateExpression), @@ -104,13 +104,5 @@ await FixAllAsync( document, diagnostics, context.CodeActionEquivalenceKey == NegateExpression, context.CancellationToken).ConfigureAwait(false)); - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(string title, Func> createChangedDocument, string equivalenceKey) - : base(title, createChangedDocument, equivalenceKey) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryCast/CSharpRemoveUnnecessaryCastCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryCast/CSharpRemoveUnnecessaryCastCodeFixProvider.cs index 8274c3447015c..33a9d2b774158 100644 --- a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryCast/CSharpRemoveUnnecessaryCastCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryCast/CSharpRemoveUnnecessaryCastCodeFixProvider.cs @@ -38,8 +38,10 @@ public CSharpRemoveUnnecessaryCastCodeFixProvider() public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Remove_Unnecessary_Cast, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(AnalyzersResources.Remove_Unnecessary_Cast)), context.Diagnostics); return Task.CompletedTask; } @@ -92,13 +94,5 @@ private ExpressionSyntax Recurse(ExpressionSyntax old) throw ExceptionUtilities.UnexpectedValue(old); } } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Remove_Unnecessary_Cast, createChangedDocument, nameof(AnalyzersResources.Remove_Unnecessary_Cast)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryDiscardDesignation/CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryDiscardDesignation/CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs index 51a563474c861..7270afc67306b 100644 --- a/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryDiscardDesignation/CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/RemoveUnnecessaryDiscardDesignation/CSharpRemoveUnnecessaryDiscardDesignationCodeFixProvider.cs @@ -37,7 +37,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics.First(); context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, diagnostic, c)), + CodeAction.Create( + CSharpAnalyzersResources.Remove_unnessary_discard, + c => FixAsync(context.Document, diagnostic, c), + nameof(CSharpAnalyzersResources.Remove_unnessary_discard)), diagnostic); return Task.CompletedTask; @@ -92,14 +95,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction( - Func> createChangedDocument) - : base(CSharpAnalyzersResources.Remove_unnessary_discard, createChangedDocument, CSharpAnalyzersResources.Remove_unnessary_discard) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/SimplifyPropertyPattern/CSharpSimplifyPropertyPatternCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/SimplifyPropertyPattern/CSharpSimplifyPropertyPatternCodeFixProvider.cs index 61ed86c7fbe7f..7fec44ac563c9 100644 --- a/src/Analyzers/CSharp/CodeFixes/SimplifyPropertyPattern/CSharpSimplifyPropertyPatternCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/SimplifyPropertyPattern/CSharpSimplifyPropertyPatternCodeFixProvider.cs @@ -36,8 +36,10 @@ public CSharpSimplifyPropertyPatternCodeFixProvider() public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Simplify_property_pattern, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(CSharpAnalyzersResources.Simplify_property_pattern)), context.Diagnostics); return Task.CompletedTask; @@ -120,13 +122,5 @@ protected override Task FixAllAsync( // the result. return Merge(Merge(outerExpression, innerMemberAccess.Expression), innerMemberAccess.Name); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Simplify_property_pattern, createChangedDocument, nameof(CSharpAnalyzersResources.Simplify_property_pattern)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/TransposeRecordKeyword/CSharpTransposeRecordKeywordCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/TransposeRecordKeyword/CSharpTransposeRecordKeywordCodeFixProvider.cs index c19c14d8a628f..351b32c138378 100644 --- a/src/Analyzers/CSharp/CodeFixes/TransposeRecordKeyword/CSharpTransposeRecordKeywordCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/TransposeRecordKeyword/CSharpTransposeRecordKeywordCodeFixProvider.cs @@ -94,7 +94,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) TryGetTokens(recordDeclaration, out _, out _)) { context.RegisterCodeFix( - new MyCodeAction(c => this.FixAsync(document, diagnostic, c)), + CodeAction.Create( + CSharpCodeFixesResources.Fix_record_declaration, + c => this.FixAsync(document, diagnostic, c), + nameof(CSharpCodeFixesResources.Fix_record_declaration)), diagnostic); } @@ -126,14 +129,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction( - Func> createChangedDocument) - : base(CSharpCodeFixesResources.Fix_record_declaration, createChangedDocument, nameof(CSharpTransposeRecordKeywordCodeFixProvider)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs index de1ba38635c05..b8e9f53d85f2d 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseCompoundAssignment/CSharpUseCompoundCoalesceAssignmentCodeFixProvider.cs @@ -36,8 +36,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) var document = context.Document; var diagnostic = context.Diagnostics[0]; - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(document, diagnostic, c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Use_compound_assignment, + c => FixAsync(document, diagnostic, c), + nameof(AnalyzersResources.Use_compound_assignment)), context.Diagnostics); return Task.CompletedTask; @@ -83,13 +85,5 @@ protected override async Task FixAllAsync( }); } } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Use_compound_assignment, createChangedDocument, AnalyzersResources.Use_compound_assignment) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseDeconstruction/CSharpUseDeconstructionCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseDeconstruction/CSharpUseDeconstructionCodeFixProvider.cs index 01cd9955a39d1..327e6fb9f2e12 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseDeconstruction/CSharpUseDeconstructionCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseDeconstruction/CSharpUseDeconstructionCodeFixProvider.cs @@ -37,7 +37,10 @@ public override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics[0], c)), + CodeAction.Create( + CSharpAnalyzersResources.Deconstruct_variable_declaration, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(CSharpAnalyzersResources.Deconstruct_variable_declaration)), context.Diagnostics); return Task.CompletedTask; @@ -186,13 +189,5 @@ private SyntaxNodeOrToken ConvertTupleTypeElementComponent(SyntaxNodeOrToken nod node.Type, SyntaxFactory.SingleVariableDesignation(node.Identifier))); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Deconstruct_variable_declaration, createChangedDocument, CSharpAnalyzersResources.Deconstruct_variable_declaration) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs index b72d9e7b09bd6..8aca1035b89c6 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseDefaultLiteral/CSharpUseDefaultLiteralCodeFixProvider.cs @@ -37,8 +37,10 @@ public CSharpUseDefaultLiteralCodeFixProvider() public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Simplify_default_expression, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Simplify_default_expression)), context.Diagnostics); return Task.CompletedTask; } @@ -73,13 +75,5 @@ await editor.ApplyExpressionLevelSemanticEditsAsync( SyntaxFactory.LiteralExpression(SyntaxKind.DefaultLiteralExpression).WithTriviaFrom(defaultExpression)), cancellationToken).ConfigureAwait(false); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Simplify_default_expression, createChangedDocument, CSharpAnalyzersResources.Simplify_default_expression) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseExplicitTypeCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseExplicitTypeCodeFixProvider.cs index 3b7508506e5ea..d7648163fc1c7 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseExplicitTypeCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseImplicitOrExplicitType/UseExplicitTypeCodeFixProvider.cs @@ -37,8 +37,10 @@ public UseExplicitTypeCodeFixProvider() public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Use_explicit_type_instead_of_var, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Use_explicit_type_instead_of_var)), context.Diagnostics); return Task.CompletedTask; @@ -161,15 +163,5 @@ private static ExpressionSyntax GenerateTupleDeclaration(ITypeSymbol typeSymbol, SyntaxFactory.Token(SyntaxKind.CloseParenToken)) .WithTrailingTrivia(parensDesignation.GetTrailingTrivia()); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Use_explicit_type_instead_of_var, - createChangedDocument, - CSharpAnalyzersResources.Use_explicit_type_instead_of_var) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseRangeOperatorCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseRangeOperatorCodeFixProvider.cs index b481faf807eb7..177a9bb272b1d 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseRangeOperatorCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseIndexOrRangeOperator/CSharpUseRangeOperatorCodeFixProvider.cs @@ -41,8 +41,10 @@ public CSharpUseRangeOperatorCodeFixProvider() public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Use_range_operator, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(CSharpAnalyzersResources.Use_range_operator)), context.Diagnostics); return Task.CompletedTask; @@ -217,13 +219,5 @@ private static bool IsFromEnd( return false; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Use_range_operator, createChangedDocument, CSharpAnalyzersResources.Use_range_operator) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs index cf99552eb8019..46344e04300a7 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseIsNullCheckForCastAndEqualityOperatorCodeFixProvider.cs @@ -47,7 +47,7 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) var title = GetTitle(negated, diagnostic.Location.SourceTree!.Options); context.RegisterCodeFix( - new MyCodeAction(title, c => FixAsync(context.Document, diagnostic, c)), + CodeAction.Create(title, c => FixAsync(context.Document, diagnostic, c), title), context.Diagnostics); } @@ -109,13 +109,5 @@ private static IsPatternExpressionSyntax Rewrite( Token(SyntaxKind.IsKeyword).WithTriviaFrom(binary.OperatorToken), ConstantPattern(nullLiteral).WithTriviaFrom(binary.Right)); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(string title, Func> createChangedDocument) - : base(title, createChangedDocument, title) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseParameterNullChecking/CSharpUseParameterNullCheckingCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseParameterNullChecking/CSharpUseParameterNullCheckingCodeFixProvider.cs index be70fadf101b2..2223988c12c77 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseParameterNullChecking/CSharpUseParameterNullCheckingCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseParameterNullChecking/CSharpUseParameterNullCheckingCodeFixProvider.cs @@ -37,7 +37,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) { var diagnostic = context.Diagnostics[0]; context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, diagnostic, c)), + CodeAction.Create( + CSharpAnalyzersResources.Use_parameter_null_checking, + c => FixAsync(context.Document, diagnostic, c), + nameof(CSharpAnalyzersResources.Use_parameter_null_checking)), context.Diagnostics); return Task.CompletedTask; } @@ -96,13 +99,5 @@ protected override Task FixAllAsync( return Task.CompletedTask; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Use_parameter_null_checking, createChangedDocument, nameof(CSharpUseParameterNullCheckingCodeFixProvider)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs index c95bf01481667..0008363b4161c 100644 --- a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpAsAndNullCheckCodeFixProvider.cs @@ -37,8 +37,10 @@ public override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Use_pattern_matching, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Use_pattern_matching)), context.Diagnostics); return Task.CompletedTask; } @@ -156,13 +158,5 @@ private static ExpressionSyntax GetCondition( // In C# 8 and lower, convert to `!(x is string s)` return SyntaxFactory.PrefixUnaryExpression(SyntaxKind.LogicalNotExpression, isPatternExpression.Parenthesize()); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Use_pattern_matching, createChangedDocument, nameof(CSharpAsAndNullCheckCodeFixProvider)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpIsAndCastCheckCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpIsAndCastCheckCodeFixProvider.cs index 0bd39de79a50e..4b1213926ef9f 100644 --- a/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpIsAndCastCheckCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UsePatternMatching/CSharpIsAndCastCheckCodeFixProvider.cs @@ -37,8 +37,10 @@ public override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Use_pattern_matching, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(CSharpAnalyzersResources.Use_pattern_matching)), context.Diagnostics); return Task.CompletedTask; } @@ -104,13 +106,5 @@ private static IfStatementSyntax GetUpdatedIfStatement( return newIf.WithAdditionalAnnotations(Formatter.Annotation); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Use_pattern_matching, createChangedDocument, nameof(CSharpIsAndCastCheckCodeFixProvider)) - { - } - } } } diff --git a/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs index cdfa96f2030cf..e94443b463cdd 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseSimpleUsingStatement/UseSimpleUsingStatementCodeFixProvider.cs @@ -41,8 +41,10 @@ public UseSimpleUsingStatementCodeFixProvider() public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + context.RegisterCodeFix(CodeAction.Create( + CSharpAnalyzersResources.Use_simple_using_statement, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(CSharpAnalyzersResources.Use_simple_using_statement)), context.Diagnostics); return Task.CompletedTask; @@ -174,13 +176,5 @@ private static LocalDeclarationStatementSyntax Convert(UsingStatementSyntax usin usingStatement.Declaration, Token(SyntaxKind.SemicolonToken)).WithTrailingTrivia(usingStatement.CloseParenToken.TrailingTrivia); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Use_simple_using_statement, createChangedDocument, CSharpAnalyzersResources.Use_simple_using_statement) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs index 08e7593b267ff..34efa72253992 100644 --- a/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/MakeFieldReadonly/AbstractMakeFieldReadonlyCodeFixProvider.cs @@ -31,8 +31,10 @@ public override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Add_readonly_modifier, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(AnalyzersResources.Add_readonly_modifier)), context.Diagnostics); return Task.CompletedTask; } @@ -100,13 +102,5 @@ private async Task MakeFieldReadonlyAsync( private static DeclarationModifiers WithReadOnly(DeclarationModifiers modifiers) => (modifiers - DeclarationModifiers.Volatile) | DeclarationModifiers.ReadOnly; - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Add_readonly_modifier, createChangedDocument, nameof(AnalyzersResources.Add_readonly_modifier)) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/NewLines/ConsecutiveStatementPlacement/ConsecutiveStatementPlacementCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/NewLines/ConsecutiveStatementPlacement/ConsecutiveStatementPlacementCodeFixProvider.cs index 2c6cd6f53a56f..cdb10c3daf4ca 100644 --- a/src/Analyzers/Core/CodeFixes/NewLines/ConsecutiveStatementPlacement/ConsecutiveStatementPlacementCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/NewLines/ConsecutiveStatementPlacement/ConsecutiveStatementPlacementCodeFixProvider.cs @@ -34,8 +34,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; var diagnostic = context.Diagnostics.First(); - context.RegisterCodeFix(new MyCodeAction( - c => UpdateDocumentAsync(document, diagnostic, c)), + context.RegisterCodeFix(CodeAction.Create( + CodeFixesResources.Add_blank_line_after_block, + c => UpdateDocumentAsync(document, diagnostic, c), + nameof(CodeFixesResources.Add_blank_line_after_block)), context.Diagnostics); return Task.CompletedTask; } @@ -67,13 +69,5 @@ public static async Task FixAllAsync(Document document, ImmutableArray public override FixAllProvider GetFixAllProvider() => FixAllProvider.Create(async (context, document, diagnostics) => await FixAllAsync(document, diagnostics, context.CancellationToken).ConfigureAwait(false)); - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CodeFixesResources.Add_blank_line_after_block, createChangedDocument, CodeFixesResources.Add_blank_line_after_block) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/NewLines/MultipleBlankLines/AbstractMultipleBlankLinesCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/NewLines/MultipleBlankLines/AbstractMultipleBlankLinesCodeFixProvider.cs index 3ca5b9f2d7c08..c2dfd7327f8fc 100644 --- a/src/Analyzers/Core/CodeFixes/NewLines/MultipleBlankLines/AbstractMultipleBlankLinesCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/NewLines/MultipleBlankLines/AbstractMultipleBlankLinesCodeFixProvider.cs @@ -34,8 +34,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; var diagnostic = context.Diagnostics.First(); - context.RegisterCodeFix(new MyCodeAction( - c => UpdateDocumentAsync(document, diagnostic, c)), + context.RegisterCodeFix(CodeAction.Create( + Remove_extra_blank_lines, + c => UpdateDocumentAsync(document, diagnostic, c), + nameof(Remove_extra_blank_lines)), context.Diagnostics); return Task.CompletedTask; } @@ -146,13 +148,5 @@ private static bool IsEndOfLine(ISyntaxKindsService syntaxKinds, SyntaxTriviaLis public override FixAllProvider? GetFixAllProvider() => FixAllProvider.Create(async (context, document, diagnostics) => await FixAllAsync(document, diagnostics, context.CancellationToken).ConfigureAwait(false)); - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(CodeFixesResources.Remove_extra_blank_lines, createChangedDocument, CodeFixesResources.Remove_extra_blank_lines) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/OrderModifiers/AbstractOrderModifiersCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/OrderModifiers/AbstractOrderModifiersCodeFixProvider.cs index fd2a8bb32a8f3..5735859aa0ed1 100644 --- a/src/Analyzers/Core/CodeFixes/OrderModifiers/AbstractOrderModifiersCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/OrderModifiers/AbstractOrderModifiersCodeFixProvider.cs @@ -48,7 +48,10 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) if (_syntaxFacts.GetModifiers(syntaxNode) != default) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics[0], c)), + CodeAction.Create( + AnalyzersResources.Order_modifiers, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(AnalyzersResources.Order_modifiers)), context.Diagnostics); } } @@ -89,13 +92,5 @@ int CompareModifiers(SyntaxToken t1, SyntaxToken t2) int GetOrder(SyntaxToken token) => preferredOrder.TryGetValue(token.RawKind, out var value) ? value : int.MaxValue; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Order_modifiers, createChangedDocument, AnalyzersResources.Order_modifiers) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/PopulateSwitch/AbstractPopulateSwitchCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/PopulateSwitch/AbstractPopulateSwitchCodeFixProvider.cs index 0cb1d3b361882..038ed1a403f0a 100644 --- a/src/Analyzers/Core/CodeFixes/PopulateSwitch/AbstractPopulateSwitchCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/PopulateSwitch/AbstractPopulateSwitchCodeFixProvider.cs @@ -63,33 +63,36 @@ public sealed override Task RegisterCodeFixesAsync(CodeFixContext context) if (missingCases) { context.RegisterCodeFix( - new MyCodeAction( + CodeAction.Create( AnalyzersResources.Add_missing_cases, c => FixAsync(document, diagnostic, addCases: true, addDefaultCase: false, - cancellationToken: c)), + cancellationToken: c), + nameof(AnalyzersResources.Add_missing_cases)), context.Diagnostics); } if (missingDefaultCase) { context.RegisterCodeFix( - new MyCodeAction( + CodeAction.Create( CodeFixesResources.Add_default_case, c => FixAsync(document, diagnostic, addCases: false, addDefaultCase: true, - cancellationToken: c)), + cancellationToken: c), + nameof(CodeFixesResources.Add_default_case)), context.Diagnostics); } if (missingCases && missingDefaultCase) { context.RegisterCodeFix( - new MyCodeAction( + CodeAction.Create( CodeFixesResources.Add_both, c => FixAsync(document, diagnostic, addCases: true, addDefaultCase: true, - cancellationToken: c)), + cancellationToken: c), + nameof(CodeFixesResources.Add_both)), context.Diagnostics); } @@ -214,13 +217,5 @@ protected override Task FixAllAsync( addCases: true, addDefaultCase: true, cancellationToken: cancellationToken); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(string title, Func> createChangedDocument) - : base(title, createChangedDocument, title) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs index eb7afd7f56f29..fa6d04b3c766a 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryPragmaSuppressionsCodeFixProvider.cs @@ -44,7 +44,10 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) root.FindTrivia(diagnostic.Location.SourceSpan.Start).HasStructure) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, diagnostic, c)), + CodeAction.Create( + AnalyzersResources.Remove_unnecessary_suppression, + c => FixAsync(context.Document, diagnostic, c), + nameof(AnalyzersResources.Remove_unnecessary_suppression)), diagnostic); } } @@ -97,13 +100,5 @@ static void RemoveNode( } } } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Remove_unnecessary_suppression, createChangedDocument, nameof(RemoveUnnecessaryInlineSuppressionsCodeFixProvider)) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs index ded56b472ca8a..4d0c70b9a05a2 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnusedMembers/AbstractRemoveUnusedMembersCodeFixProvider.cs @@ -35,8 +35,10 @@ public override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Remove_unused_member, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(AnalyzersResources.Remove_unused_member)), context.Diagnostics); return Task.CompletedTask; } @@ -121,13 +123,5 @@ protected static void AdjustAndAddAppropriateDeclaratorsToRemove(SyntaxNode pare declarators.RemoveAll(childDeclarators); } } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Remove_unused_member, createChangedDocument, nameof(AnalyzersResources.Remove_unused_member)) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs index 2098335064734..aae086cbfd505 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnusedParametersAndValues/AbstractRemoveUnusedValuesCodeFixProvider.cs @@ -174,7 +174,7 @@ public sealed override async Task RegisterCodeFixesAsync(CodeFixContext context) } context.RegisterCodeFix( - new MyCodeAction( + CodeAction.Create( title, c => FixAsync(context.Document, diagnostic, c), equivalenceKey: GetEquivalenceKey(preference, isRemovableAssignment)), @@ -910,14 +910,6 @@ private static async Task IsLocalDeclarationWithNoReferencesAsync( referencedSymbols.Single().Locations.IsEmpty(); } - private sealed class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(string title, Func> createChangedDocument, string equivalenceKey) - : base(title, createChangedDocument, equivalenceKey) - { - } - } - protected sealed class UniqueVariableNameGenerator : IDisposable { private readonly SyntaxNode _memberDeclaration; diff --git a/src/Analyzers/Core/CodeFixes/SimplifyInterpolation/AbstractSimplifyInterpolationCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/SimplifyInterpolation/AbstractSimplifyInterpolationCodeFixProvider.cs index 963a414d5764b..ad547210dd073 100644 --- a/src/Analyzers/Core/CodeFixes/SimplifyInterpolation/AbstractSimplifyInterpolationCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/SimplifyInterpolation/AbstractSimplifyInterpolationCodeFixProvider.cs @@ -42,8 +42,10 @@ internal abstract class AbstractSimplifyInterpolationCodeFixProvider< public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Simplify_interpolation, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(AnalyzersResources.Simplify_interpolation)), context.Diagnostics); return Task.CompletedTask; } @@ -106,13 +108,5 @@ private TInterpolationSyntax Update( return result; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Simplify_interpolation, createChangedDocument, AnalyzersResources.Simplify_interpolation) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/SimplifyLinqExpression/AbstractSimplifyLinqExpressionCodeFixProvider`3.cs b/src/Analyzers/Core/CodeFixes/SimplifyLinqExpression/AbstractSimplifyLinqExpressionCodeFixProvider`3.cs index a46cbfacc40b4..d805ed1b800c2 100644 --- a/src/Analyzers/Core/CodeFixes/SimplifyLinqExpression/AbstractSimplifyLinqExpressionCodeFixProvider`3.cs +++ b/src/Analyzers/Core/CodeFixes/SimplifyLinqExpression/AbstractSimplifyLinqExpressionCodeFixProvider`3.cs @@ -27,8 +27,10 @@ public sealed override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Simplify_LINQ_expression, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(AnalyzersResources.Simplify_LINQ_expression)), context.Diagnostics); return Task.CompletedTask; } @@ -69,13 +71,5 @@ static TInvocationExpressionSyntax GetInvocation(SyntaxNode root, Diagnostic dia return (expression, name, arguments); } } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Simplify_LINQ_expression, createChangedDocument, AnalyzersResources.Simplify_LINQ_expression) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionCodeFixProvider.cs index 28b1ce648075d..0689afde32485 100644 --- a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionCodeFixProvider.cs @@ -35,8 +35,10 @@ protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Use_coalesce_expression, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(AnalyzersResources.Use_coalesce_expression)), context.Diagnostics); return Task.CompletedTask; } @@ -105,14 +107,5 @@ private static SyntaxNode GetCoalesceExpression( ? generator.CoalesceExpression(conditionalPartLow, syntaxFacts.WalkDownParentheses(currentWhenTrue)) : generator.CoalesceExpression(conditionalPartLow, syntaxFacts.WalkDownParentheses(currentWhenFalse)); } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Use_coalesce_expression, createChangedDocument, nameof(AnalyzersResources.Use_coalesce_expression)) - { - - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableCodeFixProvider.cs index e637ffbe5be59..5b06b8388e778 100644 --- a/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseCoalesceExpression/UseCoalesceExpressionForNullableCodeFixProvider.cs @@ -34,8 +34,10 @@ protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Use_coalesce_expression, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(AnalyzersResources.Use_coalesce_expression)), context.Diagnostics); return Task.CompletedTask; } @@ -81,14 +83,5 @@ protected override async Task FixAllAsync( }); } } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Use_coalesce_expression, createChangedDocument, nameof(AnalyzersResources.Use_coalesce_expression)) - { - - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseCollectionInitializer/AbstractUseCollectionInitializerCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseCollectionInitializer/AbstractUseCollectionInitializerCodeFixProvider.cs index 30cf4e5ab1441..02bb361d6cb05 100644 --- a/src/Analyzers/Core/CodeFixes/UseCollectionInitializer/AbstractUseCollectionInitializerCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseCollectionInitializer/AbstractUseCollectionInitializerCodeFixProvider.cs @@ -47,7 +47,10 @@ protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics.First(), c)), + CodeAction.Create( + AnalyzersResources.Collection_initialization_can_be_simplified, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(AnalyzersResources.Collection_initialization_can_be_simplified)), context.Diagnostics); return Task.CompletedTask; } @@ -116,13 +119,5 @@ protected override async Task FixAllAsync( protected abstract TStatementSyntax GetNewStatement( TStatementSyntax statement, TObjectCreationExpressionSyntax objectCreation, ImmutableArray matches); - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Collection_initialization_can_be_simplified, createChangedDocument, nameof(AnalyzersResources.Collection_initialization_can_be_simplified)) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs index 5d506744a74c8..aef3555b02d3d 100644 --- a/src/Analyzers/Core/CodeFixes/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseCompoundAssignment/AbstractUseCompoundAssignmentCodeFixProvider.cs @@ -48,8 +48,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) var document = context.Document; var diagnostic = context.Diagnostics[0]; - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(document, diagnostic, c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Use_compound_assignment, + c => FixAsync(document, diagnostic, c), + nameof(AnalyzersResources.Use_compound_assignment)), context.Diagnostics); return Task.CompletedTask; @@ -113,13 +115,5 @@ protected virtual bool PreferPostfix(ISyntaxFactsService syntaxFacts, TAssignmen // ++x to ensure that we preserve semantics. return false; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Use_compound_assignment, createChangedDocument, AnalyzersResources.Use_compound_assignment) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseConditionalExpression/ForAssignment/AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseConditionalExpression/ForAssignment/AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs index 01e8bd060b48a..f3f6fec3ca341 100644 --- a/src/Analyzers/Core/CodeFixes/UseConditionalExpression/ForAssignment/AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseConditionalExpression/ForAssignment/AbstractUseConditionalExpressionForAssignmentCodeFixProvider.cs @@ -46,7 +46,10 @@ public override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics.First(), c)), + CodeAction.Create( + AnalyzersResources.Convert_to_conditional_expression, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(AnalyzersResources.Convert_to_conditional_expression)), context.Diagnostics); return Task.CompletedTask; } @@ -260,13 +263,5 @@ private bool ReferencesLocalVariable(IOperation operation, ILocalSymbol variable return false; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Convert_to_conditional_expression, createChangedDocument, IDEDiagnosticIds.UseConditionalExpressionForAssignmentDiagnosticId) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseConditionalExpression/ForReturn/AbstractUseConditionalExpressionForReturnCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseConditionalExpression/ForReturn/AbstractUseConditionalExpressionForReturnCodeFixProvider.cs index b2500a3767d6f..562e575fd11e2 100644 --- a/src/Analyzers/Core/CodeFixes/UseConditionalExpression/ForReturn/AbstractUseConditionalExpressionForReturnCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseConditionalExpression/ForReturn/AbstractUseConditionalExpressionForReturnCodeFixProvider.cs @@ -36,7 +36,10 @@ public override ImmutableArray FixableDiagnosticIds public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics.First(), c)), + CodeAction.Create( + AnalyzersResources.Convert_to_conditional_expression, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(AnalyzersResources.Convert_to_conditional_expression)), context.Diagnostics); return Task.CompletedTask; } @@ -86,13 +89,5 @@ protected override async Task FixOneAsync( editor.RemoveNode(falseStatement.Syntax, GetRemoveOptions(syntaxFacts, falseStatement.Syntax)); } } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Convert_to_conditional_expression, createChangedDocument, IDEDiagnosticIds.UseConditionalExpressionForReturnDiagnosticId) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs index 325b44e11577e..978708bd76f77 100644 --- a/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseNullPropagation/AbstractUseNullPropagationCodeFixProvider.cs @@ -50,8 +50,10 @@ protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) public override Task RegisterCodeFixesAsync(CodeFixContext context) { - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(context.Document, context.Diagnostics[0], c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Use_null_propagation, + c => FixAsync(context.Document, context.Diagnostics[0], c), + nameof(AnalyzersResources.Use_null_propagation)), context.Diagnostics); return Task.CompletedTask; } @@ -156,13 +158,5 @@ private SyntaxNode CreateConditionalAccessExpression( return currentConditional; } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Use_null_propagation, createChangedDocument, nameof(AnalyzersResources.Use_null_propagation)) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseObjectInitializer/AbstractUseObjectInitializerCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseObjectInitializer/AbstractUseObjectInitializerCodeFixProvider.cs index ed79af014c3bd..995d11fe20ff0 100644 --- a/src/Analyzers/Core/CodeFixes/UseObjectInitializer/AbstractUseObjectInitializerCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseObjectInitializer/AbstractUseObjectInitializerCodeFixProvider.cs @@ -45,7 +45,10 @@ protected override bool IncludeDiagnosticDuringFixAll(Diagnostic diagnostic) public override Task RegisterCodeFixesAsync(CodeFixContext context) { context.RegisterCodeFix( - new MyCodeAction(c => FixAsync(context.Document, context.Diagnostics.First(), c)), + CodeAction.Create( + AnalyzersResources.Object_initialization_can_be_simplified, + c => FixAsync(context.Document, context.Diagnostics.First(), c), + nameof(AnalyzersResources.Object_initialization_can_be_simplified)), context.Diagnostics); return Task.CompletedTask; } @@ -119,13 +122,5 @@ protected override async Task FixAllAsync( protected abstract TStatementSyntax GetNewStatement( TStatementSyntax statement, TObjectCreationExpressionSyntax objectCreation, ImmutableArray> matches); - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Object_initialization_can_be_simplified, createChangedDocument, nameof(AnalyzersResources.Object_initialization_can_be_simplified)) - { - } - } } } diff --git a/src/Analyzers/Core/CodeFixes/UseSystemHashCode/UseSystemHashCodeCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/UseSystemHashCode/UseSystemHashCodeCodeFixProvider.cs index fcd2a9d8956b2..f66e81ab9ce90 100644 --- a/src/Analyzers/Core/CodeFixes/UseSystemHashCode/UseSystemHashCodeCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/UseSystemHashCode/UseSystemHashCodeCodeFixProvider.cs @@ -35,8 +35,10 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) var document = context.Document; var diagnostic = context.Diagnostics[0]; - context.RegisterCodeFix(new MyCodeAction( - c => FixAsync(document, diagnostic, c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Use_System_HashCode, + c => FixAsync(document, diagnostic, c), + nameof(AnalyzersResources.Use_System_HashCode)), context.Diagnostics); return Task.CompletedTask; } @@ -92,13 +94,5 @@ protected override async Task FixAllAsync( } } } - - private class MyCodeAction : CustomCodeActions.DocumentChangeAction - { - public MyCodeAction(Func> createChangedDocument) - : base(AnalyzersResources.Use_System_HashCode, createChangedDocument, AnalyzersResources.Use_System_HashCode) - { - } - } } } diff --git a/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryByVal/VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryByVal/VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb index 82de49db13484..eeedb4434f1b4 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryByVal/VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryByVal/VisualBasicRemoveUnnecessaryByValCodeFixProvider.vb @@ -28,8 +28,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryByVal Public Overrides Function RegisterCodeFixesAsync(context As CodeFixContext) As Task For Each diagnostic In context.Diagnostics - context.RegisterCodeFix(New MyCodeAction( - Function(ct) FixAsync(context.Document, diagnostic, ct)), + context.RegisterCodeFix(CodeAction.Create( + VisualBasicAnalyzersResources.Remove_ByVal, + Function(ct) FixAsync(context.Document, diagnostic, ct), + NameOf(VisualBasicAnalyzersResources.Remove_ByVal)), diagnostic) Next @@ -44,13 +46,5 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryByVal editor.ReplaceNode(node, node.WithModifiers(tokenList)) Next End Function - - Private Class MyCodeAction - Inherits CustomCodeActions.DocumentChangeAction - - Friend Sub New(createChangedDocument As Func(Of CancellationToken, Task(Of Document))) - MyBase.New(VisualBasicAnalyzersResources.Remove_ByVal, createChangedDocument, NameOf(VisualBasicAnalyzersResources.Remove_ByVal)) - End Sub - End Class End Class End Namespace diff --git a/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryCast/VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryCast/VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb index 10059e139b180..cac1c5ffb91ce 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryCast/VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/RemoveUnnecessaryCast/VisualBasicRemoveUnnecessaryCastCodeFixProvider.vb @@ -31,8 +31,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryCast ImmutableArray.Create(IDEDiagnosticIds.RemoveUnnecessaryCastDiagnosticId) Public Overrides Function RegisterCodeFixesAsync(context As CodeFixContext) As Task - context.RegisterCodeFix(New MyCodeAction( - Function(c) FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + AnalyzersResources.Remove_Unnecessary_Cast, + Function(c) FixAsync(context.Document, context.Diagnostics.First(), c), + NameOf(AnalyzersResources.Remove_Unnecessary_Cast)), context.Diagnostics) Return Task.CompletedTask End Function @@ -158,13 +160,5 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.RemoveUnnecessaryCast Throw ExceptionUtilities.UnexpectedValue(old) End Function - - Private Class MyCodeAction - Inherits CustomCodeActions.DocumentChangeAction - - Public Sub New(createChangedDocument As Func(Of CancellationToken, Task(Of Document))) - MyBase.New(AnalyzersResources.Remove_Unnecessary_Cast, createChangedDocument, NameOf(AnalyzersResources.Remove_Unnecessary_Cast)) - End Sub - End Class End Class End Namespace diff --git a/src/Analyzers/VisualBasic/CodeFixes/SimplifyObjectCreation/VisualBasicSimplifyObjectCreationCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/SimplifyObjectCreation/VisualBasicSimplifyObjectCreationCodeFixProvider.vb index e9017da936990..9d9eec48bc5a4 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/SimplifyObjectCreation/VisualBasicSimplifyObjectCreationCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/SimplifyObjectCreation/VisualBasicSimplifyObjectCreationCodeFixProvider.vb @@ -26,9 +26,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SimplifyObjectCreation Public Overrides Function RegisterCodeFixesAsync(context As CodeFixContext) As Task For Each diagnostic In context.Diagnostics - context.RegisterCodeFix(New MyCodeAction( + context.RegisterCodeFix(CodeAction.Create( VisualBasicCodeFixesResources.Simplify_object_creation, - Function(ct) FixAsync(context.Document, diagnostic, ct)), + Function(ct) FixAsync(context.Document, diagnostic, ct), + NameOf(VisualBasicCodeFixesResources.Simplify_object_creation)), diagnostic) Next @@ -47,13 +48,5 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.SimplifyObjectCreation editor.ReplaceNode(node, newNode) Next End Function - - Private Class MyCodeAction - Inherits CustomCodeActions.DocumentChangeAction - - Friend Sub New(title As String, createChangedDocument As Func(Of CancellationToken, Task(Of Document))) - MyBase.New(title, createChangedDocument, NameOf(VisualBasicCodeFixesResources.Simplify_object_creation)) - End Sub - End Class End Class End Namespace diff --git a/src/Analyzers/VisualBasic/CodeFixes/UseIsNotExpression/VisualBasicUseIsNotExpressionCodeFixProvider.vb b/src/Analyzers/VisualBasic/CodeFixes/UseIsNotExpression/VisualBasicUseIsNotExpressionCodeFixProvider.vb index 6bc3cc829269f..511485ff99336 100644 --- a/src/Analyzers/VisualBasic/CodeFixes/UseIsNotExpression/VisualBasicUseIsNotExpressionCodeFixProvider.vb +++ b/src/Analyzers/VisualBasic/CodeFixes/UseIsNotExpression/VisualBasicUseIsNotExpressionCodeFixProvider.vb @@ -26,8 +26,10 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UseIsNotExpression Public Overrides ReadOnly Property FixableDiagnosticIds As ImmutableArray(Of String) = ImmutableArray.Create(IDEDiagnosticIds.UseIsNotExpressionDiagnosticId) Public Overrides Function RegisterCodeFixesAsync(context As CodeFixContext) As Task - context.RegisterCodeFix(New MyCodeAction( - Function(c) FixAsync(context.Document, context.Diagnostics.First(), c)), + context.RegisterCodeFix(CodeAction.Create( + VisualBasicAnalyzersResources.Use_IsNot_expression, + Function(c) FixAsync(context.Document, context.Diagnostics.First(), c), + NameOf(VisualBasicAnalyzersResources.Use_IsNot_expression)), context.Diagnostics) Return Task.CompletedTask End Function @@ -76,13 +78,5 @@ Namespace Microsoft.CodeAnalysis.VisualBasic.UseIsNotExpression notExpression, replacement.WithPrependedLeadingTrivia(notExpression.GetLeadingTrivia())) End Sub - - Private Class MyCodeAction - Inherits CustomCodeActions.DocumentChangeAction - - Public Sub New(createChangedDocument As Func(Of CancellationToken, Task(Of Document))) - MyBase.New(VisualBasicAnalyzersResources.Use_IsNot_expression, createChangedDocument, VisualBasicAnalyzersResources.Use_IsNot_expression) - End Sub - End Class End Class End Namespace From e2acea24ef5665090e61a75dfed23008bcaf920e Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Mon, 4 Apr 2022 18:41:19 +0200 Subject: [PATCH 118/131] One more that's not named MyCodeAction --- .../MisplacedUsingDirectivesCodeFixProvider.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/Analyzers/CSharp/CodeFixes/MisplacedUsingDirectives/MisplacedUsingDirectivesCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/MisplacedUsingDirectives/MisplacedUsingDirectivesCodeFixProvider.cs index 443f23137674d..540a1a2521913 100644 --- a/src/Analyzers/CSharp/CodeFixes/MisplacedUsingDirectives/MisplacedUsingDirectivesCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/MisplacedUsingDirectives/MisplacedUsingDirectivesCodeFixProvider.cs @@ -79,7 +79,10 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) foreach (var diagnostic in context.Diagnostics) { context.RegisterCodeFix( - new MoveMisplacedUsingsCodeAction(token => GetTransformedDocumentAsync(document, compilationUnit, GetAllUsingDirectives(compilationUnit), placement, token)), + CodeAction.Create( + CSharpAnalyzersResources.Move_misplaced_using_directives, + token => GetTransformedDocumentAsync(document, compilationUnit, GetAllUsingDirectives(compilationUnit), placement, token), + nameof(CSharpAnalyzersResources.Move_misplaced_using_directives)), diagnostic); } } @@ -426,13 +429,5 @@ private static CompilationUnitSyntax AddFileHeader(CompilationUnitSyntax compila return compilationUnit.ReplaceToken(firstToken, newFirstToken); } - - private class MoveMisplacedUsingsCodeAction : CustomCodeActions.DocumentChangeAction - { - public MoveMisplacedUsingsCodeAction(Func> createChangedDocument) - : base(CSharpAnalyzersResources.Move_misplaced_using_directives, createChangedDocument, nameof(CSharpAnalyzersResources.Move_misplaced_using_directives)) - { - } - } } } From 6413f9e0e544cc477daf198ef03e0f75c2cbff70 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Mon, 4 Apr 2022 11:02:21 -0700 Subject: [PATCH 119/131] Fix up changes between main and main-vs-deps --- .../CSharpFixIncorrectConstraintCodeFixProvider.cs | 3 --- .../ForEachCast/AbstractForEachCastCodeFixProvider.cs | 3 --- .../ConvertProgram/ConvertToProgramMainCodeFixProvider.cs | 3 --- .../ConvertToTopLevelStatementsCodeFixProvider.cs | 3 --- .../AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs | 2 +- 5 files changed, 1 insertion(+), 13 deletions(-) diff --git a/src/Analyzers/CSharp/CodeFixes/FixIncorrectConstraint/CSharpFixIncorrectConstraintCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/FixIncorrectConstraint/CSharpFixIncorrectConstraintCodeFixProvider.cs index 5306afc8bb52b..487b8d79e7544 100644 --- a/src/Analyzers/CSharp/CodeFixes/FixIncorrectConstraint/CSharpFixIncorrectConstraintCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/FixIncorrectConstraint/CSharpFixIncorrectConstraintCodeFixProvider.cs @@ -33,9 +33,6 @@ public CSharpFixIncorrectConstraintCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(CS9010, CS9011); - internal override CodeFixCategory CodeFixCategory - => CodeFixCategory.Compile; - private static bool TryGetConstraint( Diagnostic diagnostic, CancellationToken cancellationToken, diff --git a/src/Analyzers/Core/CodeFixes/ForEachCast/AbstractForEachCastCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/ForEachCast/AbstractForEachCastCodeFixProvider.cs index 4056808f150b1..3939f0f7aa54d 100644 --- a/src/Analyzers/Core/CodeFixes/ForEachCast/AbstractForEachCastCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/ForEachCast/AbstractForEachCastCodeFixProvider.cs @@ -27,9 +27,6 @@ internal abstract class AbstractForEachCastCodeFixProvider FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.ForEachCastDiagnosticId); - internal sealed override CodeFixCategory CodeFixCategory - => CodeFixCategory.CodeStyle; - public override Task RegisterCodeFixesAsync(CodeFixContext context) { if (context.Diagnostics.First().Properties.ContainsKey(ForEachCastHelpers.IsFixable)) diff --git a/src/Features/CSharp/Portable/ConvertProgram/ConvertToProgramMainCodeFixProvider.cs b/src/Features/CSharp/Portable/ConvertProgram/ConvertToProgramMainCodeFixProvider.cs index 122667558ea7e..441b21784ad86 100644 --- a/src/Features/CSharp/Portable/ConvertProgram/ConvertToProgramMainCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/ConvertProgram/ConvertToProgramMainCodeFixProvider.cs @@ -31,9 +31,6 @@ public ConvertToProgramMainCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseProgramMainId); - internal override CodeFixCategory CodeFixCategory - => CodeFixCategory.CodeStyle; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; diff --git a/src/Features/CSharp/Portable/ConvertProgram/ConvertToTopLevelStatementsCodeFixProvider.cs b/src/Features/CSharp/Portable/ConvertProgram/ConvertToTopLevelStatementsCodeFixProvider.cs index ff8b1692e407b..d10c1287cf23c 100644 --- a/src/Features/CSharp/Portable/ConvertProgram/ConvertToTopLevelStatementsCodeFixProvider.cs +++ b/src/Features/CSharp/Portable/ConvertProgram/ConvertToTopLevelStatementsCodeFixProvider.cs @@ -32,9 +32,6 @@ public ConvertToTopLevelStatementsCodeFixProvider() public override ImmutableArray FixableDiagnosticIds => ImmutableArray.Create(IDEDiagnosticIds.UseTopLevelStatementsId); - internal override CodeFixCategory CodeFixCategory - => CodeFixCategory.CodeStyle; - public override async Task RegisterCodeFixesAsync(CodeFixContext context) { var document = context.Document; diff --git a/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs b/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs index 95ca9014c70b7..e50e5cf742a43 100644 --- a/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs +++ b/src/Features/Core/Portable/CodeFixes/AddExplicitCast/AbstractAddExplicitCastCodeFixProvider.cs @@ -101,7 +101,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) ReportTelemetryIfNecessary(potentialConversionTypes); context.RegisterCodeFix(CodeAction.CodeActionWithNestedActions.Create( - FeaturesResources.Add_explicit_cast, + AnalyzersResources.Add_explicit_cast, actions.ToImmutable(), isInlinable: false), context.Diagnostics); } From 1880e6dc66e3bc5df282fba0a167d8295039ff72 Mon Sep 17 00:00:00 2001 From: Youssef1313 Date: Mon, 4 Apr 2022 20:53:26 +0200 Subject: [PATCH 120/131] Few fixes --- ...spaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs | 5 +++-- .../AbstractMultipleBlankLinesCodeFixProvider.cs | 4 ++-- .../RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs b/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs index 5d8049cb8a381..b7b8c464dcb15 100644 --- a/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs +++ b/src/Analyzers/Core/CodeFixes/MatchFolderAndNamespace/AbstractChangeNamespaceToMatchFolderCodeFixProvider.CustomFixAllProvider.cs @@ -40,13 +40,14 @@ private class CustomFixAllProvider : FixAllProvider return null; var title = FixAllContextHelper.GetDefaultFixAllTitle(fixAllContext); - return new MyCodeAction( + return CodeAction.Create( title, cancellationToken => FixAllByDocumentAsync( fixAllContext.Project.Solution, diagnostics, fixAllContext.GetProgressTracker(), - cancellationToken)); + cancellationToken), + title); static async Task> GetSolutionDiagnosticsAsync(FixAllContext fixAllContext) { diff --git a/src/Analyzers/Core/CodeFixes/NewLines/MultipleBlankLines/AbstractMultipleBlankLinesCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/NewLines/MultipleBlankLines/AbstractMultipleBlankLinesCodeFixProvider.cs index c2dfd7327f8fc..df37361468f33 100644 --- a/src/Analyzers/Core/CodeFixes/NewLines/MultipleBlankLines/AbstractMultipleBlankLinesCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/NewLines/MultipleBlankLines/AbstractMultipleBlankLinesCodeFixProvider.cs @@ -35,9 +35,9 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) var document = context.Document; var diagnostic = context.Diagnostics.First(); context.RegisterCodeFix(CodeAction.Create( - Remove_extra_blank_lines, + CodeFixesResources.Remove_extra_blank_lines, c => UpdateDocumentAsync(document, diagnostic, c), - nameof(Remove_extra_blank_lines)), + nameof(CodeFixesResources.Remove_extra_blank_lines)), context.Diagnostics); return Task.CompletedTask; } diff --git a/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs b/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs index 91a8c5b1eba0a..fe01682012524 100644 --- a/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs +++ b/src/Analyzers/Core/CodeFixes/RemoveUnnecessarySuppressions/RemoveUnnecessaryAttributeSuppressionsCodeFixProvider.cs @@ -37,7 +37,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context) if (root.FindNode(diagnostic.Location.SourceSpan) != null) { context.RegisterCodeFix( - new MyCodeAction( + CodeAction.Create( AnalyzersResources.Remove_unnecessary_suppression, c => FixAsync(context.Document, diagnostic, c), nameof(AnalyzersResources.Remove_unnecessary_suppression)), From 8f949c91ac751e392d57adbc73819316663d9484 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Mon, 4 Apr 2022 12:45:28 -0700 Subject: [PATCH 121/131] Note auto-default merged in feature status doc (#60564) --- docs/Language Feature Status.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Language Feature Status.md b/docs/Language Feature Status.md index 036073c51e956..5b20b0e94a580 100644 --- a/docs/Language Feature Status.md +++ b/docs/Language Feature Status.md @@ -29,7 +29,7 @@ efforts behind them. | [Utf8 String Literals](https://github.com/dotnet/csharplang/issues/184) | [Utf8StringLiterals](https://github.com/dotnet/roslyn/tree/features/Utf8StringLiterals) | [In Progress](https://github.com/dotnet/roslyn/issues/58848) | [AlekseyTs](https://github.com/AlekseyTs) | [cston](https://github.com/cston), [RikkiGibson](https://github.com/RikkiGibson) | [MadsTorgersen](https://github.com/MadsTorgersen) | | [ref fields](https://github.com/dotnet/csharplang/blob/main/proposals/low-level-struct-improvements.md) | [ref-fields](https://github.com/dotnet/roslyn/tree/features/ref-fields) | [In Progress](https://github.com/dotnet/roslyn/issues/59194) | [cston](https://github.com/cston) | [RikkiGibson](https://github.com/RikkiGibson), [AlekseyTs](https://github.com/AlekseyTs) | [jaredpar](https://github.com/jaredpar) | | [Checked Operators](https://github.com/dotnet/csharplang/issues/4665) | [CheckedUserDefinedOperators](https://github.com/dotnet/roslyn/tree/features/CheckedUserDefinedOperators) | [In Progress](https://github.com/dotnet/roslyn/issues/59458) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [chsienki](https://github.com/chsienki) | [AlekseyTs](https://github.com/AlekseyTs) | -| [auto-default structs](https://github.com/dotnet/csharplang/issues/5737) | main | [In Progress](https://github.com/dotnet/roslyn/issues/60167) | [RikkiGibson](https://github.com/RikkiGibson) | [cston](https://github.com/cston), [jcouv](https://github.com/jcouv) | +| [auto-default structs](https://github.com/dotnet/csharplang/issues/5737) | main | [Merged into 17.3p1](https://github.com/dotnet/roslyn/issues/60167) | [RikkiGibson](https://github.com/RikkiGibson) | [cston](https://github.com/cston), [jcouv](https://github.com/jcouv) | | [Unsigned Right Shift](https://github.com/dotnet/csharplang/issues/4682) | [UnsignedRightShift](https://github.com/dotnet/roslyn/tree/features/UnsignedRightShift) | [In Progress](https://github.com/dotnet/roslyn/issues/60433) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs) | From 2e969273f9f3807f1f8d62b1a6a0fb1b76c33492 Mon Sep 17 00:00:00 2001 From: Allison Chou Date: Mon, 4 Apr 2022 12:59:09 -0700 Subject: [PATCH 122/131] Update PublishData.json for 17.3 P1 (#60559) --- azure-pipelines-integration-corehost.yml | 1 + azure-pipelines-integration.yml | 1 + azure-pipelines.yml | 1 + eng/config/PublishData.json | 7 +++---- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/azure-pipelines-integration-corehost.yml b/azure-pipelines-integration-corehost.yml index 6d499f5903594..ae9c832d11972 100644 --- a/azure-pipelines-integration-corehost.yml +++ b/azure-pipelines-integration-corehost.yml @@ -22,6 +22,7 @@ pr: paths: exclude: - docs/* + - eng/config/PublishData.json - .vscode/* - .github/* - .devcontainer/* diff --git a/azure-pipelines-integration.yml b/azure-pipelines-integration.yml index 4bc45b097d825..891bf384d9706 100644 --- a/azure-pipelines-integration.yml +++ b/azure-pipelines-integration.yml @@ -18,6 +18,7 @@ pr: paths: exclude: - docs/* + - eng/config/PublishData.json - .vscode/* - .github/* - .devcontainer/ diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d2a248aec0f0a..25342c1531094 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,6 +18,7 @@ pr: paths: exclude: - docs/* + - eng/config/PublishData.json - .vscode/* - .github/* - .devcontainer/* diff --git a/eng/config/PublishData.json b/eng/config/PublishData.json index 0e406bae634bb..c1b1d036f5155 100644 --- a/eng/config/PublishData.json +++ b/eng/config/PublishData.json @@ -220,10 +220,9 @@ "version": "4.2.*", "packageFeeds": "default", "channels": [], - "vsBranch": "main", - "insertionCreateDraftPR": false, + "vsBranch": "rel/d17.2", "vsMajorVersion": 17, - "insertionTitlePrefix": "[d17.2p3]" + "insertionTitlePrefix": "[d17.2]" }, "main": { "nugetKind": [ @@ -248,7 +247,7 @@ "channels": [], "vsBranch": "main", "vsMajorVersion": 17, - "insertionCreateDraftPR": true, + "insertionCreateDraftPR": false, "insertionTitlePrefix": "[d17.3p1]" }, "features/NullableReferenceTypes": { From c8876af06b9acfadaa660ebf8894ab530f6cadfc Mon Sep 17 00:00:00 2001 From: Youssef Victor Date: Mon, 4 Apr 2022 22:13:13 +0200 Subject: [PATCH 123/131] Fix formatting --- .../CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs b/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs index eec9ceb27bf0a..354beb592db11 100644 --- a/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs +++ b/src/Analyzers/CSharp/CodeFixes/UseIsNullCheck/CSharpUseNullCheckOverTypeCheckCodeFixProvider.cs @@ -40,7 +40,7 @@ public override Task RegisterCodeFixesAsync(CodeFixContext context) var diagnostic = context.Diagnostics.First(); context.RegisterCodeFix( CodeAction.Create( - CSharpAnalyzersResources.Prefer_null_check_over_type_check, + CSharpAnalyzersResources.Prefer_null_check_over_type_check, c => FixAsync(context.Document, diagnostic, c), nameof(CSharpAnalyzersResources.Prefer_null_check_over_type_check)), context.Diagnostics); From 6b1593b7d126beb1cd806052e5e69b590f0d9372 Mon Sep 17 00:00:00 2001 From: Rikki Gibson Date: Mon, 4 Apr 2022 14:42:06 -0700 Subject: [PATCH 124/131] Add Rebuild badge to README (#60298) --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 248a13804b4e5..0a1726e7ca0fc 100644 --- a/README.md +++ b/README.md @@ -81,10 +81,10 @@ Visit [Roslyn Architecture Overview](https://docs.microsoft.com/en-us/dotnet/csh #### Misc Tests -|Branch|Determinism|Build Correctness|Source build|Spanish|MacOS| -|:--:|:--:|:--|:--:|:--:|:--:| -**main**|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_Determinism&configuration=Correctness_Determinism&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_Build&configuration=Correctness_Build&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_SourceBuild&configuration=Correctness_SourceBuild&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Test_Windows_Desktop_Spanish_Release_32&configuration=Test_Windows_Desktop_Spanish_Release_32&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Test_macOS_Debug&configuration=Test_macOS_Debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)| -**main-vs-deps**|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_Determinism&configuration=Correctness_Determinism&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_Build&configuration=Correctness_Build&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_SourceBuild&configuration=Correctness_SourceBuild&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Test_Windows_Desktop_Spanish_Release_32&configuration=Test_Windows_Desktop_Spanish_Release_32&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Test_macOS_Debug&configuration=Test_macOS_Debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)| +|Branch|Determinism|Build Correctness|Rebuild from artifacts|Source build|Spanish|MacOS| +|:--:|:--:|:--|:--:|:--:|:--:|:--:| +**main**|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_Determinism&configuration=Correctness_Determinism&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_Build&configuration=Correctness_Build&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchName=main&jobName=Correctness_Rebuild)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchName=main)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Correctness_SourceBuild&configuration=Correctness_SourceBuild&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Test_Windows_Desktop_Spanish_Release_32&configuration=Test_Windows_Desktop_Spanish_Release_32&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main&jobname=Test_macOS_Debug&configuration=Test_macOS_Debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main&view=logs)| +**main-vs-deps**|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_Determinism&configuration=Correctness_Determinism&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_Build&configuration=Correctness_Build&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchName=main-vs-deps&jobName=Correctness_Rebuild)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchName=main-vs-deps)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Correctness_SourceBuild&configuration=Correctness_SourceBuild&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Test_Windows_Desktop_Spanish_Release_32&configuration=Test_Windows_Desktop_Spanish_Release_32&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)|[![Build Status](https://dev.azure.com/dnceng/public/_apis/build/status/dotnet/roslyn/roslyn-CI?branchname=main-vs-deps&jobname=Test_macOS_Debug&configuration=Test_macOS_Debug&label=build)](https://dev.azure.com/dnceng/public/_build/latest?definitionId=15&branchname=main-vs-deps&view=logs)| [//]: # (End current test results) From b7b37c3a2ef8bdaa14042376b2f7262d822eb285 Mon Sep 17 00:00:00 2001 From: Sam Harwell Date: Mon, 4 Apr 2022 11:59:58 -0700 Subject: [PATCH 125/131] Avoid using --blame-crash with CollectDumps This flag causes the test harness to attach ProcDump, which removes our ability to collect heap dumps on crash using Windows' built-in functionality. --- src/Tools/Source/RunTests/ITestExecutor.cs | 4 +++- src/Tools/Source/RunTests/ProcessTestExecutor.cs | 12 +++++++++--- src/Tools/Source/RunTests/Program.cs | 3 ++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Tools/Source/RunTests/ITestExecutor.cs b/src/Tools/Source/RunTests/ITestExecutor.cs index b6a774a935033..91e669b6c0bf6 100644 --- a/src/Tools/Source/RunTests/ITestExecutor.cs +++ b/src/Tools/Source/RunTests/ITestExecutor.cs @@ -16,8 +16,9 @@ internal readonly struct TestExecutionOptions internal string? TestFilter { get; } internal bool IncludeHtml { get; } internal bool Retry { get; } + internal bool CollectDumps { get; } - internal TestExecutionOptions(string dotnetFilePath, ProcDumpInfo? procDumpInfo, string testResultsDirectory, string? testFilter, bool includeHtml, bool retry) + internal TestExecutionOptions(string dotnetFilePath, ProcDumpInfo? procDumpInfo, string testResultsDirectory, string? testFilter, bool includeHtml, bool retry, bool collectDumps) { DotnetFilePath = dotnetFilePath; ProcDumpInfo = procDumpInfo; @@ -25,6 +26,7 @@ internal TestExecutionOptions(string dotnetFilePath, ProcDumpInfo? procDumpInfo, TestFilter = testFilter; IncludeHtml = includeHtml; Retry = retry; + CollectDumps = collectDumps; } } diff --git a/src/Tools/Source/RunTests/ProcessTestExecutor.cs b/src/Tools/Source/RunTests/ProcessTestExecutor.cs index 8819d7c880a36..0b98c98aee261 100644 --- a/src/Tools/Source/RunTests/ProcessTestExecutor.cs +++ b/src/Tools/Source/RunTests/ProcessTestExecutor.cs @@ -8,8 +8,6 @@ using System.Collections.Generic; using System.Collections.Immutable; using System.IO; -using System.Linq; -using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Threading.Tasks; @@ -81,11 +79,19 @@ void MaybeAddSeparator(char separator = '|') builder.AppendFormat($@" --logger {sep}html;LogFileName={GetResultsFilePath(assemblyInfo, "html")}{sep}"); } + if (!Options.CollectDumps) + { + // The 'CollectDumps' option uses operating system features to collect dumps when a process crashes. We + // only enable the test executor blame feature in remaining cases, as the latter relies on ProcDump and + // interferes with automatic crash dump collection on Windows. + builder.Append(" --blame-crash"); + } + // The 25 minute timeout accounts for the fact that VSIX deployment and/or experimental hive reset and // configuration can take significant time (seems to vary from ~10 seconds to ~15 minutes), and the blame // functionality cannot separate this configuration overhead from the first test which will eventually run. // https://github.com/dotnet/roslyn/issues/59851 - builder.Append(" --blame-crash --blame-hang-dump-type full --blame-hang-timeout 25minutes"); + builder.Append(" --blame-hang-dump-type full --blame-hang-timeout 25minutes"); return builder.ToString(); } diff --git a/src/Tools/Source/RunTests/Program.cs b/src/Tools/Source/RunTests/Program.cs index 49ba97dff8813..aaef3bd7eda5f 100644 --- a/src/Tools/Source/RunTests/Program.cs +++ b/src/Tools/Source/RunTests/Program.cs @@ -386,7 +386,8 @@ private static ProcessTestExecutor CreateTestExecutor(Options options) testResultsDirectory: options.TestResultsDirectory, testFilter: options.TestFilter, includeHtml: options.IncludeHtml, - retry: options.Retry); + retry: options.Retry, + collectDumps: options.CollectDumps); return new ProcessTestExecutor(testExecutionOptions); } From bb33e53bb0c3a303153e762ab0d1006d2cb15fe8 Mon Sep 17 00:00:00 2001 From: Jason Malinowski Date: Fri, 1 Apr 2022 17:09:57 -0700 Subject: [PATCH 126/131] Fix the Compiler VSIX extension so it works with CPS projects again This has been broken for quite some time. We were MEF importing a type that was no longer a MEF part, and referencing very old reference assemblies that needed to be updated as a part of responding to that original breaking change. --- eng/Versions.props | 1 - src/Compilers/Extension/Roslyn.Compilers.Extension.csproj | 5 +---- src/Compilers/Extension/SetGlobalGlobalPropertiesForCPS.cs | 5 ++--- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index caad4d4c66a94..1607783f8dc00 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -159,7 +159,6 @@ 15.8.27812-alpha 15.8.27812-alpha 17.0.77-pre-g62a6cb5699 - 2.3.6152103 16.3.44 16.10.10 1.16.30 diff --git a/src/Compilers/Extension/Roslyn.Compilers.Extension.csproj b/src/Compilers/Extension/Roslyn.Compilers.Extension.csproj index ed4259ec61bd6..28079f480a812 100644 --- a/src/Compilers/Extension/Roslyn.Compilers.Extension.csproj +++ b/src/Compilers/Extension/Roslyn.Compilers.Extension.csproj @@ -113,11 +113,8 @@ - + - - - diff --git a/src/Compilers/Extension/SetGlobalGlobalPropertiesForCPS.cs b/src/Compilers/Extension/SetGlobalGlobalPropertiesForCPS.cs index 7e6fb60b5d2a2..3b14a4a842e27 100644 --- a/src/Compilers/Extension/SetGlobalGlobalPropertiesForCPS.cs +++ b/src/Compilers/Extension/SetGlobalGlobalPropertiesForCPS.cs @@ -11,7 +11,6 @@ using System.Threading.Tasks; using Microsoft.VisualStudio.ProjectSystem; using Microsoft.VisualStudio.ProjectSystem.Build; -using Microsoft.VisualStudio.Shell.Interop; namespace Roslyn.Compilers.Extension { @@ -21,8 +20,8 @@ public class SetGlobalGlobalPropertiesForCPS : StaticGlobalPropertiesProviderBas { [ImportingConstructor] [Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] - public SetGlobalGlobalPropertiesForCPS(IProjectCommonServices commonServices) - : base(commonServices) + public SetGlobalGlobalPropertiesForCPS(IProjectService projectService) + : base(projectService.Services) { } From 90112dd05a50d83c723fc0c0a72ab4e1a9b7dd0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Tue, 5 Apr 2022 10:05:13 -0700 Subject: [PATCH 127/131] Make NotificationOption2 a serializable struct (#60573) --- .../Portable/CodeStyle/CodeStyleOption.cs | 2 +- .../CodeStyle/CodeStyleOption2_operators.cs | 2 +- .../NotificationOption2_operators.cs | 34 ++------------- .../Core/CodeStyle/CodeStyleHelpers.cs | 4 +- .../Core/CodeStyle/CodeStyleOption2`1.cs | 2 +- .../Core/CodeStyle/CodeStyleOptions2.cs | 11 +---- .../Core/CodeStyle/NotificationOption2.cs | 42 ++++--------------- 7 files changed, 19 insertions(+), 78 deletions(-) diff --git a/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOption.cs b/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOption.cs index 0003cb8023b54..b5c8bba1c9102 100644 --- a/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOption.cs +++ b/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOption.cs @@ -25,7 +25,7 @@ internal CodeStyleOption(CodeStyleOption2 codeStyleOptionImpl) => _codeStyleOptionImpl = codeStyleOptionImpl; public CodeStyleOption(T value, NotificationOption notification) - : this(new CodeStyleOption2(value, (NotificationOption2)notification)) + : this(new CodeStyleOption2(value, new NotificationOption2(notification.Severity))) { } diff --git a/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOption2_operators.cs b/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOption2_operators.cs index 2e7879a923557..771f202d0c306 100644 --- a/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOption2_operators.cs +++ b/src/Workspaces/Core/Portable/CodeStyle/CodeStyleOption2_operators.cs @@ -16,7 +16,7 @@ internal sealed partial class CodeStyleOption2 return null; } - return new CodeStyleOption(option.Value, (NotificationOption?)option.Notification); + return new CodeStyleOption(option.Value, (NotificationOption)option.Notification); } [return: NotNullIfNotNull("option")] diff --git a/src/Workspaces/Core/Portable/CodeStyle/NotificationOption2_operators.cs b/src/Workspaces/Core/Portable/CodeStyle/NotificationOption2_operators.cs index f1d083df55c7f..e0408ee654b37 100644 --- a/src/Workspaces/Core/Portable/CodeStyle/NotificationOption2_operators.cs +++ b/src/Workspaces/Core/Portable/CodeStyle/NotificationOption2_operators.cs @@ -2,41 +2,14 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System.Diagnostics.CodeAnalysis; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.CodeStyle { - internal sealed partial class NotificationOption2 + internal readonly partial record struct NotificationOption2 { - [return: NotNullIfNotNull("notificationOption")] - public static explicit operator NotificationOption2?(NotificationOption? notificationOption) - { - if (notificationOption is null) - { - return null; - } - - return notificationOption.Severity switch - { - ReportDiagnostic.Suppress => None, - ReportDiagnostic.Hidden => Silent, - ReportDiagnostic.Info => Suggestion, - ReportDiagnostic.Warn => Warning, - ReportDiagnostic.Error => Error, - _ => throw ExceptionUtilities.UnexpectedValue(notificationOption.Severity), - }; - } - - [return: NotNullIfNotNull("notificationOption")] - public static explicit operator NotificationOption?(NotificationOption2? notificationOption) - { - if (notificationOption is null) - { - return null; - } - - return notificationOption.Severity switch + public static explicit operator NotificationOption(NotificationOption2 notificationOption) + => notificationOption.Severity switch { ReportDiagnostic.Suppress => NotificationOption.None, ReportDiagnostic.Hidden => NotificationOption.Silent, @@ -45,6 +18,5 @@ internal sealed partial class NotificationOption2 ReportDiagnostic.Error => NotificationOption.Error, _ => throw ExceptionUtilities.UnexpectedValue(notificationOption.Severity), }; - } } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleHelpers.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleHelpers.cs index 2726e0a2d89d8..e7f53a264823b 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleHelpers.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleHelpers.cs @@ -59,7 +59,7 @@ public static bool TryGetCodeStyleValue( /// a NotificationOption, so will default to . /// public static bool TryGetCodeStyleValueAndOptionalNotification( - string arg, NotificationOption2 defaultNotification, [NotNullWhen(true)] out string? value, [NotNullWhen(true)] out NotificationOption2? notification) + string arg, NotificationOption2 defaultNotification, [NotNullWhen(true)] out string? value, [NotNullWhen(true)] out NotificationOption2 notification) { var args = arg.Split(':'); Debug.Assert(args.Length > 0); @@ -86,7 +86,7 @@ public static bool TryGetCodeStyleValueAndOptionalNotification( // We only support 0 or 1 args. Anything else can't be parsed properly. value = null; - notification = null; + notification = default; return false; } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOption2`1.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOption2`1.cs index 42207019791e7..c40d2ff605060 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOption2`1.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOption2`1.cs @@ -53,7 +53,7 @@ static CodeStyleOption2() public CodeStyleOption2(T value, NotificationOption2 notification) { Value = value; - _notification = notification ?? throw new ArgumentNullException(nameof(notification)); + _notification = notification; } public T Value { get; } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOptions2.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOptions2.cs index 5970fc48fd2c3..f7d068d7c7836 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOptions2.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOptions2.cs @@ -309,13 +309,6 @@ private static CodeStyleOption2 ParseAccessibili private static string GetAccessibilityModifiersRequiredEditorConfigString(CodeStyleOption2 option, CodeStyleOption2 defaultValue) { - // If they provide 'never', they don't need a notification level. - if (option.Notification == null) - { - Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(AccessibilityModifiersRequired.Never)); - return s_accessibilityModifiersRequiredMap.GetKeyOrDefault(AccessibilityModifiersRequired.Never)!; - } - Debug.Assert(s_accessibilityModifiersRequiredMap.ContainsValue(option.Value)); return $"{s_accessibilityModifiersRequiredMap.GetKeyOrDefault(option.Value)}{GetEditorConfigStringNotificationPart(option, defaultValue)}"; } @@ -425,7 +418,7 @@ private static string GetParenthesesPreferenceEditorConfigString(CodeStyleOption { Debug.Assert(s_parenthesesPreferenceMap.ContainsValue(option.Value)); var value = s_parenthesesPreferenceMap.GetKeyOrDefault(option.Value) ?? s_parenthesesPreferenceMap.GetKeyOrDefault(ParenthesesPreference.AlwaysForClarity); - return option.Notification == null ? value! : $"{value}{GetEditorConfigStringNotificationPart(option, defaultValue)}"; + return $"{value}{GetEditorConfigStringNotificationPart(option, defaultValue)}"; } private static CodeStyleOption2 ParseUnusedParametersPreference(string optionString, CodeStyleOption2 defaultValue) @@ -443,7 +436,7 @@ private static string GetUnusedParametersPreferenceEditorConfigString(CodeStyleO { Debug.Assert(s_unusedParametersPreferenceMap.ContainsValue(option.Value)); var value = s_unusedParametersPreferenceMap.GetKeyOrDefault(option.Value) ?? s_unusedParametersPreferenceMap.GetKeyOrDefault(defaultValue.Value); - return option.Notification == null ? value! : $"{value}{GetEditorConfigStringNotificationPart(option, defaultValue)}"; + return $"{value}{GetEditorConfigStringNotificationPart(option, defaultValue)}"; } } diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/NotificationOption2.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/NotificationOption2.cs index 022bb5480e878..daf32c5d62b3a 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/NotificationOption2.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/NotificationOption2.cs @@ -2,11 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -using System; - -#if CODE_STYLE -using WorkspacesResources = Microsoft.CodeAnalysis.CodeStyleResources; -#endif +using System.Runtime.Serialization; namespace Microsoft.CodeAnalysis.CodeStyle { @@ -14,54 +10,34 @@ namespace Microsoft.CodeAnalysis.CodeStyle /// Offers different notification styles for enforcing /// a code style. Under the hood, it simply maps to /// - /// - /// This also supports various properties for databinding. - /// /// - internal sealed partial class NotificationOption2 : IEquatable + [DataContract] + internal readonly partial record struct NotificationOption2( + [property: DataMember(Order = 0)] ReportDiagnostic Severity) { /// /// Notification option to disable or suppress an option with . /// - public static readonly NotificationOption2 None = new(ReportDiagnostic.Suppress); + public static NotificationOption2 None => new(ReportDiagnostic.Suppress); /// /// Notification option for a silent or hidden option with . /// - public static readonly NotificationOption2 Silent = new(ReportDiagnostic.Hidden); + public static NotificationOption2 Silent => new(ReportDiagnostic.Hidden); /// /// Notification option for a suggestion or an info option with . /// - public static readonly NotificationOption2 Suggestion = new(ReportDiagnostic.Info); + public static NotificationOption2 Suggestion => new(ReportDiagnostic.Info); /// /// Notification option for a warning option with . /// - public static readonly NotificationOption2 Warning = new(ReportDiagnostic.Warn); + public static NotificationOption2 Warning => new(ReportDiagnostic.Warn); /// /// Notification option for an error option with . /// - public static readonly NotificationOption2 Error = new(ReportDiagnostic.Error); - - /// - /// Diagnostic severity associated with notification option. - /// - public ReportDiagnostic Severity { get; } - - private NotificationOption2(ReportDiagnostic severity) - { - Severity = severity; - } - - public override bool Equals(object? obj) - => obj is NotificationOption2 other && Equals(other); - - public bool Equals(NotificationOption2? other) - => other != null && Severity == other.Severity; - - public override int GetHashCode() - => Severity.GetHashCode(); + public static NotificationOption2 Error => new(ReportDiagnostic.Error); } } From 74912d41ede5fbe4517db9459a4ccc680dbc66d0 Mon Sep 17 00:00:00 2001 From: Julien Couvreur Date: Tue, 5 Apr 2022 12:01:36 -0700 Subject: [PATCH 128/131] Update status for UTF8 literals and checked operators (#60587) --- docs/Language Feature Status.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Language Feature Status.md b/docs/Language Feature Status.md index 5b20b0e94a580..b40a544c14359 100644 --- a/docs/Language Feature Status.md +++ b/docs/Language Feature Status.md @@ -10,6 +10,9 @@ efforts behind them. | Feature | Branch | State | Developer | Reviewer | LDM Champ | | ------- | ------ | ----- | --------- | -------- | --------- | +| [Utf8 String Literals](https://github.com/dotnet/csharplang/issues/184) | [Utf8StringLiterals](https://github.com/dotnet/roslyn/tree/features/Utf8StringLiterals) | [Merged into 17.3p1](https://github.com/dotnet/roslyn/issues/58848) | [AlekseyTs](https://github.com/AlekseyTs) | [cston](https://github.com/cston), [RikkiGibson](https://github.com/RikkiGibson) | [MadsTorgersen](https://github.com/MadsTorgersen) | +| [Checked Operators](https://github.com/dotnet/csharplang/issues/4665) | [CheckedUserDefinedOperators](https://github.com/dotnet/roslyn/tree/features/CheckedUserDefinedOperators) | [Merged into 17.3p1](https://github.com/dotnet/roslyn/issues/59458) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [chsienki](https://github.com/chsienki) | [AlekseyTs](https://github.com/AlekseyTs) | +| [auto-default structs](https://github.com/dotnet/csharplang/issues/5737) | main | [Merged into 17.3p1](https://github.com/dotnet/roslyn/issues/60167) | [RikkiGibson](https://github.com/RikkiGibson) | [cston](https://github.com/cston), [jcouv](https://github.com/jcouv) | | [Newlines in interpolations](https://github.com/dotnet/csharplang/issues/4935) | main | [Merged in 17.1p1](https://github.com/dotnet/roslyn/issues/57154) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | [jcouv](https://github.com/jcouv), [chsienki](https://github.com/chsienki) | [CyrusNajmabadi](https://github.com/CyrusNajmabadi) | | [List patterns](https://github.com/dotnet/csharplang/issues/3435) | [list-patterns](https://github.com/dotnet/roslyn/tree/features/list-patterns) | [Merged in 17.1p2](https://github.com/dotnet/roslyn/issues/51289) | [alrz](https://github.com/alrz) | [jcouv](https://github.com/jcouv), [333fred](https://github.com/333fred) | [333fred](https://github.com/333fred) | | [Parameter null-checking](https://github.com/dotnet/csharplang/issues/2145) | [param-nullchecking](https://github.com/dotnet/roslyn/tree/features/param-nullchecking) | [Merged in 17.1p3](https://github.com/dotnet/roslyn/issues/36024) | [RikkiGibson](https://github.com/RikkiGibson), [fayrose](https://github.com/fayrose) | [cston](https://github.com/cston), [chsienki](https://github.com/chsienki) | [jaredpar](https://github.com/jaredpar) | @@ -26,10 +29,7 @@ efforts behind them. | [Params Span\ + Stackalloc any array type](https://github.com/dotnet/csharplang/issues/1757) | [params-span](https://github.com/dotnet/roslyn/tree/features/params-span) | [In Progress](https://github.com/dotnet/roslyn/issues/57049) | [cston](https://github.com/cston) | TBD | [jaredpar](https://github.com/jaredpar) | | [Pattern matching on `ReadOnlySpan`](https://github.com/dotnet/csharplang/issues/1881) | [patterns-span-char](https://github.com/dotnet/roslyn/tree/features/patterns-span-char) | [In Progress](https://github.com/dotnet/roslyn/issues/59191) | [YairHalberstadt ](https://github.com/YairHalberstadt) | [cston](https://github.com/cston), [RikkiGibson](https://github.com/RikkiGibson) | [jcouv](https://github.com/jcouv) | | [nameof accessing instance members](https://github.com/dotnet/roslyn/issues/40229) | main | [In Progress](https://github.com/dotnet/roslyn/pull/48754) | [YairHalberstadt ](https://github.com/YairHalberstadt) | [333fred](https://github.com/333fred), [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred) | -| [Utf8 String Literals](https://github.com/dotnet/csharplang/issues/184) | [Utf8StringLiterals](https://github.com/dotnet/roslyn/tree/features/Utf8StringLiterals) | [In Progress](https://github.com/dotnet/roslyn/issues/58848) | [AlekseyTs](https://github.com/AlekseyTs) | [cston](https://github.com/cston), [RikkiGibson](https://github.com/RikkiGibson) | [MadsTorgersen](https://github.com/MadsTorgersen) | | [ref fields](https://github.com/dotnet/csharplang/blob/main/proposals/low-level-struct-improvements.md) | [ref-fields](https://github.com/dotnet/roslyn/tree/features/ref-fields) | [In Progress](https://github.com/dotnet/roslyn/issues/59194) | [cston](https://github.com/cston) | [RikkiGibson](https://github.com/RikkiGibson), [AlekseyTs](https://github.com/AlekseyTs) | [jaredpar](https://github.com/jaredpar) | -| [Checked Operators](https://github.com/dotnet/csharplang/issues/4665) | [CheckedUserDefinedOperators](https://github.com/dotnet/roslyn/tree/features/CheckedUserDefinedOperators) | [In Progress](https://github.com/dotnet/roslyn/issues/59458) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [chsienki](https://github.com/chsienki) | [AlekseyTs](https://github.com/AlekseyTs) | -| [auto-default structs](https://github.com/dotnet/csharplang/issues/5737) | main | [Merged into 17.3p1](https://github.com/dotnet/roslyn/issues/60167) | [RikkiGibson](https://github.com/RikkiGibson) | [cston](https://github.com/cston), [jcouv](https://github.com/jcouv) | | [Unsigned Right Shift](https://github.com/dotnet/csharplang/issues/4682) | [UnsignedRightShift](https://github.com/dotnet/roslyn/tree/features/UnsignedRightShift) | [In Progress](https://github.com/dotnet/roslyn/issues/60433) | [AlekseyTs](https://github.com/AlekseyTs) | [333fred](https://github.com/333fred), [jcouv](https://github.com/jcouv) | [AlekseyTs](https://github.com/AlekseyTs) | From b999a65c8b0feeccb2b58da3d7a6e80e5f08feab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Matou=C5=A1ek?= Date: Tue, 5 Apr 2022 15:25:28 -0700 Subject: [PATCH 129/131] Workspace config options (#59790) --- .../AbstractDiagnosticsTaggerProvider.cs | 3 +- .../Core/Remote/RemoteHostOptions.cs | 2 +- .../Options/InternalFeatureOnOffOptions.cs | 2 +- .../DiagnosticAnalyzerServiceTests.cs | 10 ++- .../Test/Preview/PreviewWorkspaceTests.cs | 2 +- .../AbstractLanguageServerProtocolTests.cs | 6 +- ...s => TestWorkspaceConfigurationService.cs} | 15 ++--- ...ateToSearchService.CachedDocumentSearch.cs | 5 +- .../IRemoteNavigateToSearchService.cs | 2 +- .../SolutionCrawler/WorkCoordinator.cs | 9 +-- .../Portable/Workspace/ProjectCacheService.cs | 8 +-- ...gnosticIncrementalAnalyzer.ProjectState.cs | 2 +- ...osticIncrementalAnalyzer_GetDiagnostics.cs | 3 +- ...IncrementalAnalyzer_IncrementalAnalyzer.cs | 2 +- .../WorkspaceConfigurationOptionsStorage.cs | 51 +++++++++++++++ .../Options/WorkspaceConfigurationService.cs | 32 ++++++++++ .../WorkspacePullDiagnosticHandler.cs | 3 +- ...odeAnalysis.LanguageServer.Protocol.csproj | 1 + ...yzerRunnerWorkspaceConfigurationService.cs | 24 +++++++ .../IncrementalAnalyzerRunner.cs | 8 +-- .../SQLitePersistentStorageBenchmark.cs | 4 -- .../ClassificationBenchmarks.cs | 3 - .../FindReferencesBenchmarks.cs | 5 +- .../IdeCoreBenchmarks/NavigateToBenchmarks.cs | 5 +- .../Options/AdvancedOptionPageControl.xaml.cs | 6 +- ...ualStudioSyntaxTreeConfigurationService.cs | 62 ------------------- .../Workspace/SourceGeneratedFileManager.cs | 7 ++- .../CSharp/CSharpSourceGenerators.cs | 10 ++- .../InProcess/StateResetInProcess.cs | 9 ++- .../TestUtilities/WellKnownGlobalOptions.cs | 4 +- .../AbstractLiveShareRequestHandlerTests.cs | 2 +- .../Options/AdvancedOptionPageControl.xaml.vb | 6 +- .../AbstractClassificationService.cs | 9 +-- .../IRemoteSemanticClassificationService.cs | 2 - .../Shared/AbstractSyntaxIndex_Persistence.cs | 9 +-- .../FindSymbols/SymbolTree/SymbolTreeInfo.cs | 8 +-- .../SymbolTree/SymbolTreeInfo_Metadata.cs | 23 +++---- .../SymbolTreeInfo_Serialization.cs | 5 +- .../SymbolTree/SymbolTreeInfo_Source.cs | 7 +-- .../Storage/PersistentStorageExtensions.cs | 12 +--- .../Core/Portable/Storage/StorageOptions.cs | 39 ------------ .../IRemoteProcessTelemetryService.cs | 7 ++- .../ISyntaxTreeConfigurationService.cs | 15 ----- .../IWorkspaceConfigurationService.cs | 46 ++++++++++++++ .../Remote/Core/ServiceHubRemoteHostClient.cs | 6 +- .../RemoteNavigateToSearchService.cs | 4 +- .../RemoteProcessTelemetryService.cs | 8 ++- .../RemoteSyntaxTreeConfigurationService.cs | 32 ---------- .../RemoteWorkspaceConfigurationService.cs | 39 ++++++++++++ ...teSemanticClassificationService.Caching.cs | 30 ++++----- .../RemoteSemanticClassificationService.cs | 3 +- 51 files changed, 324 insertions(+), 293 deletions(-) rename src/EditorFeatures/TestUtilities/LanguageServer/{TestSyntaxTreeConfigurationService.cs => TestWorkspaceConfigurationService.cs} (55%) create mode 100644 src/Features/LanguageServer/Protocol/Features/Options/WorkspaceConfigurationOptionsStorage.cs create mode 100644 src/Features/LanguageServer/Protocol/Features/Options/WorkspaceConfigurationService.cs create mode 100644 src/Tools/AnalyzerRunner/AnalyzerRunnerWorkspaceConfigurationService.cs delete mode 100644 src/VisualStudio/Core/Def/Telemetry/VisualStudioSyntaxTreeConfigurationService.cs delete mode 100644 src/Workspaces/Core/Portable/Storage/StorageOptions.cs delete mode 100644 src/Workspaces/Core/Portable/Workspace/ISyntaxTreeConfigurationService.cs create mode 100644 src/Workspaces/Core/Portable/Workspace/IWorkspaceConfigurationService.cs delete mode 100644 src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteSyntaxTreeConfigurationService.cs create mode 100644 src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteWorkspaceConfigurationService.cs diff --git a/src/EditorFeatures/Core/Diagnostics/AbstractDiagnosticsTaggerProvider.cs b/src/EditorFeatures/Core/Diagnostics/AbstractDiagnosticsTaggerProvider.cs index 26e206936c43e..4689785d25c92 100644 --- a/src/EditorFeatures/Core/Diagnostics/AbstractDiagnosticsTaggerProvider.cs +++ b/src/EditorFeatures/Core/Diagnostics/AbstractDiagnosticsTaggerProvider.cs @@ -14,6 +14,7 @@ using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.Editor.Tagging; using Microsoft.CodeAnalysis.ErrorReporting; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; using Microsoft.CodeAnalysis.Shared.TestHooks; @@ -80,7 +81,7 @@ private void OnDiagnosticsUpdated(object? sender, DiagnosticsUpdatedArgs e) // If we couldn't find a normal document, and all features are enabled for source generated documents, // attempt to locate a matching source generated document in the project. if (document is null - && e.Workspace.Services.GetService() is { EnableOpeningSourceGeneratedFilesInWorkspace: true } + && e.Workspace.Services.GetService()?.Options.EnableOpeningSourceGeneratedFiles == true && e.Solution.GetProject(e.DocumentId.ProjectId) is { } project) { document = ThreadingContext.JoinableTaskFactory.Run(() => project.GetSourceGeneratedDocumentAsync(e.DocumentId, CancellationToken.None).AsTask()); diff --git a/src/EditorFeatures/Core/Remote/RemoteHostOptions.cs b/src/EditorFeatures/Core/Remote/RemoteHostOptions.cs index d97aef64a012a..bcb8aa2c30ee9 100644 --- a/src/EditorFeatures/Core/Remote/RemoteHostOptions.cs +++ b/src/EditorFeatures/Core/Remote/RemoteHostOptions.cs @@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.Remote [ExportGlobalOptionProvider, Shared] internal sealed class RemoteHostOptions : IOptionProvider { - private const string LocalRegistryPath = StorageOptions.LocalRegistryPath; + private const string LocalRegistryPath = @"Roslyn\Internal\OnOff\Features\"; private const string FeatureName = "InternalFeatureOnOffOptions"; // Update primary workspace on OOP every second if VS is not running any global operation (such as build, diff --git a/src/EditorFeatures/Core/Shared/Options/InternalFeatureOnOffOptions.cs b/src/EditorFeatures/Core/Shared/Options/InternalFeatureOnOffOptions.cs index 471ef185655b0..cba47eeb815c3 100644 --- a/src/EditorFeatures/Core/Shared/Options/InternalFeatureOnOffOptions.cs +++ b/src/EditorFeatures/Core/Shared/Options/InternalFeatureOnOffOptions.cs @@ -35,7 +35,7 @@ public InternalFeatureOnOffOptions() Snippets, BackgroundAnalysisMemoryMonitor); - private const string LocalRegistryPath = StorageOptions.LocalRegistryPath; + private const string LocalRegistryPath = @"Roslyn\Internal\OnOff\Features\"; private const string FeatureName = "InternalFeatureOnOffOptions"; public static readonly Option2 BraceMatching = new(FeatureName, "BraceMatching", defaultValue: true, diff --git a/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs b/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs index 4e231b3999a07..fd1680d31acea 100644 --- a/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs +++ b/src/EditorFeatures/Test/Diagnostics/DiagnosticAnalyzerServiceTests.cs @@ -864,9 +864,13 @@ void M() sourceGeneratedFiles = Array.Empty(); } - using var workspace = TestWorkspace.CreateCSharp(files, sourceGeneratedFiles, composition: s_editorFeaturesCompositionWithMockDiagnosticUpdateSourceRegistrationService.AddParts(typeof(TestDocumentTrackingService), typeof(TestSyntaxTreeConfigurationService))); - var syntaxTreeConfigurationService = workspace.GetService(); - syntaxTreeConfigurationService.EnableOpeningSourceGeneratedFilesInWorkspace = true; + using var workspace = TestWorkspace.CreateCSharp(files, sourceGeneratedFiles, + composition: s_editorFeaturesCompositionWithMockDiagnosticUpdateSourceRegistrationService.AddParts( + typeof(TestDocumentTrackingService), + typeof(TestWorkspaceConfigurationService))); + + var workspaceConfigurationService = workspace.GetService(); + workspaceConfigurationService.Options = new(EnableOpeningSourceGeneratedFiles: true); workspace.GlobalOptions.SetGlobalOption(new OptionKey(SolutionCrawlerOptionsStorage.BackgroundAnalysisScopeOption, LanguageNames.CSharp), analysisScope); diff --git a/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs b/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs index a99cccc95146b..98fc2e5d22de7 100644 --- a/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs +++ b/src/EditorFeatures/Test/Preview/PreviewWorkspaceTests.cs @@ -126,7 +126,7 @@ public async Task TestPreviewServices() var service = previewWorkspace.Services.GetService(); Assert.IsType(service); - var persistentService = previewWorkspace.Services.GetPersistentStorageService(previewWorkspace.CurrentSolution.Options); + var persistentService = previewWorkspace.Services.GetPersistentStorageService(); await using var storage = await persistentService.GetStorageAsync(SolutionKey.ToSolutionKey(previewWorkspace.CurrentSolution), CancellationToken.None); Assert.IsType(storage); diff --git a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs index 29a69e5b506cb..95015934d3234 100644 --- a/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs +++ b/src/EditorFeatures/TestUtilities/LanguageServer/AbstractLanguageServerProtocolTests.cs @@ -45,7 +45,7 @@ public abstract partial class AbstractLanguageServerProtocolTests private static readonly TestComposition s_composition = EditorTestCompositions.LanguageServerProtocol .AddParts(typeof(TestDocumentTrackingService)) .AddParts(typeof(TestWorkspaceRegistrationService)) - .AddParts(typeof(TestSyntaxTreeConfigurationService)) + .AddParts(typeof(TestWorkspaceConfigurationService)) .RemoveParts(typeof(MockWorkspaceEventListenerProvider)); private class TestSpanMapperProvider : IDocumentServiceProvider @@ -312,8 +312,8 @@ protected Task CreateTestLspServerAsync(string[] markups, string[ private Task CreateTestLspServerAsync(string[] markups, string[] sourceGeneratedMarkups, string languageName, LSP.ClientCapabilities? clientCapabilities, WellKnownLspServerKinds serverKind = WellKnownLspServerKinds.AlwaysActiveVSLspServer) { var exportProvider = Composition.ExportProviderFactory.CreateExportProvider(); - var syntaxTreeConfigurationService = exportProvider.GetExportedValue(); - syntaxTreeConfigurationService.EnableOpeningSourceGeneratedFilesInWorkspace = true; + var workspaceConfigurationService = exportProvider.GetExportedValue(); + workspaceConfigurationService.Options = new WorkspaceConfigurationOptions(EnableOpeningSourceGeneratedFiles: true); var workspace = languageName switch { diff --git a/src/EditorFeatures/TestUtilities/LanguageServer/TestSyntaxTreeConfigurationService.cs b/src/EditorFeatures/TestUtilities/LanguageServer/TestWorkspaceConfigurationService.cs similarity index 55% rename from src/EditorFeatures/TestUtilities/LanguageServer/TestSyntaxTreeConfigurationService.cs rename to src/EditorFeatures/TestUtilities/LanguageServer/TestWorkspaceConfigurationService.cs index be7f9ecb5b6fa..9915049dc04bb 100644 --- a/src/EditorFeatures/TestUtilities/LanguageServer/TestSyntaxTreeConfigurationService.cs +++ b/src/EditorFeatures/TestUtilities/LanguageServer/TestWorkspaceConfigurationService.cs @@ -5,26 +5,23 @@ using System; using System.Composition; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; namespace Roslyn.Test.Utilities { [Export] - [ExportWorkspaceService(typeof(ISyntaxTreeConfigurationService), ServiceLayer.Test)] + [ExportWorkspaceService(typeof(IWorkspaceConfigurationService), ServiceLayer.Test)] [Shared] [PartNotDiscoverable] - internal sealed class TestSyntaxTreeConfigurationService : ISyntaxTreeConfigurationService + internal sealed class TestWorkspaceConfigurationService : IWorkspaceConfigurationService { + public WorkspaceConfigurationOptions Options { get; set; } + [ImportingConstructor] [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public TestSyntaxTreeConfigurationService() + public TestWorkspaceConfigurationService() { } - - public bool DisableRecoverableTrees { get; set; } - - public bool DisableProjectCacheService { get; set; } - - public bool EnableOpeningSourceGeneratedFilesInWorkspace { get; set; } } } diff --git a/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.CachedDocumentSearch.cs b/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.CachedDocumentSearch.cs index d0f00632cc06b..868736a0b90bb 100644 --- a/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.CachedDocumentSearch.cs +++ b/src/Features/Core/Portable/NavigateTo/AbstractNavigateToSearchService.CachedDocumentSearch.cs @@ -63,7 +63,6 @@ public async Task SearchCachedDocumentsAsync( var solution = project.Solution; var client = await RemoteHostClient.TryGetClientAsync(project, cancellationToken).ConfigureAwait(false); var onItemFound = GetOnItemFoundCallback(solution, onResultFound, cancellationToken); - var database = solution.Options.GetPersistentStorageDatabase(); var documentKeys = project.Documents.SelectAsArray(d => DocumentKey.ToDocumentKey(d)); var priorityDocumentKeys = priorityDocuments.SelectAsArray(d => DocumentKey.ToDocumentKey(d)); @@ -72,13 +71,13 @@ public async Task SearchCachedDocumentsAsync( var callback = new NavigateToSearchServiceCallback(onItemFound); await client.TryInvokeAsync( (service, callbackId, cancellationToken) => - service.SearchCachedDocumentsAsync(documentKeys, priorityDocumentKeys, database, searchPattern, kinds.ToImmutableArray(), callbackId, cancellationToken), + service.SearchCachedDocumentsAsync(documentKeys, priorityDocumentKeys, searchPattern, kinds.ToImmutableArray(), callbackId, cancellationToken), callback, cancellationToken).ConfigureAwait(false); return; } - var storageService = solution.Workspace.Services.GetPersistentStorageService(database); + var storageService = solution.Workspace.Services.GetPersistentStorageService(); await SearchCachedDocumentsInCurrentProcessAsync( storageService, documentKeys, priorityDocumentKeys, searchPattern, kinds, onItemFound, cancellationToken).ConfigureAwait(false); } diff --git a/src/Features/Core/Portable/NavigateTo/IRemoteNavigateToSearchService.cs b/src/Features/Core/Portable/NavigateTo/IRemoteNavigateToSearchService.cs index dafc088965055..20ab05901511f 100644 --- a/src/Features/Core/Portable/NavigateTo/IRemoteNavigateToSearchService.cs +++ b/src/Features/Core/Portable/NavigateTo/IRemoteNavigateToSearchService.cs @@ -20,7 +20,7 @@ internal interface IRemoteNavigateToSearchService ValueTask SearchProjectAsync(PinnedSolutionInfo solutionInfo, ProjectId projectId, ImmutableArray priorityDocumentIds, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken); ValueTask SearchGeneratedDocumentsAsync(PinnedSolutionInfo solutionInfo, ProjectId projectId, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken); - ValueTask SearchCachedDocumentsAsync(ImmutableArray documentKeys, ImmutableArray priorityDocumentKeys, StorageDatabase database, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken); + ValueTask SearchCachedDocumentsAsync(ImmutableArray documentKeys, ImmutableArray priorityDocumentKeys, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken); ValueTask HydrateAsync(PinnedSolutionInfo solutionInfo, CancellationToken cancellationToken); diff --git a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.cs b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.cs index cfb95fc5c3e99..16bc6a736a3a4 100644 --- a/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.cs +++ b/src/Features/Core/Portable/SolutionCrawler/WorkCoordinator.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.Extensions; @@ -27,7 +28,7 @@ internal sealed partial class WorkCoordinator private readonly IAsynchronousOperationListener _listener; private readonly IOptionService _optionService; private readonly IDocumentTrackingService _documentTrackingService; - private readonly ISyntaxTreeConfigurationService? _syntaxTreeConfigurationService; + private readonly IWorkspaceConfigurationService? _workspaceConfigurationService; private readonly CancellationTokenSource _shutdownNotificationSource; private readonly CancellationToken _shutdownToken; @@ -51,7 +52,7 @@ public WorkCoordinator( _listener = listener; _optionService = _registration.Workspace.Services.GetRequiredService(); _documentTrackingService = _registration.Workspace.Services.GetRequiredService(); - _syntaxTreeConfigurationService = _registration.Workspace.Services.GetService(); + _workspaceConfigurationService = _registration.Workspace.Services.GetService(); // event and worker queues _shutdownNotificationSource = new CancellationTokenSource(); @@ -391,7 +392,7 @@ private void EnqueueDocumentChangedEvent(Solution oldSolution, Solution newSolut // If all features are enabled for source generated documents, the solution crawler needs to // include them in incremental analysis. - if (_syntaxTreeConfigurationService is { EnableOpeningSourceGeneratedFilesInWorkspace: true }) + if (_workspaceConfigurationService?.Options.EnableOpeningSourceGeneratedFiles == true) { // TODO: if this becomes a hot spot, we should be able to expose/access the dictionary // underneath GetSourceGeneratedDocumentsAsync rather than create a new one here. @@ -479,7 +480,7 @@ private async Task EnqueueFullProjectWorkItemAsync(Project project, InvocationRe // If all features are enabled for source generated documents, the solution crawler needs to // include them in incremental analysis. - if (_syntaxTreeConfigurationService is { EnableOpeningSourceGeneratedFilesInWorkspace: true }) + if (_workspaceConfigurationService?.Options.EnableOpeningSourceGeneratedFiles == true) { foreach (var document in await project.GetSourceGeneratedDocumentsAsync(_shutdownToken).ConfigureAwait(false)) await EnqueueDocumentWorkItemAsync(project, document.Id, document, invocationReasons).ConfigureAwait(false); diff --git a/src/Features/Core/Portable/Workspace/ProjectCacheService.cs b/src/Features/Core/Portable/Workspace/ProjectCacheService.cs index 55e7f36bc8034..c3d18d1acb1c8 100644 --- a/src/Features/Core/Portable/Workspace/ProjectCacheService.cs +++ b/src/Features/Core/Portable/Workspace/ProjectCacheService.cs @@ -26,7 +26,7 @@ internal partial class ProjectCacheService : IProjectCacheHostService private readonly object _gate = new(); private readonly Workspace? _workspace; - private readonly ISyntaxTreeConfigurationService? _configurationService; + private readonly IWorkspaceConfigurationService? _configurationService; private readonly Dictionary _activeCaches = new(); private readonly SimpleMRUCache? _implicitCache; @@ -35,7 +35,7 @@ internal partial class ProjectCacheService : IProjectCacheHostService public ProjectCacheService(Workspace? workspace) { _workspace = workspace; - _configurationService = workspace?.Services.GetService(); + _configurationService = workspace?.Services.GetService(); } public ProjectCacheService(Workspace? workspace, TimeSpan implicitCacheTimeout) @@ -49,7 +49,7 @@ public ProjectCacheService(Workspace? workspace, TimeSpan implicitCacheTimeout) /// Recoverable trees only save significant memory for larger trees. /// public int MinimumLengthForRecoverableTree - => (_configurationService?.DisableRecoverableTrees != true) ? 4 * 1024 : int.MaxValue; + => (_configurationService?.Options.DisableRecoverableTrees != true) ? 4 * 1024 : int.MaxValue; public bool IsImplicitCacheEmpty { @@ -117,7 +117,7 @@ public IDisposable EnableCaching(ProjectId key) } private bool IsEnabled - => _configurationService?.DisableProjectCacheService != true; + => _configurationService?.Options.DisableProjectCacheService != true; private bool PartOfP2PReferences(ProjectId key) { diff --git a/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.ProjectState.cs b/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.ProjectState.cs index 9378b9c518b01..8abc008265cb7 100644 --- a/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.ProjectState.cs +++ b/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer.ProjectState.cs @@ -205,7 +205,7 @@ public async ValueTask SaveToInMemoryStorageAsync(Project project, DiagnosticAna // If we couldn't find a normal document, and all features are enabled for source generated // documents, attempt to locate a matching source generated document in the project. if (document is null - && project.Solution.Workspace.Services.GetService() is { EnableOpeningSourceGeneratedFilesInWorkspace: true }) + && project.Solution.Workspace.Services.GetService()?.Options.EnableOpeningSourceGeneratedFiles == true) { document = await project.GetSourceGeneratedDocumentAsync(documentId, CancellationToken.None).ConfigureAwait(false); } diff --git a/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnostics.cs b/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnostics.cs index 8d478c1f7a23d..cd7f50098eb14 100644 --- a/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnostics.cs +++ b/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_GetDiagnostics.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Host; using Roslyn.Utilities; namespace Microsoft.CodeAnalysis.Diagnostics.EngineV2 @@ -206,7 +207,7 @@ private static async Task> GetProjectStateDiagnos // file doesn't exist in current solution var document = await project.Solution.GetDocumentAsync( documentId, - includeSourceGenerated: project.Solution.Workspace.Services.GetService() is { EnableOpeningSourceGeneratedFilesInWorkspace: true }, + includeSourceGenerated: project.Solution.Workspace.Services.GetService()?.Options.EnableOpeningSourceGeneratedFiles == true, cancellationToken).ConfigureAwait(false); if (document == null) diff --git a/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs b/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs index bb8a2c3b518bf..3d62cdbd54389 100644 --- a/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs +++ b/src/Features/LanguageServer/Protocol/Features/Diagnostics/EngineV2/DiagnosticIncrementalAnalyzer_IncrementalAnalyzer.cs @@ -539,7 +539,7 @@ private async Task RaiseProjectDiagnosticsCreatedAsync(Project project, StateSet // If we couldn't find a normal document, and all features are enabled for source generated documents, // attempt to locate a matching source generated document in the project. if (document is null - && project.Solution.Workspace.Services.GetService() is { EnableOpeningSourceGeneratedFilesInWorkspace: true }) + && project.Solution.Workspace.Services.GetService()?.Options.EnableOpeningSourceGeneratedFiles == true) { document = await project.GetSourceGeneratedDocumentAsync(documentId, cancellationToken).ConfigureAwait(false); } diff --git a/src/Features/LanguageServer/Protocol/Features/Options/WorkspaceConfigurationOptionsStorage.cs b/src/Features/LanguageServer/Protocol/Features/Options/WorkspaceConfigurationOptionsStorage.cs new file mode 100644 index 0000000000000..f16587510fa34 --- /dev/null +++ b/src/Features/LanguageServer/Protocol/Features/Options/WorkspaceConfigurationOptionsStorage.cs @@ -0,0 +1,51 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using Microsoft.CodeAnalysis.Options; +using Microsoft.CodeAnalysis.Storage; + +namespace Microsoft.CodeAnalysis.Host +{ + internal static class WorkspaceConfigurationOptionsStorage + { + public static WorkspaceConfigurationOptions GetWorkspaceConfigurationOptions(this IGlobalOptionService globalOptions) + => new( + CacheStorage: globalOptions.GetOption(CloudCacheFeatureFlag) ? StorageDatabase.CloudCache : globalOptions.GetOption(Database), + DisableProjectCacheService: globalOptions.GetOption(DisableProjectCacheService), + DisableRecoverableTrees: globalOptions.GetOption(DisableRecoverableTrees), + EnableOpeningSourceGeneratedFiles: globalOptions.GetOption(EnableOpeningSourceGeneratedFilesInWorkspace) ?? + globalOptions.GetOption(EnableOpeningSourceGeneratedFilesInWorkspaceFeatureFlag)); + + public static readonly Option2 Database = new( + "FeatureManager/Storage", nameof(Database), WorkspaceConfigurationOptions.Default.CacheStorage, + new LocalUserProfileStorageLocation(@"Roslyn\Internal\OnOff\Features\Database")); + + public static readonly Option2 CloudCacheFeatureFlag = new( + "FeatureManager/Storage", "CloudCacheFeatureFlag", WorkspaceConfigurationOptions.Default.CacheStorage == StorageDatabase.CloudCache, + new FeatureFlagStorageLocation("Roslyn.CloudCache3")); + + /// + /// Disables if the workspace creates recoverable trees when from its s. + /// + public static readonly Option2 DisableRecoverableTrees = new( + "WorkspaceConfigurationOptions", "DisableRecoverableTrees", WorkspaceConfigurationOptions.Default.DisableRecoverableTrees, + new FeatureFlagStorageLocation("Roslyn.DisableRecoverableTrees")); + + public static readonly Option2 DisableProjectCacheService = new( + "WorkspaceConfigurationOptions", nameof(DisableProjectCacheService), WorkspaceConfigurationOptions.Default.DisableProjectCacheService, + new FeatureFlagStorageLocation("Roslyn.DisableProjectCacheService")); + + /// + /// This option allows the user to enable this. We are putting this behind a feature flag for now since we could have extensions + /// surprised by this and we want some time to work through those issues. + /// + public static readonly Option2 EnableOpeningSourceGeneratedFilesInWorkspace = new( + "WorkspaceConfigurationOptions", "EnableOpeningSourceGeneratedFilesInWorkspace", defaultValue: null, + new RoamingProfileStorageLocation("TextEditor.Roslyn.Specific.EnableOpeningSourceGeneratedFilesInWorkspaceExperiment")); + + public static readonly Option2 EnableOpeningSourceGeneratedFilesInWorkspaceFeatureFlag = new( + "WorkspaceConfigurationOptions", "EnableOpeningSourceGeneratedFilesInWorkspaceFeatureFlag", WorkspaceConfigurationOptions.Default.EnableOpeningSourceGeneratedFiles, + new FeatureFlagStorageLocation("Roslyn.SourceGeneratorsEnableOpeningInWorkspace")); + } +} diff --git a/src/Features/LanguageServer/Protocol/Features/Options/WorkspaceConfigurationService.cs b/src/Features/LanguageServer/Protocol/Features/Options/WorkspaceConfigurationService.cs new file mode 100644 index 0000000000000..9def0f584375c --- /dev/null +++ b/src/Features/LanguageServer/Protocol/Features/Options/WorkspaceConfigurationService.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Options; + +namespace Microsoft.CodeAnalysis.Host +{ + [ExportWorkspaceService(typeof(IWorkspaceConfigurationService)), Shared] + internal sealed class WorkspaceConfigurationService : IWorkspaceConfigurationService + { + private readonly IGlobalOptionService _globalOptions; + private WorkspaceConfigurationOptions? _lazyOptions; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public WorkspaceConfigurationService(IGlobalOptionService globalOptions) + { + _globalOptions = globalOptions; + } + + public WorkspaceConfigurationOptions Options + => _lazyOptions ??= _globalOptions.GetWorkspaceConfigurationOptions(); + + internal void Clear() + => _lazyOptions = null; + } +} diff --git a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs index b87ae043f3d34..fbb96641c73c7 100644 --- a/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs +++ b/src/Features/LanguageServer/Protocol/Handler/Diagnostics/WorkspacePullDiagnosticHandler.cs @@ -9,6 +9,7 @@ using Microsoft.CodeAnalysis.Diagnostics; using Microsoft.CodeAnalysis.EditAndContinue; using Microsoft.CodeAnalysis.ExternalAccess.Razor.Api; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.PooledObjects; using Microsoft.CodeAnalysis.SolutionCrawler; @@ -131,7 +132,7 @@ async Task AddDocumentsFromProjectAsync(Project? project, ImmutableArray // documents from it. If all features are enabled for source generated documents, make sure they are // included as well. var documents = project.Documents; - if (solution.Workspace.Services.GetService() is { EnableOpeningSourceGeneratedFilesInWorkspace: true }) + if (solution.Workspace.Services.GetService()?.Options.EnableOpeningSourceGeneratedFiles == true) { documents = documents.Concat(await project.GetSourceGeneratedDocumentsAsync(cancellationToken).ConfigureAwait(false)); } diff --git a/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj b/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj index 2b9b7c98989cf..3de6b96acd04d 100644 --- a/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj +++ b/src/Features/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageServer.Protocol.csproj @@ -53,6 +53,7 @@ + diff --git a/src/Tools/AnalyzerRunner/AnalyzerRunnerWorkspaceConfigurationService.cs b/src/Tools/AnalyzerRunner/AnalyzerRunnerWorkspaceConfigurationService.cs new file mode 100644 index 0000000000000..eba5e336ed8c2 --- /dev/null +++ b/src/Tools/AnalyzerRunner/AnalyzerRunnerWorkspaceConfigurationService.cs @@ -0,0 +1,24 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Host.Mef; + +namespace AnalyzerRunner +{ + [ExportWorkspaceService(typeof(IWorkspaceConfigurationService), ServiceLayer.Host), Shared] + internal sealed class AnalyzerRunnerWorkspaceConfigurationService : IWorkspaceConfigurationService + { + public WorkspaceConfigurationOptions Options { get; set; } + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public AnalyzerRunnerWorkspaceConfigurationService() + { + } + } +} diff --git a/src/Tools/AnalyzerRunner/IncrementalAnalyzerRunner.cs b/src/Tools/AnalyzerRunner/IncrementalAnalyzerRunner.cs index 7dbd015a13c54..150ed75d47fec 100644 --- a/src/Tools/AnalyzerRunner/IncrementalAnalyzerRunner.cs +++ b/src/Tools/AnalyzerRunner/IncrementalAnalyzerRunner.cs @@ -42,21 +42,21 @@ public async Task RunAsync(CancellationToken cancellationToken) var usePersistentStorage = _options.UsePersistentStorage; - _workspace.TryApplyChanges(_workspace.CurrentSolution.WithOptions(_workspace.Options - .WithChangedOption(StorageOptions.Database, usePersistentStorage ? StorageDatabase.SQLite : StorageDatabase.None))); - var exportProvider = (IMefHostExportProvider)_workspace.Services.HostServices; var globalOptions = exportProvider.GetExports().Single().Value; globalOptions.SetGlobalOption(new OptionKey(SolutionCrawlerOptionsStorage.BackgroundAnalysisScopeOption, LanguageNames.CSharp), _options.AnalysisScope); globalOptions.SetGlobalOption(new OptionKey(SolutionCrawlerOptionsStorage.BackgroundAnalysisScopeOption, LanguageNames.VisualBasic), _options.AnalysisScope); + var workspaceConfigurationService = (AnalyzerRunnerWorkspaceConfigurationService)_workspace.Services.GetRequiredService(); + workspaceConfigurationService.Options = new(CacheStorage: usePersistentStorage ? StorageDatabase.SQLite : StorageDatabase.None); + var solutionCrawlerRegistrationService = (SolutionCrawlerRegistrationService)_workspace.Services.GetRequiredService(); solutionCrawlerRegistrationService.Register(_workspace); if (usePersistentStorage) { - var persistentStorageService = _workspace.Services.GetPersistentStorageService(_workspace.CurrentSolution.Options); + var persistentStorageService = _workspace.Services.GetPersistentStorageService(); await using var persistentStorage = await persistentStorageService.GetStorageAsync(SolutionKey.ToSolutionKey(_workspace.CurrentSolution), cancellationToken).ConfigureAwait(false); if (persistentStorage is NoOpPersistentStorage) { diff --git a/src/Tools/IdeBenchmarks/SQLitePersistentStorageBenchmark.cs b/src/Tools/IdeBenchmarks/SQLitePersistentStorageBenchmark.cs index 844d5e38cf74d..778a6dbe08607 100644 --- a/src/Tools/IdeBenchmarks/SQLitePersistentStorageBenchmark.cs +++ b/src/Tools/IdeBenchmarks/SQLitePersistentStorageBenchmark.cs @@ -61,10 +61,6 @@ public void GlobalSetup() "); - // Explicitly choose the sqlite db to test. - _workspace.TryApplyChanges(_workspace.CurrentSolution.WithOptions(_workspace.Options - .WithChangedOption(StorageOptions.Database, StorageDatabase.SQLite))); - var connectionPoolService = _workspace.ExportProvider.GetExportedValue(); var asyncListener = _workspace.ExportProvider.GetExportedValue().GetListener(FeatureAttribute.PersistentStorage); diff --git a/src/Tools/IdeCoreBenchmarks/ClassificationBenchmarks.cs b/src/Tools/IdeCoreBenchmarks/ClassificationBenchmarks.cs index 2f7788914422c..4592b8f5bb49c 100644 --- a/src/Tools/IdeCoreBenchmarks/ClassificationBenchmarks.cs +++ b/src/Tools/IdeCoreBenchmarks/ClassificationBenchmarks.cs @@ -86,9 +86,6 @@ private async Task LoadSolutionAsync() if (_workspace == null) throw new ArgumentException("Couldn't create workspace"); - _workspace.TryApplyChanges(_workspace.CurrentSolution.WithOptions(_workspace.Options - .WithChangedOption(StorageOptions.Database, StorageDatabase.SQLite))); - Console.WriteLine("Opening roslyn. Attach to: " + Process.GetCurrentProcess().Id); var start = DateTime.Now; diff --git a/src/Tools/IdeCoreBenchmarks/FindReferencesBenchmarks.cs b/src/Tools/IdeCoreBenchmarks/FindReferencesBenchmarks.cs index e270777053764..206bc9480814d 100644 --- a/src/Tools/IdeCoreBenchmarks/FindReferencesBenchmarks.cs +++ b/src/Tools/IdeCoreBenchmarks/FindReferencesBenchmarks.cs @@ -83,9 +83,6 @@ private async Task LoadSolutionAsync() if (_workspace == null) throw new ArgumentException("Couldn't create workspace"); - _workspace.TryApplyChanges(_workspace.CurrentSolution.WithOptions(_workspace.Options - .WithChangedOption(StorageOptions.Database, StorageDatabase.SQLite))); - Console.WriteLine("Opening roslyn. Attach to: " + Process.GetCurrentProcess().Id); var start = DateTime.Now; @@ -94,7 +91,7 @@ private async Task LoadSolutionAsync() // Force a storage instance to be created. This makes it simple to go examine it prior to any operations we // perform, including seeing how big the initial string table is. - var storageService = _workspace.Services.GetPersistentStorageService(_workspace.CurrentSolution.Options); + var storageService = _workspace.Services.GetPersistentStorageService(); if (storageService == null) throw new ArgumentException("Couldn't get storage service"); diff --git a/src/Tools/IdeCoreBenchmarks/NavigateToBenchmarks.cs b/src/Tools/IdeCoreBenchmarks/NavigateToBenchmarks.cs index b726e411bea9b..20ccc3f080ca7 100644 --- a/src/Tools/IdeCoreBenchmarks/NavigateToBenchmarks.cs +++ b/src/Tools/IdeCoreBenchmarks/NavigateToBenchmarks.cs @@ -85,9 +85,6 @@ private async Task LoadSolutionAsync() if (_workspace == null) throw new ArgumentException("Couldn't create workspace"); - _workspace.TryApplyChanges(_workspace.CurrentSolution.WithOptions(_workspace.Options - .WithChangedOption(StorageOptions.Database, StorageDatabase.SQLite))); - Console.WriteLine("Opening roslyn. Attach to: " + Process.GetCurrentProcess().Id); var start = DateTime.Now; @@ -96,7 +93,7 @@ private async Task LoadSolutionAsync() // Force a storage instance to be created. This makes it simple to go examine it prior to any operations we // perform, including seeing how big the initial string table is. - var storageService = _workspace.Services.GetPersistentStorageService(_workspace.CurrentSolution.Options); + var storageService = _workspace.Services.GetPersistentStorageService(); if (storageService == null) throw new ArgumentException("Couldn't get storage service"); diff --git a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs index 482653bad347b..c17a797f40ea2 100644 --- a/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs +++ b/src/VisualStudio/CSharp/Impl/Options/AdvancedOptionPageControl.xaml.cs @@ -22,6 +22,7 @@ using Microsoft.CodeAnalysis.Editor.Shared.Options; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; using Microsoft.CodeAnalysis.ExtractMethod; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.ImplementType; using Microsoft.CodeAnalysis.InlineHints; using Microsoft.CodeAnalysis.MetadataAsSource; @@ -33,7 +34,6 @@ using Microsoft.CodeAnalysis.SymbolSearch; using Microsoft.VisualStudio.ComponentModelHost; using Microsoft.VisualStudio.LanguageServices.Implementation.Options; -using Microsoft.VisualStudio.LanguageServices.Telemetry; namespace Microsoft.VisualStudio.LanguageServices.CSharp.Options { @@ -111,11 +111,11 @@ public AdvancedOptionPageControl(OptionStore optionStore, IComponentModel compon BindToOption(RenameTrackingPreview, FeatureOnOffOptions.RenameTrackingPreview, LanguageNames.CSharp); BindToOption(Underline_reassigned_variables, ClassificationOptionsStorage.ClassifyReassignedVariables, LanguageNames.CSharp); - BindToOption(Enable_all_features_in_opened_files_from_source_generators, VisualStudioSyntaxTreeConfigurationService.OptionsMetadata.EnableOpeningSourceGeneratedFilesInWorkspace, () => + BindToOption(Enable_all_features_in_opened_files_from_source_generators, WorkspaceConfigurationOptionsStorage.EnableOpeningSourceGeneratedFilesInWorkspace, () => { // If the option has not been set by the user, check if the option is enabled from experimentation. // If so, default to that. - return optionStore.GetOption(VisualStudioSyntaxTreeConfigurationService.OptionsMetadata.EnableOpeningSourceGeneratedFilesInWorkspaceFeatureFlag); + return optionStore.GetOption(WorkspaceConfigurationOptionsStorage.EnableOpeningSourceGeneratedFilesInWorkspaceFeatureFlag); }); BindToOption(DontPutOutOrRefOnStruct, ExtractMethodOptionsStorage.DontPutOutOrRefOnStruct, LanguageNames.CSharp); diff --git a/src/VisualStudio/Core/Def/Telemetry/VisualStudioSyntaxTreeConfigurationService.cs b/src/VisualStudio/Core/Def/Telemetry/VisualStudioSyntaxTreeConfigurationService.cs deleted file mode 100644 index c82ba6a526fa4..0000000000000 --- a/src/VisualStudio/Core/Def/Telemetry/VisualStudioSyntaxTreeConfigurationService.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Options; - -namespace Microsoft.VisualStudio.LanguageServices.Telemetry -{ - [ExportWorkspaceService(typeof(ISyntaxTreeConfigurationService)), Shared] - internal sealed class VisualStudioSyntaxTreeConfigurationService : ISyntaxTreeConfigurationService - { - private readonly IGlobalOptionService _globalOptions; - - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public VisualStudioSyntaxTreeConfigurationService(IGlobalOptionService globalOptions) - { - _globalOptions = globalOptions; - } - - public bool DisableRecoverableTrees - => _globalOptions.GetOption(OptionsMetadata.DisableRecoverableTrees); - - public bool DisableProjectCacheService - => _globalOptions.GetOption(OptionsMetadata.DisableProjectCacheService); - - public bool EnableOpeningSourceGeneratedFilesInWorkspace - => _globalOptions.GetOption(OptionsMetadata.EnableOpeningSourceGeneratedFilesInWorkspace) - ?? _globalOptions.GetOption(OptionsMetadata.EnableOpeningSourceGeneratedFilesInWorkspaceFeatureFlag); - - internal sealed class OptionsMetadata - { - /// - /// Disables if the workspace creates recoverable trees when from its s. - /// - public static readonly Option2 DisableRecoverableTrees = new( - "WorkspaceConfigurationOptions", "DisableRecoverableTrees", defaultValue: false, - new FeatureFlagStorageLocation("Roslyn.DisableRecoverableTrees")); - - public static readonly Option2 DisableProjectCacheService = new( - "WorkspaceConfigurationOptions", nameof(DisableProjectCacheService), defaultValue: false, - new FeatureFlagStorageLocation("Roslyn.DisableProjectCacheService")); - - /// - /// This option allows the user to enable this. We are putting this behind a feature flag for now since we could have extensions - /// surprised by this and we want some time to work through those issues. - /// - public static readonly Option2 EnableOpeningSourceGeneratedFilesInWorkspace = new( - "WorkspaceConfigurationOptions", nameof(EnableOpeningSourceGeneratedFilesInWorkspace), defaultValue: null, - new RoamingProfileStorageLocation("TextEditor.Roslyn.Specific.EnableOpeningSourceGeneratedFilesInWorkspaceExperiment")); - - public static readonly Option2 EnableOpeningSourceGeneratedFilesInWorkspaceFeatureFlag = new( - "WorkspaceConfigurationOptions", nameof(EnableOpeningSourceGeneratedFilesInWorkspaceFeatureFlag), defaultValue: false, - new FeatureFlagStorageLocation("Roslyn.SourceGeneratorsEnableOpeningInWorkspace")); - } - } -} diff --git a/src/VisualStudio/Core/Def/Workspace/SourceGeneratedFileManager.cs b/src/VisualStudio/Core/Def/Workspace/SourceGeneratedFileManager.cs index d988619756a5e..9411b3dac971e 100644 --- a/src/VisualStudio/Core/Def/Workspace/SourceGeneratedFileManager.cs +++ b/src/VisualStudio/Core/Def/Workspace/SourceGeneratedFileManager.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Editor.Shared.Utilities; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Host.Mef; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Text; @@ -220,7 +221,7 @@ private class OpenSourceGeneratedFile : ForegroundThreadAffinitizedObject, IDisp private readonly ITextBuffer _textBuffer; private readonly Workspace _workspace; private readonly SourceGeneratedDocumentIdentity _documentIdentity; - private readonly ISyntaxTreeConfigurationService? _syntaxTreeConfigurationService; + private readonly IWorkspaceConfigurationService? _workspaceConfigurationService; /// /// A read-only region that we create across the entire file to prevent edits unless we are the one making them. @@ -259,7 +260,7 @@ public OpenSourceGeneratedFile(SourceGeneratedFileManager fileManager, ITextBuff _textBuffer = textBuffer; _workspace = workspace; _documentIdentity = documentIdentity; - _syntaxTreeConfigurationService = _workspace.Services.GetService(); + _workspaceConfigurationService = _workspace.Services.GetService(); // We'll create a read-only region for the file, but it'll be a dynamic region we can temporarily suspend // while we're doing edits. @@ -393,7 +394,7 @@ public async ValueTask RefreshFileAsync(CancellationToken cancellationToken) // If the file isn't already open, open it now. We may transition between opening and closing // if the file is repeatedly appearing and disappearing. - var connectToWorkspace = _syntaxTreeConfigurationService?.EnableOpeningSourceGeneratedFilesInWorkspace != false; + var connectToWorkspace = _workspaceConfigurationService?.Options.EnableOpeningSourceGeneratedFiles != false; if (connectToWorkspace && !_workspace.IsDocumentOpen(_documentIdentity.DocumentId)) { diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpSourceGenerators.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpSourceGenerators.cs index 965d11cede69a..8d149539517d5 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpSourceGenerators.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/CSharp/CSharpSourceGenerators.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Shared.TestHooks; using Microsoft.CodeAnalysis.Test.Utilities; @@ -79,8 +80,15 @@ public static void Main() if (invokeFromSourceGeneratedFile) { + var workspace = await TestServices.Shell.GetComponentModelServiceAsync(HangMitigatingCancellationToken); + + // clear configuration options already read by initialization above, so that the global option update below is effective: + var configurationService = (WorkspaceConfigurationService)workspace.Services.GetRequiredService(); + configurationService.Clear(); + var globalOptions = await TestServices.Shell.GetComponentModelServiceAsync(HangMitigatingCancellationToken); - globalOptions.SetGlobalOption(new OptionKey(VisualStudioSyntaxTreeConfigurationService.OptionsMetadata.EnableOpeningSourceGeneratedFilesInWorkspace, language: null), true); + globalOptions.SetGlobalOption(new OptionKey(WorkspaceConfigurationOptionsStorage.EnableOpeningSourceGeneratedFilesInWorkspace, language: null), true); + await TestServices.Editor.GoToDefinitionAsync(HangMitigatingCancellationToken); Assert.Equal($"{HelloWorldGenerator.GeneratedEnglishClassName}.cs {ServicesVSResources.generated_suffix}", await TestServices.Shell.GetActiveWindowCaptionAsync(HangMitigatingCancellationToken)); } diff --git a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/StateResetInProcess.cs b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/StateResetInProcess.cs index 0a87e584be305..acd4f312b568e 100644 --- a/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/StateResetInProcess.cs +++ b/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/StateResetInProcess.cs @@ -11,11 +11,13 @@ using Microsoft.CodeAnalysis.Editor.Options; using Microsoft.CodeAnalysis.Editor.Shared.Options; using Microsoft.CodeAnalysis.MetadataAsSource; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Options; using Microsoft.VisualStudio; using Microsoft.VisualStudio.Extensibility.Testing; using Microsoft.VisualStudio.IntegrationTest.Utilities; using Microsoft.VisualStudio.IntegrationTest.Utilities.Input; +using Microsoft.VisualStudio.LanguageServices; using Microsoft.VisualStudio.LanguageServices.Implementation; using Microsoft.VisualStudio.LanguageServices.Telemetry; using Microsoft.VisualStudio.Shell.Interop; @@ -36,9 +38,14 @@ internal partial class StateResetInProcess public async Task ResetGlobalOptionsAsync(CancellationToken cancellationToken) { + // clear configuration options, so that the workspace configuration global option update below is effective: + var workspace = await TestServices.Shell.GetComponentModelServiceAsync(cancellationToken); + var configurationService = (WorkspaceConfigurationService)workspace.Services.GetRequiredService(); + configurationService.Clear(); + var globalOptions = await GetComponentModelServiceAsync(cancellationToken); ResetOption2(globalOptions, MetadataAsSourceOptionsStorage.NavigateToDecompiledSources); - ResetOption2(globalOptions, VisualStudioSyntaxTreeConfigurationService.OptionsMetadata.EnableOpeningSourceGeneratedFilesInWorkspace); + ResetOption2(globalOptions, WorkspaceConfigurationOptionsStorage.EnableOpeningSourceGeneratedFilesInWorkspace); ResetPerLanguageOption(globalOptions, NavigationBarViewOptions.ShowNavigationBar); ResetPerLanguageOption2(globalOptions, VisualStudioNavigationOptions.NavigateToObjectBrowser); ResetPerLanguageOption2(globalOptions, FeatureOnOffOptions.AddImportsOnPaste); diff --git a/src/VisualStudio/IntegrationTest/TestUtilities/WellKnownGlobalOptions.cs b/src/VisualStudio/IntegrationTest/TestUtilities/WellKnownGlobalOptions.cs index 5c34dd0e33e1e..5ab2c22fb8d86 100644 --- a/src/VisualStudio/IntegrationTest/TestUtilities/WellKnownGlobalOptions.cs +++ b/src/VisualStudio/IntegrationTest/TestUtilities/WellKnownGlobalOptions.cs @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.Completion; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.InlineRename; using Microsoft.CodeAnalysis.MetadataAsSource; using Microsoft.CodeAnalysis.Options; @@ -30,6 +31,7 @@ public enum WellKnownGlobalOption InlineRenameSessionOptions_PreviewChanges, MetadataAsSourceOptions_NavigateToDecompiledSources, VisualStudioSyntaxTreeConfigurationService_EnableOpeningSourceGeneratedFilesInWorkspace, + WorkspaceConfigurationOptions_EnableOpeningSourceGeneratedFilesInWorkspace, SolutionCrawlerOptions_BackgroundAnalysisScopeOption, } @@ -47,7 +49,7 @@ public static IOption GetOption(this WellKnownGlobalOption option) WellKnownGlobalOption.InlineRenameSessionOptions_RenameFile => InlineRenameSessionOptionsStorage.RenameFile, WellKnownGlobalOption.InlineRenameSessionOptions_PreviewChanges => InlineRenameSessionOptionsStorage.PreviewChanges, WellKnownGlobalOption.MetadataAsSourceOptions_NavigateToDecompiledSources => MetadataAsSourceOptionsStorage.NavigateToDecompiledSources, - WellKnownGlobalOption.VisualStudioSyntaxTreeConfigurationService_EnableOpeningSourceGeneratedFilesInWorkspace => VisualStudioSyntaxTreeConfigurationService.OptionsMetadata.EnableOpeningSourceGeneratedFilesInWorkspace, + WellKnownGlobalOption.WorkspaceConfigurationOptions_EnableOpeningSourceGeneratedFilesInWorkspace => WorkspaceConfigurationOptionsStorage.EnableOpeningSourceGeneratedFilesInWorkspace, WellKnownGlobalOption.SolutionCrawlerOptions_BackgroundAnalysisScopeOption => SolutionCrawlerOptionsStorage.BackgroundAnalysisScopeOption, _ => throw ExceptionUtilities.Unreachable }; diff --git a/src/VisualStudio/LiveShare/Test/AbstractLiveShareRequestHandlerTests.cs b/src/VisualStudio/LiveShare/Test/AbstractLiveShareRequestHandlerTests.cs index 11651f5bda14d..0556cf914f7e1 100644 --- a/src/VisualStudio/LiveShare/Test/AbstractLiveShareRequestHandlerTests.cs +++ b/src/VisualStudio/LiveShare/Test/AbstractLiveShareRequestHandlerTests.cs @@ -23,7 +23,7 @@ public abstract class AbstractLiveShareRequestHandlerTests : AbstractLanguageSer private static readonly TestComposition s_composition = LiveShareTestCompositions.Features .AddParts(typeof(MockDocumentNavigationServiceFactory)) .AddParts(typeof(TestWorkspaceRegistrationService)) - .AddParts(typeof(TestSyntaxTreeConfigurationService)); + .AddParts(typeof(TestWorkspaceConfigurationService)); private class MockHostProtocolConverter : IHostProtocolConverter { diff --git a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb index 1cd49dedf54d3..e331c5824aca9 100644 --- a/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb +++ b/src/VisualStudio/VisualBasic/Impl/Options/AdvancedOptionPageControl.xaml.vb @@ -18,6 +18,7 @@ Imports Microsoft.CodeAnalysis.Editor.InlineHints Imports Microsoft.CodeAnalysis.Editor.Shared.Options Imports Microsoft.CodeAnalysis.Editor.[Shared].Utilities Imports Microsoft.CodeAnalysis.ExtractMethod +Imports Microsoft.CodeAnalysis.Host Imports Microsoft.CodeAnalysis.ImplementType Imports Microsoft.CodeAnalysis.InlineHints Imports Microsoft.CodeAnalysis.QuickInfo @@ -28,7 +29,6 @@ Imports Microsoft.CodeAnalysis.SymbolSearch Imports Microsoft.VisualStudio.ComponentModelHost Imports Microsoft.VisualStudio.LanguageServices.Implementation Imports Microsoft.VisualStudio.LanguageServices.Implementation.Options -Imports Microsoft.VisualStudio.LanguageServices.Telemetry Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options Friend Class AdvancedOptionPageControl @@ -113,10 +113,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic.Options ' Go To Definition BindToOption(NavigateToObjectBrowser, VisualStudioNavigationOptions.NavigateToObjectBrowser, LanguageNames.VisualBasic) - BindToOption(Enable_all_features_in_opened_files_from_source_generators, VisualStudioSyntaxTreeConfigurationService.OptionsMetadata.EnableOpeningSourceGeneratedFilesInWorkspace, + BindToOption(Enable_all_features_in_opened_files_from_source_generators, WorkspaceConfigurationOptionsStorage.EnableOpeningSourceGeneratedFilesInWorkspace, Function() ' If the option has Not been set by the user, check if the option is enabled from experimentation. - Return optionStore.GetOption(VisualStudioSyntaxTreeConfigurationService.OptionsMetadata.EnableOpeningSourceGeneratedFilesInWorkspaceFeatureFlag) + Return optionStore.GetOption(WorkspaceConfigurationOptionsStorage.EnableOpeningSourceGeneratedFilesInWorkspaceFeatureFlag) End Function) ' Regular expressions diff --git a/src/Workspaces/Core/Portable/Classification/AbstractClassificationService.cs b/src/Workspaces/Core/Portable/Classification/AbstractClassificationService.cs index cdb5950658420..4e74e598e9bce 100644 --- a/src/Workspaces/Core/Portable/Classification/AbstractClassificationService.cs +++ b/src/Workspaces/Core/Portable/Classification/AbstractClassificationService.cs @@ -64,8 +64,6 @@ private static async Task AddClassificationsAsync( return; } - var database = document.Project.Solution.Options.GetPersistentStorageDatabase(); - var client = await RemoteHostClient.TryGetClientAsync(document.Project, cancellationToken).ConfigureAwait(false); if (client != null) { @@ -74,7 +72,7 @@ private static async Task AddClassificationsAsync( // service.GetSemanticClassificationsAsync below) as we want to try to read in the cached // classifications without doing any syncing to the OOP process. var isFullyLoaded = IsFullyLoaded(document, cancellationToken); - if (await TryGetCachedClassificationsAsync(document, textSpan, type, client, database, isFullyLoaded, result, cancellationToken).ConfigureAwait(false)) + if (await TryGetCachedClassificationsAsync(document, textSpan, type, client, isFullyLoaded, result, cancellationToken).ConfigureAwait(false)) return; // Call the project overload. Semantic classification only needs the current project's information @@ -82,7 +80,7 @@ private static async Task AddClassificationsAsync( var classifiedSpans = await client.TryInvokeAsync( document.Project, (service, solutionInfo, cancellationToken) => service.GetClassificationsAsync( - solutionInfo, document.Id, textSpan, type, options, database, isFullyLoaded, cancellationToken), + solutionInfo, document.Id, textSpan, type, options, isFullyLoaded, cancellationToken), cancellationToken).ConfigureAwait(false); // if the remote call fails do nothing (error has already been reported) @@ -115,7 +113,6 @@ private static async Task TryGetCachedClassificationsAsync( TextSpan textSpan, ClassificationType type, RemoteHostClient client, - StorageDatabase database, bool isFullyLoaded, ArrayBuilder result, CancellationToken cancellationToken) @@ -130,7 +127,7 @@ private static async Task TryGetCachedClassificationsAsync( var cachedSpans = await client.TryInvokeAsync( document.Project, (service, solutionInfo, cancellationToken) => service.GetCachedClassificationsAsync( - documentKey, textSpan, type, checksum, database, cancellationToken), + documentKey, textSpan, type, checksum, cancellationToken), cancellationToken).ConfigureAwait(false); // if the remote call fails do nothing (error has already been reported) diff --git a/src/Workspaces/Core/Portable/Classification/IRemoteSemanticClassificationService.cs b/src/Workspaces/Core/Portable/Classification/IRemoteSemanticClassificationService.cs index d5244ca9438f5..98022d90c437d 100644 --- a/src/Workspaces/Core/Portable/Classification/IRemoteSemanticClassificationService.cs +++ b/src/Workspaces/Core/Portable/Classification/IRemoteSemanticClassificationService.cs @@ -24,7 +24,6 @@ ValueTask GetClassificationsAsync( TextSpan span, ClassificationType type, ClassificationOptions options, - StorageDatabase database, bool isFullyLoaded, CancellationToken cancellationToken); @@ -39,7 +38,6 @@ ValueTask GetClassificationsAsync( TextSpan textSpan, ClassificationType type, Checksum checksum, - StorageDatabase database, CancellationToken cancellationToken); } diff --git a/src/Workspaces/Core/Portable/FindSymbols/Shared/AbstractSyntaxIndex_Persistence.cs b/src/Workspaces/Core/Portable/FindSymbols/Shared/AbstractSyntaxIndex_Persistence.cs index 82ae0f4b3f0c7..4ab1a380d0ba1 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/Shared/AbstractSyntaxIndex_Persistence.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/Shared/AbstractSyntaxIndex_Persistence.cs @@ -28,10 +28,7 @@ internal partial class AbstractSyntaxIndex : IObjectWritable IndexReader read, CancellationToken cancellationToken) { - var solution = document.Project.Solution; - var database = solution.Options.GetPersistentStorageDatabase(); - - var storageService = solution.Workspace.Services.GetPersistentStorageService(database); + var storageService = document.Project.Solution.Workspace.Services.GetPersistentStorageService(); return LoadAsync(storageService, DocumentKey.ToDocumentKey(document), checksum, SyntaxTreeIndex.GetStringTable(document.Project), read, cancellationToken); } @@ -85,7 +82,7 @@ private async Task SaveAsync( Document document, CancellationToken cancellationToken) { var solution = document.Project.Solution; - var persistentStorageService = solution.Workspace.Services.GetPersistentStorageService(solution.Options); + var persistentStorageService = solution.Workspace.Services.GetPersistentStorageService(); try { @@ -139,7 +136,7 @@ private static async Task PrecalculatedAsync( Document document, Checksum checksum, CancellationToken cancellationToken) { var solution = document.Project.Solution; - var persistentStorageService = solution.Workspace.Services.GetPersistentStorageService(solution.Options); + var persistentStorageService = solution.Workspace.Services.GetPersistentStorageService(); // check whether we already have info for this document try diff --git a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.cs b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.cs index 6dfbe67acb0e8..e14c4313f6212 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo.cs @@ -330,13 +330,13 @@ private static int BinarySearch(ImmutableArray nodes, string name) private static readonly ConditionalWeakTable> s_metadataIdToInfo = new(); private static Task GetSpellCheckerAsync( - HostWorkspaceServices services, SolutionKey solutionKey, Checksum checksum, StorageDatabase database, string filePath, ImmutableArray sortedNodes) + HostWorkspaceServices services, SolutionKey solutionKey, Checksum checksum, string filePath, ImmutableArray sortedNodes) { // Create a new task to attempt to load or create the spell checker for this // SymbolTreeInfo. This way the SymbolTreeInfo will be ready immediately // for non-fuzzy searches, and soon afterwards it will be able to perform // fuzzy searches as well. - return Task.Run(() => LoadOrCreateSpellCheckerAsync(services, solutionKey, checksum, database, filePath, sortedNodes)); + return Task.Run(() => LoadOrCreateSpellCheckerAsync(services, solutionKey, checksum, filePath, sortedNodes)); } private static Task CreateSpellCheckerAsync( @@ -493,14 +493,14 @@ internal void AssertEquivalentTo(SymbolTreeInfo other) } private static SymbolTreeInfo CreateSymbolTreeInfo( - HostWorkspaceServices services, SolutionKey solutionKey, Checksum checksum, StorageDatabase database, + HostWorkspaceServices services, SolutionKey solutionKey, Checksum checksum, string filePath, ImmutableArray unsortedNodes, OrderPreservingMultiDictionary inheritanceMap, MultiDictionary simpleMethods) { SortNodes(unsortedNodes, out var sortedNodes); var createSpellCheckerTask = GetSpellCheckerAsync( - services, solutionKey, checksum, database, filePath, sortedNodes); + services, solutionKey, checksum, filePath, sortedNodes); return new SymbolTreeInfo( checksum, sortedNodes, createSpellCheckerTask, inheritanceMap, simpleMethods); diff --git a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs index 3717b6ad14814..57dda3cecafc3 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Metadata.cs @@ -110,10 +110,8 @@ public static async ValueTask GetInfoForMetadataReferenceAsync( if (loadOnly) return null; - var database = solution.Options.GetPersistentStorageDatabase(); - return await GetInfoForMetadataReferenceSlowAsync( - solution.Workspace.Services, SolutionKey.ToSolutionKey(solution), reference, checksum, database, metadata, cancellationToken).ConfigureAwait(false); + solution.Workspace.Services, SolutionKey.ToSolutionKey(solution), reference, checksum, metadata, cancellationToken).ConfigureAwait(false); } public static Task TryGetCachedInfoForMetadataReferenceIgnoreChecksumAsync(PortableExecutableReference reference, CancellationToken cancellationToken) @@ -130,7 +128,6 @@ private static async Task GetInfoForMetadataReferenceSlowAsync( SolutionKey solutionKey, PortableExecutableReference reference, Checksum checksum, - StorageDatabase database, Metadata metadata, CancellationToken cancellationToken) { @@ -142,7 +139,7 @@ private static async Task GetInfoForMetadataReferenceSlowAsync( var asyncLazy = s_metadataIdToInfo.GetValue( metadata.Id, id => new AsyncLazy( - c => TryCreateMetadataSymbolTreeInfoAsync(services, solutionKey, reference, checksum, database, c), + c => TryCreateMetadataSymbolTreeInfoAsync(services, solutionKey, reference, checksum, c), cacheResult: true)); return await asyncLazy.GetValueAsync(cancellationToken).ConfigureAwait(false); @@ -183,7 +180,6 @@ private static Task TryCreateMetadataSymbolTreeInfoAsync( SolutionKey solutionKey, PortableExecutableReference reference, Checksum checksum, - StorageDatabase database, CancellationToken cancellationToken) { var filePath = reference.FilePath; @@ -192,20 +188,19 @@ private static Task TryCreateMetadataSymbolTreeInfoAsync( services, solutionKey, checksum, - database, loadOnly: false, - createAsync: () => CreateMetadataSymbolTreeInfoAsync(services, solutionKey, checksum, database, reference), + createAsync: () => CreateMetadataSymbolTreeInfoAsync(services, solutionKey, checksum, reference), keySuffix: "_Metadata_" + filePath, - tryReadObject: reader => TryReadSymbolTreeInfo(reader, checksum, nodes => GetSpellCheckerAsync(services, solutionKey, checksum, database, filePath, nodes)), + tryReadObject: reader => TryReadSymbolTreeInfo(reader, checksum, nodes => GetSpellCheckerAsync(services, solutionKey, checksum, filePath, nodes)), cancellationToken: cancellationToken); Contract.ThrowIfNull(result); return result; } private static Task CreateMetadataSymbolTreeInfoAsync( - HostWorkspaceServices services, SolutionKey solutionKey, Checksum checksum, StorageDatabase database, PortableExecutableReference reference) + HostWorkspaceServices services, SolutionKey solutionKey, Checksum checksum, PortableExecutableReference reference) { - var creator = new MetadataInfoCreator(services, solutionKey, checksum, database, reference); + var creator = new MetadataInfoCreator(services, solutionKey, checksum, reference); return Task.FromResult(creator.Create()); } @@ -217,7 +212,6 @@ private struct MetadataInfoCreator : IDisposable private readonly HostWorkspaceServices _services; private readonly SolutionKey _solutionKey; private readonly Checksum _checksum; - private readonly StorageDatabase _database; private readonly PortableExecutableReference _reference; private readonly OrderPreservingMultiDictionary _inheritanceMap; @@ -241,12 +235,11 @@ private struct MetadataInfoCreator : IDisposable private bool _containsExtensionsMethod; public MetadataInfoCreator( - HostWorkspaceServices services, SolutionKey solutionKey, Checksum checksum, StorageDatabase database, PortableExecutableReference reference) + HostWorkspaceServices services, SolutionKey solutionKey, Checksum checksum, PortableExecutableReference reference) { _services = services; _solutionKey = solutionKey; _checksum = checksum; - _database = database; _reference = reference; _metadataReader = null; _allTypeDefinitions = new List(); @@ -313,7 +306,7 @@ internal SymbolTreeInfo Create() var unsortedNodes = GenerateUnsortedNodes(extensionMethodsMap); return CreateSymbolTreeInfo( - _services, _solutionKey, _checksum, _database, _reference.FilePath, unsortedNodes, _inheritanceMap, extensionMethodsMap); + _services, _solutionKey, _checksum, _reference.FilePath, unsortedNodes, _inheritanceMap, extensionMethodsMap); } public void Dispose() diff --git a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Serialization.cs b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Serialization.cs index a9c1e0c171908..e440772006497 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Serialization.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Serialization.cs @@ -33,7 +33,6 @@ private static Task LoadOrCreateSpellCheckerAsync( HostWorkspaceServices services, SolutionKey solutionKey, Checksum checksum, - StorageDatabase database, string filePath, ImmutableArray sortedNodes) { @@ -41,7 +40,6 @@ private static Task LoadOrCreateSpellCheckerAsync( services, solutionKey, checksum, - database, loadOnly: false, createAsync: () => CreateSpellCheckerAsync(checksum, sortedNodes), keySuffix: "_SpellChecker_" + filePath, @@ -59,7 +57,6 @@ private static async Task TryLoadOrCreateAsync( HostWorkspaceServices services, SolutionKey solutionKey, Checksum checksum, - StorageDatabase database, bool loadOnly, Func> createAsync, string keySuffix, @@ -74,7 +71,7 @@ private static async Task TryLoadOrCreateAsync( } // Ok, we can use persistence. First try to load from the persistence service. - var persistentStorageService = services.GetPersistentStorageService(database); + var persistentStorageService = services.GetPersistentStorageService(); var storage = await persistentStorageService.GetStorageAsync(solutionKey, cancellationToken).ConfigureAwait(false); await using var _ = storage.ConfigureAwait(false); diff --git a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Source.cs b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Source.cs index d33b5c5cd072c..acf388e910315 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Source.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/SymbolTree/SymbolTreeInfo_Source.cs @@ -38,17 +38,15 @@ public static Task GetInfoForSourceAssemblyAsync( var services = solution.Workspace.Services; var solutionKey = SolutionKey.ToSolutionKey(solution); var projectFilePath = project.FilePath; - var database = solution.Options.GetPersistentStorageDatabase(); var result = TryLoadOrCreateAsync( services, solutionKey, checksum, - database, loadOnly, createAsync: () => CreateSourceSymbolTreeInfoAsync(project, checksum, cancellationToken), keySuffix: "_Source_" + project.FilePath, - tryReadObject: reader => TryReadSymbolTreeInfo(reader, checksum, nodes => GetSpellCheckerAsync(services, solutionKey, checksum, database, projectFilePath, nodes)), + tryReadObject: reader => TryReadSymbolTreeInfo(reader, checksum, nodes => GetSpellCheckerAsync(services, solutionKey, checksum, projectFilePath, nodes)), cancellationToken: cancellationToken); Contract.ThrowIfNull(result, "Result should never be null as we passed 'loadOnly: false'."); return result; @@ -124,10 +122,9 @@ internal static async Task CreateSourceSymbolTreeInfoAsync( var solution = project.Solution; var services = solution.Workspace.Services; var solutionKey = SolutionKey.ToSolutionKey(solution); - var database = solution.Options.GetPersistentStorageDatabase(); return CreateSymbolTreeInfo( - services, solutionKey, checksum, database, project.FilePath, unsortedNodes.ToImmutableAndFree(), + services, solutionKey, checksum, project.FilePath, unsortedNodes.ToImmutableAndFree(), inheritanceMap: new OrderPreservingMultiDictionary(), simpleMethods: null); } diff --git a/src/Workspaces/Core/Portable/Storage/PersistentStorageExtensions.cs b/src/Workspaces/Core/Portable/Storage/PersistentStorageExtensions.cs index c2e2b1b9ba564..7c974a1e47ff3 100644 --- a/src/Workspaces/Core/Portable/Storage/PersistentStorageExtensions.cs +++ b/src/Workspaces/Core/Portable/Storage/PersistentStorageExtensions.cs @@ -3,7 +3,6 @@ // See the LICENSE file in the project root for more information. using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Options; using Microsoft.CodeAnalysis.Storage.CloudCache; #if !DOTNET_BUILD_FROM_SOURCE @@ -14,17 +13,12 @@ namespace Microsoft.CodeAnalysis.Storage { internal static class PersistentStorageExtensions { - public static IChecksummedPersistentStorageService GetPersistentStorageService(this HostWorkspaceServices services, OptionSet options) - => GetPersistentStorageService(services, GetPersistentStorageDatabase(options)); - - public static StorageDatabase GetPersistentStorageDatabase(this OptionSet options) - => options.GetOption(StorageOptions.CloudCacheFeatureFlag) ? StorageDatabase.CloudCache : options.GetOption(StorageOptions.Database); - - public static IChecksummedPersistentStorageService GetPersistentStorageService(this HostWorkspaceServices services, StorageDatabase database) + public static IChecksummedPersistentStorageService GetPersistentStorageService(this HostWorkspaceServices services) { + var workspaceConfiguration = services.GetService(); var configuration = services.GetRequiredService(); - return database switch + return workspaceConfiguration?.Options.CacheStorage switch { #if !DOTNET_BUILD_FROM_SOURCE StorageDatabase.SQLite diff --git a/src/Workspaces/Core/Portable/Storage/StorageOptions.cs b/src/Workspaces/Core/Portable/Storage/StorageOptions.cs deleted file mode 100644 index f4872ef64652a..0000000000000 --- a/src/Workspaces/Core/Portable/Storage/StorageOptions.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Collections.Immutable; -using System.Composition; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Options.Providers; - -namespace Microsoft.CodeAnalysis.Storage -{ - [ExportSolutionOptionProvider, Shared] - internal sealed class StorageOptions : IOptionProvider - { - internal const string LocalRegistryPath = @"Roslyn\Internal\OnOff\Features\"; - - private const string FeatureName = "FeatureManager/Storage"; - - public static readonly Option2 Database = new( - FeatureName, nameof(Database), defaultValue: StorageDatabase.SQLite, - new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(Database))); - - public static readonly Option2 CloudCacheFeatureFlag = new( - FeatureName, nameof(CloudCacheFeatureFlag), defaultValue: false, - new FeatureFlagStorageLocation("Roslyn.CloudCache3")); - - ImmutableArray IOptionProvider.Options { get; } = ImmutableArray.Create( - Database, - CloudCacheFeatureFlag); - - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public StorageOptions() - { - } - } -} diff --git a/src/Workspaces/Core/Portable/Telemetry/IRemoteProcessTelemetryService.cs b/src/Workspaces/Core/Portable/Telemetry/IRemoteProcessTelemetryService.cs index a2fcda6b83f05..6164f66094c3f 100644 --- a/src/Workspaces/Core/Portable/Telemetry/IRemoteProcessTelemetryService.cs +++ b/src/Workspaces/Core/Portable/Telemetry/IRemoteProcessTelemetryService.cs @@ -5,6 +5,7 @@ using System.Threading; using System.Threading.Tasks; using System.Collections.Immutable; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; namespace Microsoft.CodeAnalysis.Remote @@ -22,9 +23,9 @@ internal interface IRemoteProcessTelemetryService ValueTask InitializeTelemetrySessionAsync(int hostProcessId, string serializedSession, CancellationToken cancellationToken); /// - /// Configures recoverable syntax tree creation in the process. - /// Called as soon as the remote process is created but can't guarantee that syntax trees have not been created beforehand. + /// Sets for the process. + /// Called as soon as the remote process is created but can't guarantee that solution entities (projects, documents, syntax trees) have not been created beforehand. /// - ValueTask SetSyntaxTreeConfigurationOptionsAsync(bool disableRecoverableTrees, bool disableProjectCacheService, bool enableOpeningSourceGeneratedFilesInWorkspace, CancellationToken cancellationToken); + ValueTask InitializeWorkspaceConfigurationOptionsAsync(WorkspaceConfigurationOptions options, CancellationToken cancellationToken); } } diff --git a/src/Workspaces/Core/Portable/Workspace/ISyntaxTreeConfigurationService.cs b/src/Workspaces/Core/Portable/Workspace/ISyntaxTreeConfigurationService.cs deleted file mode 100644 index 93ceaed084c7f..0000000000000 --- a/src/Workspaces/Core/Portable/Workspace/ISyntaxTreeConfigurationService.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis -{ - internal interface ISyntaxTreeConfigurationService : IWorkspaceService - { - bool DisableRecoverableTrees { get; } - bool DisableProjectCacheService { get; } - bool EnableOpeningSourceGeneratedFilesInWorkspace { get; } - } -} diff --git a/src/Workspaces/Core/Portable/Workspace/IWorkspaceConfigurationService.cs b/src/Workspaces/Core/Portable/Workspace/IWorkspaceConfigurationService.cs new file mode 100644 index 0000000000000..67aa1894e130c --- /dev/null +++ b/src/Workspaces/Core/Portable/Workspace/IWorkspaceConfigurationService.cs @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System.Runtime.Serialization; +using Microsoft.CodeAnalysis.Storage; + +namespace Microsoft.CodeAnalysis.Host +{ + internal interface IWorkspaceConfigurationService : IWorkspaceService + { + WorkspaceConfigurationOptions Options { get; } + } + + /// + /// Options that affect behavior of workspace core APIs (, , , , etc.) + /// to which it would be impractical to flow these options explicitly. The options are instead provided by . + /// The remote instance of this service is initialized based on the in-proc values (which themselves are loaded from global options) when we establish connection + /// from devenv to ServiceHub process. If another process connects to our ServiceHub process before that the remote instance provides a predefined set of options + /// that can later be updated when devenv connects to the ServiceHub process. + /// + [DataContract] + internal readonly record struct WorkspaceConfigurationOptions( + [property: DataMember(Order = 0)] StorageDatabase CacheStorage = StorageDatabase.SQLite, + [property: DataMember(Order = 1)] bool DisableRecoverableTrees = false, + [property: DataMember(Order = 2)] bool DisableProjectCacheService = false, + [property: DataMember(Order = 3)] bool EnableOpeningSourceGeneratedFiles = false) + { + public WorkspaceConfigurationOptions() + : this(CacheStorage: StorageDatabase.SQLite) + { + } + + public static readonly WorkspaceConfigurationOptions Default = new(); + + /// + /// These values are such that the correctness of remote services is not affected if these options are changed from defaults + /// to non-defauls while the services have already been executing. + /// + public static readonly WorkspaceConfigurationOptions RemoteDefault = new( + CacheStorage: StorageDatabase.None, + DisableRecoverableTrees: false, + DisableProjectCacheService: false, + EnableOpeningSourceGeneratedFiles: false); + } +} diff --git a/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs b/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs index 13df1ec2cd300..0695f26a73615 100644 --- a/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs +++ b/src/Workspaces/Remote/Core/ServiceHubRemoteHostClient.cs @@ -76,11 +76,11 @@ public static async Task CreateAsync( var client = new ServiceHubRemoteHostClient(services, configuration, serviceBrokerClient, hubClient, callbackDispatchers); - var syntaxTreeConfigurationService = services.GetService(); - if (syntaxTreeConfigurationService != null) + var workspaceConfigurationService = services.GetService(); + if (workspaceConfigurationService != null) { await client.TryInvokeAsync( - (service, cancellationToken) => service.SetSyntaxTreeConfigurationOptionsAsync(syntaxTreeConfigurationService.DisableRecoverableTrees, syntaxTreeConfigurationService.DisableProjectCacheService, syntaxTreeConfigurationService.EnableOpeningSourceGeneratedFilesInWorkspace, cancellationToken), + (service, cancellationToken) => service.InitializeWorkspaceConfigurationOptionsAsync(workspaceConfigurationService.Options, cancellationToken), cancellationToken).ConfigureAwait(false); } diff --git a/src/Workspaces/Remote/ServiceHub/Services/NavigateToSearch/RemoteNavigateToSearchService.cs b/src/Workspaces/Remote/ServiceHub/Services/NavigateToSearch/RemoteNavigateToSearchService.cs index 03dca149a8f8f..569a88aa8028d 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/NavigateToSearch/RemoteNavigateToSearchService.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/NavigateToSearch/RemoteNavigateToSearchService.cs @@ -109,7 +109,7 @@ await AbstractNavigateToSearchService.SearchGeneratedDocumentsInCurrentProcessAs }, cancellationToken); } - public ValueTask SearchCachedDocumentsAsync(ImmutableArray documentKeys, ImmutableArray priorityDocumentKeys, StorageDatabase database, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken) + public ValueTask SearchCachedDocumentsAsync(ImmutableArray documentKeys, ImmutableArray priorityDocumentKeys, string searchPattern, ImmutableArray kinds, RemoteServiceCallbackId callbackId, CancellationToken cancellationToken) { return RunServiceAsync(async cancellationToken => { @@ -117,7 +117,7 @@ public ValueTask SearchCachedDocumentsAsync(ImmutableArray document // synchronizing the solution over to the remote side. Instead, we just directly // check whatever cached data we have from the previous vs session. var callback = GetCallback(callbackId, cancellationToken); - var storageService = GetWorkspaceServices().GetPersistentStorageService(database); + var storageService = GetWorkspaceServices().GetPersistentStorageService(); await AbstractNavigateToSearchService.SearchCachedDocumentsInCurrentProcessAsync( storageService, documentKeys, priorityDocumentKeys, searchPattern, kinds.ToImmutableHashSet(), callback, cancellationToken).ConfigureAwait(false); }, cancellationToken); diff --git a/src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteProcessTelemetryService.cs b/src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteProcessTelemetryService.cs index b098c0fd95bd8..a7d75647fa344 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteProcessTelemetryService.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteProcessTelemetryService.cs @@ -9,9 +9,11 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.ErrorReporting; +using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Internal.Log; using Microsoft.CodeAnalysis.Notification; using Microsoft.CodeAnalysis.Remote.Diagnostics; +using Microsoft.CodeAnalysis.Storage; using Microsoft.CodeAnalysis.Telemetry; using Microsoft.VisualStudio.LanguageServices.Telemetry; using Microsoft.VisualStudio.Telemetry; @@ -113,12 +115,12 @@ private static void SetRoslynLogger(ImmutableArray loggerTypes, Func< /// /// Remote API. /// - public ValueTask SetSyntaxTreeConfigurationOptionsAsync(bool disableRecoverableTrees, bool disableProjectCacheService, bool enableOpeningSourceGeneratedFilesInWorkspace, CancellationToken cancellationToken) + public ValueTask InitializeWorkspaceConfigurationOptionsAsync(WorkspaceConfigurationOptions options, CancellationToken cancellationToken) { return RunServiceAsync(cancellationToken => { - var service = (RemoteSyntaxTreeConfigurationService)GetWorkspaceServices().GetRequiredService(); - service.SetOptions(disableRecoverableTrees, disableProjectCacheService, enableOpeningSourceGeneratedFilesInWorkspace); + var service = (RemoteWorkspaceConfigurationService)GetWorkspaceServices().GetRequiredService(); + service.InitializeOptions(options); return ValueTaskFactory.CompletedTask; }, cancellationToken); diff --git a/src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteSyntaxTreeConfigurationService.cs b/src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteSyntaxTreeConfigurationService.cs deleted file mode 100644 index 0a96170a582cf..0000000000000 --- a/src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteSyntaxTreeConfigurationService.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.VisualStudio.LanguageServices.Telemetry -{ - [ExportWorkspaceService(typeof(ISyntaxTreeConfigurationService)), Shared] - internal sealed class RemoteSyntaxTreeConfigurationService : ISyntaxTreeConfigurationService - { - public bool DisableRecoverableTrees { get; private set; } - public bool DisableProjectCacheService { get; private set; } - public bool EnableOpeningSourceGeneratedFilesInWorkspace { get; private set; } - - [ImportingConstructor] - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] - public RemoteSyntaxTreeConfigurationService() - { - } - - internal void SetOptions(bool disableRecoverableTrees, bool disableProjectCacheService, bool enableOpeningSourceGeneratedFilesInWorkspace) - { - DisableRecoverableTrees = disableRecoverableTrees; - DisableProjectCacheService = disableProjectCacheService; - EnableOpeningSourceGeneratedFilesInWorkspace = enableOpeningSourceGeneratedFilesInWorkspace; - } - } -} diff --git a/src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteWorkspaceConfigurationService.cs b/src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteWorkspaceConfigurationService.cs new file mode 100644 index 0000000000000..61824f13f6e54 --- /dev/null +++ b/src/Workspaces/Remote/ServiceHub/Services/ProcessTelemetry/RemoteWorkspaceConfigurationService.cs @@ -0,0 +1,39 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +using System; +using System.Composition; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Host.Mef; +using Microsoft.CodeAnalysis.Storage; +using Roslyn.Utilities; + +namespace Microsoft.CodeAnalysis.Host +{ + [ExportWorkspaceService(typeof(IWorkspaceConfigurationService)), Shared] + internal sealed class RemoteWorkspaceConfigurationService : IWorkspaceConfigurationService + { + private WorkspaceConfigurationOptions? _options; + + [ImportingConstructor] + [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] + public RemoteWorkspaceConfigurationService() + { + } + + /// + /// Returns default values until the options are initialized. + /// + public WorkspaceConfigurationOptions Options + => _options ?? WorkspaceConfigurationOptions.RemoteDefault; + + public void InitializeOptions(WorkspaceConfigurationOptions options) + { + // can only be set once: + Contract.ThrowIfFalse(_options == null); + + _options = options; + } + } +} diff --git a/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.Caching.cs b/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.Caching.cs index 984f82c7c6aa5..00aec8ec45e1f 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.Caching.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.Caching.cs @@ -51,16 +51,16 @@ internal sealed partial class RemoteSemanticClassificationService : BrokeredServ /// same document may appear multiple times inside of this queue (for different versions of the document). /// However, we'll only process the last version of any document added. /// - private readonly AsyncBatchingWorkQueue<(Document, ClassificationType type, ClassificationOptions, StorageDatabase)> _workQueue; + private readonly AsyncBatchingWorkQueue<(Document, ClassificationType type, ClassificationOptions)> _workQueue; private readonly CancellationTokenSource _cancellationTokenSource = new(); public RemoteSemanticClassificationService(in ServiceConstructionArguments arguments) : base(arguments) { - _workQueue = new AsyncBatchingWorkQueue<(Document, ClassificationType, ClassificationOptions, StorageDatabase)>( + _workQueue = new AsyncBatchingWorkQueue<(Document, ClassificationType, ClassificationOptions)>( DelayTimeSpan.Short, CacheClassificationsAsync, - EqualityComparer<(Document, ClassificationType, ClassificationOptions, StorageDatabase)>.Default, + EqualityComparer<(Document, ClassificationType, ClassificationOptions)>.Default, AsynchronousOperationListenerProvider.NullListener, _cancellationTokenSource.Token); } @@ -80,17 +80,17 @@ private static string GetPersistenceName(ClassificationType type) }; public async ValueTask GetCachedClassificationsAsync( - DocumentKey documentKey, TextSpan textSpan, ClassificationType type, Checksum checksum, StorageDatabase database, CancellationToken cancellationToken) + DocumentKey documentKey, TextSpan textSpan, ClassificationType type, Checksum checksum, CancellationToken cancellationToken) { var classifiedSpans = await TryGetOrReadCachedSemanticClassificationsAsync( - documentKey, type, checksum, database, cancellationToken).ConfigureAwait(false); + documentKey, type, checksum, cancellationToken).ConfigureAwait(false); return classifiedSpans.IsDefault ? null : SerializableClassifiedSpans.Dehydrate(classifiedSpans.WhereAsArray(c => c.TextSpan.IntersectsWith(textSpan))); } private static async ValueTask CacheClassificationsAsync( - ImmutableArray<(Document document, ClassificationType type, ClassificationOptions options, StorageDatabase database)> documents, + ImmutableArray<(Document document, ClassificationType type, ClassificationOptions options)> documents, CancellationToken cancellationToken) { // Group all the requests by document (as we may have gotten many requests for the same document). Then, @@ -99,18 +99,22 @@ private static async ValueTask CacheClassificationsAsync( var groups = documents.GroupBy(d => d.document.Id); var tasks = groups.Select(g => Task.Run(() => { - var (document, type, options, database) = g.Last(); - return CacheClassificationsAsync(document, type, options, database, cancellationToken); + var (document, type, options) = g.Last(); + return CacheClassificationsAsync(document, type, options, cancellationToken); }, cancellationToken)); await Task.WhenAll(tasks).ConfigureAwait(false); } private static async Task CacheClassificationsAsync( - Document document, ClassificationType type, ClassificationOptions options, StorageDatabase database, CancellationToken cancellationToken) + Document document, ClassificationType type, ClassificationOptions options, CancellationToken cancellationToken) { var solution = document.Project.Solution; - var persistenceService = solution.Workspace.Services.GetPersistentStorageService(database); + var persistenceService = solution.Workspace.Services.GetPersistentStorageService(); + + // we should never use no-op storage in OOP + Contract.ThrowIfTrue(persistenceService is NoOpPersistentStorageService); + var storage = await persistenceService.GetStorageAsync(SolutionKey.ToSolutionKey(solution), cancellationToken).ConfigureAwait(false); await using var _1 = storage.ConfigureAwait(false); if (storage == null) @@ -195,7 +199,6 @@ private async Task> TryGetOrReadCachedSemanticCla DocumentKey documentKey, ClassificationType type, Checksum checksum, - StorageDatabase database, CancellationToken cancellationToken) { // See if we've loaded this into memory first. @@ -204,7 +207,7 @@ private async Task> TryGetOrReadCachedSemanticCla // Otherwise, attempt to read in classifications from persistence store. classifiedSpans = await TryReadCachedSemanticClassificationsAsync( - documentKey, type, checksum, database, cancellationToken).ConfigureAwait(false); + documentKey, type, checksum, cancellationToken).ConfigureAwait(false); if (classifiedSpans.IsDefault) return default; @@ -259,10 +262,9 @@ private async Task> TryReadCachedSemanticClassifi DocumentKey documentKey, ClassificationType type, Checksum checksum, - StorageDatabase database, CancellationToken cancellationToken) { - var persistenceService = GetWorkspaceServices().GetPersistentStorageService(database); + var persistenceService = GetWorkspaceServices().GetPersistentStorageService(); var storage = await persistenceService.GetStorageAsync(documentKey.Project.Solution, cancellationToken).ConfigureAwait(false); await using var _ = storage.ConfigureAwait(false); if (storage == null) diff --git a/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.cs b/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.cs index 5def4c6257ae8..fd7a843da54c4 100644 --- a/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.cs +++ b/src/Workspaces/Remote/ServiceHub/Services/SemanticClassification/RemoteSemanticClassificationService.cs @@ -26,7 +26,6 @@ public ValueTask GetClassificationsAsync( TextSpan span, ClassificationType type, ClassificationOptions options, - StorageDatabase database, bool isFullyLoaded, CancellationToken cancellationToken) { @@ -54,7 +53,7 @@ await AbstractClassificationService.AddClassificationsInCurrentProcessAsync( _cachedData.Clear(); // Enqueue this document into our work queue to fully classify and cache. - _workQueue.AddWork((document, type, options, database)); + _workQueue.AddWork((document, type, options)); } return SerializableClassifiedSpans.Dehydrate(temp.ToImmutable()); From 02a7f02c77328516d692272c46a4bd37967a7e87 Mon Sep 17 00:00:00 2001 From: Joey Robichaud Date: Tue, 5 Apr 2022 17:49:48 -0700 Subject: [PATCH 130/131] Fix merge from main --- .../Compiler/Core/CodeStyle/CodeStyleOptions2.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOptions2.cs b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOptions2.cs index 36d86a17c205d..c68ba4f1e92f9 100644 --- a/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOptions2.cs +++ b/src/Workspaces/SharedUtilitiesAndExtensions/Compiler/Core/CodeStyle/CodeStyleOptions2.cs @@ -413,7 +413,7 @@ private static string GetForEachExplicitCastInSourceEditorConfigString( Debug.Assert(s_forEachExplicitCastInSourcePreferencePreferenceMap.ContainsValue(option.Value)); var value = s_forEachExplicitCastInSourcePreferencePreferenceMap.GetKeyOrDefault(option.Value) ?? s_forEachExplicitCastInSourcePreferencePreferenceMap.GetKeyOrDefault(defaultValue.Value); - return option.Notification == null ? value! : $"{value}{GetEditorConfigStringNotificationPart(option, defaultValue)}"; + return $"{value}{GetEditorConfigStringNotificationPart(option, defaultValue)}"; } #endregion From 1160a11aaa03decab2fdc2c956ae980ba25a1bbd Mon Sep 17 00:00:00 2001 From: David Barbet Date: Tue, 5 Apr 2022 20:47:44 -0700 Subject: [PATCH 131/131] Do not assert we are on the main thread in the constructor --- src/EditorFeatures/Core/Preview/AbstractPreviewFactoryService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/EditorFeatures/Core/Preview/AbstractPreviewFactoryService.cs b/src/EditorFeatures/Core/Preview/AbstractPreviewFactoryService.cs index 23459a6ab9693..111d81672b4c5 100644 --- a/src/EditorFeatures/Core/Preview/AbstractPreviewFactoryService.cs +++ b/src/EditorFeatures/Core/Preview/AbstractPreviewFactoryService.cs @@ -58,7 +58,6 @@ public AbstractPreviewFactoryService( ITextViewRoleSet previewRoleSet, IGlobalOptionService globalOptions) { - threadingContext.ThrowIfNotOnUIThread(); ThreadingContext = threadingContext; _textBufferFactoryService = textBufferFactoryService; _contentTypeRegistryService = contentTypeRegistryService;