Skip to content

Commit 28d4d9d

Browse files
authored
Remove unused ServiceComponentOnOffOptions (#56154)
1 parent 34a5215 commit 28d4d9d

File tree

8 files changed

+6
-103
lines changed

8 files changed

+6
-103
lines changed

src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsClassificationTaggerProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics
3232
[TagType(typeof(ClassificationTag))]
3333
internal partial class DiagnosticsClassificationTaggerProvider : AbstractDiagnosticsTaggerProvider<ClassificationTag>
3434
{
35-
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions = new[] { EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Classification, ServiceComponentOnOffOptions.DiagnosticProvider };
35+
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions = new[] { EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Classification };
3636

3737
private readonly ClassificationTypeMap _typeMap;
3838
private readonly ClassificationTag _classificationTag;

src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSquiggleTaggerProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics
2828
internal partial class DiagnosticsSquiggleTaggerProvider : AbstractDiagnosticsAdornmentTaggerProvider<IErrorTag>
2929
{
3030
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions =
31-
ImmutableArray.Create(EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Squiggles, ServiceComponentOnOffOptions.DiagnosticProvider);
31+
ImmutableArray.Create(EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Squiggles);
3232

3333
protected override IEnumerable<Option2<bool>> Options => s_tagSourceOptions;
3434

src/EditorFeatures/Core/Implementation/Diagnostics/DiagnosticsSuggestionTaggerProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal partial class DiagnosticsSuggestionTaggerProvider :
2828
AbstractDiagnosticsAdornmentTaggerProvider<IErrorTag>
2929
{
3030
private static readonly IEnumerable<Option2<bool>> s_tagSourceOptions =
31-
ImmutableArray.Create(EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Squiggles, ServiceComponentOnOffOptions.DiagnosticProvider);
31+
ImmutableArray.Create(EditorComponentOnOffOptions.Tagger, InternalFeatureOnOffOptions.Squiggles);
3232

3333
protected override IEnumerable<Option2<bool>> Options => s_tagSourceOptions;
3434

src/EditorFeatures/Test2/Diagnostics/DiagnosticProviderTests.vb

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -203,35 +203,6 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests
203203
VerifyAllAvailableDiagnostics(test, diagnostics, ordered:=False)
204204
End Sub
205205

206-
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
207-
Public Sub TestDiagnosticsFromTurnedOff()
208-
Dim test = <Workspace>
209-
<Project Language="C#" CommonReferences="true">
210-
<Document FilePath="Test.cs">
211-
class Program
212-
{
213-
-
214-
void Test()
215-
{
216-
int a = 5 - "2";
217-
}
218-
}
219-
</Document>
220-
</Project>
221-
<Project Language="Visual Basic" CommonReferences="true">
222-
<Document FilePath="Test.vb">
223-
Class GooClass
224-
Sub Blah() End Sub
225-
End Class
226-
</Document>
227-
</Project>
228-
</Workspace>
229-
230-
Dim diagnostics = <Diagnostics></Diagnostics>
231-
232-
VerifyAllAvailableDiagnostics(test, diagnostics, ordered:=False, enabled:=False)
233-
End Sub
234-
235206
<Fact, Trait(Traits.Feature, Traits.Features.Diagnostics)>
236207
Public Sub WarningsAsErrors()
237208
Dim test =
@@ -283,17 +254,9 @@ Namespace Microsoft.CodeAnalysis.Editor.Implementation.Diagnostics.UnitTests
283254
VerifyAllAvailableDiagnostics(test, diagnostics)
284255
End Sub
285256

286-
Private Shared Sub VerifyAllAvailableDiagnostics(test As XElement, diagnostics As XElement, Optional ordered As Boolean = True, Optional enabled As Boolean = True)
257+
Private Shared Sub VerifyAllAvailableDiagnostics(test As XElement, diagnostics As XElement, Optional ordered As Boolean = True)
287258
Using workspace = TestWorkspace.CreateWorkspace(test, composition:=s_composition)
288259

289-
' turn off diagnostic
290-
If Not enabled Then
291-
workspace.TryApplyChanges(workspace.CurrentSolution.WithOptions(workspace.Options _
292-
.WithChangedOption(ServiceComponentOnOffOptions.DiagnosticProvider, False) _
293-
.WithChangedOption(SolutionCrawlerOptions.BackgroundAnalysisScopeOption, LanguageNames.CSharp, BackgroundAnalysisScope.Default) _
294-
.WithChangedOption(SolutionCrawlerOptions.BackgroundAnalysisScopeOption, LanguageNames.VisualBasic, BackgroundAnalysisScope.Default)))
295-
End If
296-
297260
Dim registrationService = workspace.Services.GetService(Of ISolutionCrawlerRegistrationService)()
298261
registrationService.Register(workspace)
299262

src/Features/Core/Portable/Diagnostics/DefaultDiagnosticAnalyzerService.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,7 @@ public DefaultDiagnosticAnalyzerService(
3636
}
3737

3838
public IIncrementalAnalyzer CreateIncrementalAnalyzer(Workspace workspace)
39-
{
40-
if (!workspace.Options.GetOption(ServiceComponentOnOffOptions.DiagnosticProvider))
41-
{
42-
return null;
43-
}
44-
45-
return new DefaultDiagnosticIncrementalAnalyzer(this, workspace);
46-
}
39+
=> new DefaultDiagnosticIncrementalAnalyzer(this, workspace);
4740

4841
public event EventHandler<DiagnosticsUpdatedArgs> DiagnosticsUpdated;
4942
public event EventHandler DiagnosticsCleared { add { } remove { } }

src/Features/Core/Portable/Diagnostics/DiagnosticAnalyzerService_IncrementalAnalyzer.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,7 @@ namespace Microsoft.CodeAnalysis.Diagnostics
2020
internal partial class DiagnosticAnalyzerService : IIncrementalAnalyzerProvider
2121
{
2222
public IIncrementalAnalyzer CreateIncrementalAnalyzer(Workspace workspace)
23-
{
24-
if (!workspace.Options.GetOption(ServiceComponentOnOffOptions.DiagnosticProvider))
25-
{
26-
return null;
27-
}
28-
29-
return _map.GetValue(workspace, _createIncrementalAnalyzer);
30-
}
23+
=> _map.GetValue(workspace, _createIncrementalAnalyzer);
3124

3225
public void ShutdownAnalyzerFrom(Workspace workspace)
3326
{

src/Features/Core/Portable/Shared/Options/ServiceComponentOnOffOptions.cs

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/Features/Core/Portable/Shared/Options/ServiceComponentOnOffOptionsProvider.cs

Lines changed: 0 additions & 28 deletions
This file was deleted.

0 commit comments

Comments
 (0)