Example #1
0
        private SourceRange GetHighlightRange(Diagnostic diagnostic)
        {            
            Cursor cursor = diagnostic.LocationCursor;
            if (cursor == null || cursor.Extent == null) return null;

            Token tok = cursor.Extent.GetTokenAtOffset(diagnostic.Location.Offset);
            return tok == null ? null : tok.Extent;
        }                    
Example #2
0
 private void HighlightDiagnostic(Diagnostic diagnostic)
 {
     SourceRange extent = GetHighlightRange(diagnostic);
     if (extent == null)
         return;
     if (diagnostic.DiagnosticSeverity == Diagnostic.Severity.Error ||
         diagnostic.DiagnosticSeverity == Diagnostic.Severity.Warning)
     {
         Highlighting.IHighlightedRange hr = _highlighter.AddRange(extent.Start.Offset, extent.Length);
         hr.ForegroundColour = diagnostic.DiagnosticSeverity == Diagnostic.Severity.Error ? Colors.Red : Colors.Blue;
     }
 }