public void EndTaskWritte(object sender, string name, string status, List <TaskMessage> taskMessage) { Gtk.Application.Invoke(delegate { try { foreach (ErrorMarker er in errors) { er.RemoveFromLine(editor.Document); //editor.Document.RemoveMarker(er.Line,typeof(ErrorMarker)); } errors.Clear(); if (taskMessage != null) { foreach (TaskMessage tm in taskMessage) { LineSegment ls = editor.Document.GetLine(Convert.ToInt32(tm.Line) - 1); ErrorMarker er = new ErrorMarker(ls); er.AddToLine(editor.Document); errors.Add(er); } } else { Console.WriteLine("Output NULL"); } } catch (Exception ex) { //Tool.Logger.Error(ex.Message, null); Tool.Logger.Error(ex.Message); Tool.Logger.Error(ex.StackTrace); Tool.Logger.Error(ex.Source); } }); }
private void UnderlineErrors(IEnumerable <BuildError> parsedErrors) { if (_editor.IsDisposed || _editor.Disposing || !Enabled) { return; } if (_editor.InvokeRequired) { _editor.Invoke(() => UnderlineErrors(parsedErrors)); return; } _document.MarkerStrategy.RemoveAll(m => m is ErrorMarker); var options = Settings.Default.CaseSensitive ? StringComparison.Ordinal : StringComparison.OrdinalIgnoreCase; foreach (BuildError error in parsedErrors.Where( error => error.File == _editor.FileName)) { var segment = _document.GetLineSegment(error.LineNumber - 1); Match match = Regex.Match(error.Description, "'(?<error>.*?)'"); TextWord word; int offset = segment.Offset; int length; if (match.Success) { word = segment.Words.FirstOrDefault( s => s.Word.Equals(match.Groups["error"].Value, options)) ?? segment.Words.FirstOrDefault(w => !w.IsWhiteSpace); length = match.Groups["error"].Length; } else { word = segment.Words.FirstOrDefault(w => !w.IsWhiteSpace); TextWord lastWord = segment.Words.Last(w => !w.IsWhiteSpace); length = lastWord.Offset + lastWord.Length; } if (word != null) { offset += word.Offset; } ErrorMarker marker = new ErrorMarker(offset, length, error.Description, error.IsWarning); _document.MarkerStrategy.AddMarker(marker); } }
public static ErrorMarker Create(EditorDocument EditorDoc, GenericError Error) { var em = new ErrorMarker(EditorDoc, Error); em.ForegroundColor = Error.ForegroundColor; em.BackgroundColor = Error.BackgroundColor; if (Error.MarkerColor.HasValue) { em.MarkerColor = Error.MarkerColor.Value; } // Init offsets manually try { if (Error.Line >= EditorDoc.Editor.Document.LineCount) { return(null); } if (Error.Line == EditorDoc.Editor.Document.LineCount - 1 && EditorDoc.Editor.Document.Lines[Error.Line].Length > Error.Column) { return(null); } em.StartOffset = EditorDoc.Editor.Document.GetOffset(Error.Line, Error.Column); } catch { return(null); } if (Error.Length > 0) { em.Length = Error.Length; } else { em.CalculateWordOffset(em.StartOffset, false); } return(em); }
public void RefreshErrorHighlightings() { // Clear old markers foreach (var marker in MarkerStrategy.TextMarkers.ToArray()) { if (marker is ErrorMarker) { marker.Delete(); } } foreach (var err in CoreManager.ErrorManagement.GetErrorsForFile(AbsoluteFilePath)) { var m = ErrorMarker.Create(this, err); if (m != null) { MarkerStrategy.Add(m); m.Redraw(); } } }
public void SetErrorPosition(ErrorMarker errorMarker, LatLon errorPosition) { _errorPositions[(int)errorMarker] = new ErrorPosition(errorPosition); }
public ErrorPosition GetErrorPosition(ErrorMarker errorMarker) { return(_errorPositions[(int)errorMarker]); }
public static ErrorMarker Create(EditorDocument EditorDoc, GenericError Error) { var em = new ErrorMarker(EditorDoc, Error); em.ForegroundColor = Error.ForegroundColor; em.BackgroundColor = Error.BackgroundColor; if (Error.MarkerColor.HasValue) em.MarkerColor = Error.MarkerColor.Value; // Init offsets manually try { if (Error.Line >= EditorDoc.Editor.Document.LineCount) return null; if (Error.Line == EditorDoc.Editor.Document.LineCount-1 && EditorDoc.Editor.Document.Lines[Error.Line].Length > Error.Column) return null; em.StartOffset = EditorDoc.Editor.Document.GetOffset(Error.Line, Error.Column); } catch { return null; } if (Error.Length > 0) em.Length = Error.Length; else em.CalculateWordOffset(em.StartOffset, false); return em; }