Beispiel #1
0
        private bool ClearDiagnosticsReportedBySource(IDiagnosticUpdateSource source, List <DiagnosticsUpdatedArgs> removed)
        {
            // we expect source who uses this ability to have small number of diagnostics.
            lock (_gate)
            {
                Debug.Assert(_updateSources.Contains(source));

                // 2 different workspaces (ex, PreviewWorkspaces) can return same Args.Id, we need to
                // distinguish them. so we separate diagnostics per workspace map.
                if (!_map.TryGetValue(source, out var workspaceMap))
                {
                    return(false);
                }

                foreach (var(workspace, map) in workspaceMap)
                {
                    foreach (var(id, data) in map)
                    {
                        removed.Add(DiagnosticsUpdatedArgs.DiagnosticsRemoved(id, data.Workspace, solution: null, data.ProjectId, data.DocumentId));
                    }
                }

                // all diagnostics from the source is cleared
                _map.Remove(source);
                return(true);
            }
        }
Beispiel #2
0
 private void RaiseEmptyDiagnosticUpdated(AnalysisKind kind, DocumentId documentId)
 {
     _service.RaiseDiagnosticsUpdated(
         DiagnosticsUpdatedArgs.DiagnosticsRemoved(
             new DefaultUpdateArgsId(_workspace.Kind, kind, documentId),
             _workspace,
             null,
             documentId.ProjectId,
             documentId
             )
         );
 }
 private DiagnosticsUpdatedArgs MakeRemovedArgs(DiagnosticAnalyzer analyzer, Project project)
 {
     return(DiagnosticsUpdatedArgs.DiagnosticsRemoved(
                CreateId(analyzer, project), this.Workspace, project?.Solution, project?.Id, documentId: null));
 }