提交 c8c94650 编写于 作者: T Tom Meschter

Add a method to `IDiagnosticAnalyzerService`

Add the `GetDiagnosticDescriptors(DiagnosticAnalyzer)` method to the
`IDiagnosticAnalyzerService` interface.
上级 73407668
......@@ -70,5 +70,11 @@ internal interface IDiagnosticAnalyzerService
/// </summary>
/// <returns>A mapping from analyzer name to the diagnostics produced by that analyzer</returns>
ImmutableDictionary<string, ImmutableArray<DiagnosticDescriptor>> GetDiagnosticDescriptors(Project projectOpt);
/// <summary>
/// Gets a list of the diagnostics provided by the given <see cref="DiagnosticAnalyzer"/>.
/// </summary>
/// <returns>A list of the diagnostics produced by the given analyzer</returns>
ImmutableArray<DiagnosticDescriptor> GetDiagnosticDescriptors(DiagnosticAnalyzer analyzer);
}
}
......@@ -23,7 +23,7 @@ protected override IAttachedCollectionSource CreateCollectionSource(AnalyzerItem
{
if (relationshipName == KnownRelationships.Contains)
{
return new DiagnosticItemSource(item, _commandHandler, (DiagnosticAnalyzerService)_diagnosticAnalyzerService);
return new DiagnosticItemSource(item, _commandHandler, _diagnosticAnalyzerService);
}
return null;
......
......@@ -20,14 +20,14 @@ internal partial class DiagnosticItemSource : IAttachedCollectionSource
private readonly AnalyzerItem _item;
private readonly IAnalyzersCommandHandler _commandHandler;
private readonly DiagnosticAnalyzerService _diagnosticAnalyzerService;
private readonly IDiagnosticAnalyzerService _diagnosticAnalyzerService;
private BulkObservableCollection<DiagnosticItem> _diagnosticItems;
private Workspace _workspace;
private ProjectId _projectId;
private ReportDiagnostic _generalDiagnosticOption;
private ImmutableDictionary<string, ReportDiagnostic> _specificDiagnosticOptions;
public DiagnosticItemSource(AnalyzerItem item, IAnalyzersCommandHandler commandHandler, DiagnosticAnalyzerService diagnosticAnalyzerService)
public DiagnosticItemSource(AnalyzerItem item, IAnalyzersCommandHandler commandHandler, IDiagnosticAnalyzerService diagnosticAnalyzerService)
{
_item = item;
_commandHandler = commandHandler;
......
......@@ -185,6 +185,10 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
Public Function GetProjectDiagnosticsForIdsAsync(solution As Solution, Optional projectId As ProjectId = Nothing, Optional diagnosticIds As ImmutableHashSet(Of String) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of ImmutableArray(Of DiagnosticData)) Implements IDiagnosticAnalyzerService.GetProjectDiagnosticsForIdsAsync
Return SpecializedTasks.EmptyImmutableArray(Of DiagnosticData)()
End Function
Public Function GetDiagnosticDescriptors(analyzer As DiagnosticAnalyzer) As ImmutableArray(Of DiagnosticDescriptor) Implements IDiagnosticAnalyzerService.GetDiagnosticDescriptors
Return ImmutableArray(Of DiagnosticDescriptor).Empty
End Function
End Class
End Class
End Namespace
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册