Example #1
0
        private void LanguageService_DiagnosticsUpdated(object sender, DiagnosticsUpdatedEventArgs e)
        {
            if (e.AssociatedSourceFile == SourceFile)
            {
                _diagnosticMarkersRenderer?.RemoveAll(marker => Equals(marker.Tag, e.Tag));

                var collection = new TextSegmentCollection <Diagnostic>(Document);

                foreach (var diagnostic in e.Diagnostics)
                {
                    collection.Add(diagnostic);
                }

                if (e.Kind == DiagnosticsUpdatedKind.DiagnosticsCreated)
                {
                    _diagnosticMarkersRenderer?.SetDiagnostics(e.Tag, collection);

                    if (e.DiagnosticHighlights != null)
                    {
                        _textColorizer.SetTransformations(e.Tag, e.DiagnosticHighlights);
                    }
                }

                _contextActionsRenderer.OnDiagnosticsUpdated();
            }

            _shell.UpdateDiagnostics(e);

            TextArea.TextView.Redraw();
        }
Example #2
0
            private void OnDiagnosticsUpdated(object sender, DiagnosticsUpdatedEventArgs e)
            {
                var document = _subjectBuffer.AsTextContainer().GetOpenDocumentInCurrentContext();

                if (document != null && document.Id == e.DocumentId)
                {
                    this.RaiseChanged();
                }
            }
Example #3
0
        public void UpdateDiagnostics(DiagnosticsUpdatedEventArgs diagnostics)
        {
            var toRemove = ErrorList.Errors.Where(e => Equals(e.Tag, diagnostics.Tag) && e.AssociatedFile == diagnostics.AssociatedSourceFile).ToList();

            foreach (var error in toRemove)
            {
                ErrorList.Errors.Remove(error);
            }

            foreach (var diagnostic in diagnostics.Diagnostics)
            {
                if (diagnostic.Level != DiagnosticLevel.Hidden)
                {
                    ErrorList.Errors.InsertSorted(new ErrorViewModel(diagnostic, diagnostics.Tag, diagnostics.AssociatedSourceFile));
                }
            }
        }
Example #4
0
 private void OnDiagnosticsUpdated(object sender, DiagnosticsUpdatedEventArgs e)
 {
     _queue.ScheduleTask(() => UpdateDiagnostics(e.Document));
 }