public void Create(int offset, int length, string message) { var m = new TextMarker(offset, length); markers.Add(m); m.MarkerColor = Colors.Red; m.ToolTip = message; Redraw(m); }
void DrawMarker(Graphics g, TextMarker marker, RectangleF drawingRect) { // draw markers later so they can overdraw the following text markersToDraw.Add(new MarkerToDraw(marker, drawingRect)); }
public void Remove(TextMarker marker) { if (markers.Remove(marker)) { Redraw(marker); } }
public void InsertMarker(int index, TextMarker item) { markersTable.Clear(); textMarker.Insert(index, item); }
public void AddMarker(TextMarker marker) { _markers.Add(marker); _document.MarkerStrategy.AddMarker(marker); }
private static bool InvisibleMarkers(TextMarker marker) { return marker.TextMarkerType == TextMarkerType.Invisible; }
/// <summary> /// Constructor. /// </summary> /// <param name="tm">TextMarker linked to the viewModel</param> public TextMarkerViewModel(TextMarker tm) { _Marker = tm; }
public HResult CreateTextMarker(NiTextMarkerType type, NiTextMarkerHatchStyle hatchStyle, bool extendToBorder, int color, int foreColor, int startLine, int startIndex, int endLine, int endIndex, out INiTextMarker textMarker) { textMarker = null; try { var range = TranslateOffset(startLine, startIndex, endLine, endIndex); var nativeType = GetTextMarkerType(type, extendToBorder); var drawingColor = Color.FromArgb(color); var drawingForeColor = Color.FromArgb(foreColor); TextMarker nativeMarker; // The TextMarker interface is crap. We cannot simply call // the constructor with all the arguments, because calling // the constructor determines whether a property is available. if (hatchStyle != NiTextMarkerHatchStyle.Default) { nativeMarker = new TextMarker( range.Offset, range.Length, nativeType, drawingColor, drawingForeColor, Enum <HatchStyle> .Parse(hatchStyle.ToString()) ); } else if (drawingForeColor.A != 0) { nativeMarker = new TextMarker( range.Offset, range.Length, nativeType, drawingColor, drawingForeColor ); } else if (drawingColor.A != 0) { nativeMarker = new TextMarker( range.Offset, range.Length, nativeType, drawingColor ); } else { nativeMarker = new TextMarker( range.Offset, range.Length, nativeType ); } OnBeginUpdate(EventArgs.Empty); try { Document.MarkerStrategy.AddMarker(nativeMarker); } finally { OnEndUpdate(EventArgs.Empty); } textMarker = new NiTextMarker(this, nativeMarker); return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
private void DrawMarker(Graphics g, TextMarker marker, RectangleF drawingRect) { this.markersToDraw.Add(new TextView.MarkerToDraw(marker, drawingRect)); }
public MarkerToDraw(TextMarker marker, RectangleF drawingRect) { this.marker = marker; this.drawingRect = drawingRect; }
/// <summary> /// Constructor /// </summary> /// <param name="tm">Textmarker associated with the event</param> public TextMarkerEventArgs(TextMarker tm) { _tm = tm; }
private void DisplayDiff(TextDiff source, TextDiff destination, ArrayList DiffLines) { CleanResultTextEditors(); int cnt = 1; int i; try { _isDisplayingDiff = true; SourceDoc.ReadOnly = false; DestDoc.ReadOnly = false; SourceTextArea.BeginUpdate(); DestTextArea.BeginUpdate(); foreach (DiffResultSpan drs in DiffLines) { switch (drs.Status) { case DiffResultSpanStatus.DeleteSource: for (i = 0; i < drs.Length; i++) { var line = ((DiffTextLine)source.GetByIndex(drs.SourceIndex + i)).Line + "\n"; SourceTextArea.InsertString(line); //SourceDoc.CustomLineManager.AddCustomLine(cnt - 1, Color.MistyRose, false); var segment = SourceDoc.GetLineSegment(cnt - 1); if (segment.Length > 0) { var marker = new TextMarker(segment.Offset, segment.Length, TextMarkerType.SolidBlock, Color.Green, Color.White); SourceDoc.MarkerStrategy.AddMarker(marker); } DestTextArea.InsertString("\n"); DestDoc.CustomLineManager.AddCustomLine(cnt - 1, Color.LightGray, false); cnt++; } break; case DiffResultSpanStatus.NoChange: for (i = 0; i < drs.Length; i++) { var bgColor = SourceDoc.HighlightingStrategy.GetColorFor("Default"); SourceTextArea.InsertString(((DiffTextLine)source.GetByIndex(drs.SourceIndex + i)).Line + "\n"); //SourceDoc.CustomLineManager.AddCustomLine(cnt - 1, bgColor != null ? bgColor.BackgroundColor : Color.White, false); bgColor = DestDoc.HighlightingStrategy.GetColorFor("Default"); DestTextArea.InsertString(((DiffTextLine)destination.GetByIndex(drs.DestIndex + i)).Line + "\n"); //DestDoc.CustomLineManager.AddCustomLine(cnt - 1, bgColor != null ? bgColor.BackgroundColor : Color.White, false); cnt++; } break; case DiffResultSpanStatus.AddDestination: for (i = 0; i < drs.Length; i++) { SourceTextArea.InsertString("\n"); SourceDoc.CustomLineManager.AddCustomLine(cnt - 1, Color.LightGray, false); var line = ((DiffTextLine)destination.GetByIndex(drs.DestIndex + i)).Line + "\n"; DestTextArea.InsertString(line); var segment = DestDoc.GetLineSegment(cnt - 1); if (segment.Length > 0) { var marker = new TextMarker(segment.Offset, segment.Length, TextMarkerType.SolidBlock, Color.Red, Color.White); DestDoc.MarkerStrategy.AddMarker(marker); } //DestDoc.CustomLineManager.AddCustomLine(cnt - 1, Color.LightGreen, false); cnt++; } break; case DiffResultSpanStatus.Replace: for (i = 0; i < drs.Length; i++) { var line = ((DiffTextLine)source.GetByIndex(drs.SourceIndex + i)).Line + "\n"; SourceTextArea.InsertString(line); //SourceDoc.CustomLineManager.AddCustomLine(cnt - 1, Color.MistyRose, false); var segment = SourceDoc.GetLineSegment(cnt - 1); if (segment.Length > 0) { var marker = new TextMarker(segment.Offset, segment.Length, TextMarkerType.SolidBlock, Color.Gold, Color.Black); SourceDoc.MarkerStrategy.AddMarker(marker); } line = ((DiffTextLine)destination.GetByIndex(drs.DestIndex + i)).Line + "\n"; DestTextArea.InsertString(line); segment = DestDoc.GetLineSegment(cnt - 1); if (segment.Length > 0) { var marker = new TextMarker(segment.Offset, segment.Length, TextMarkerType.SolidBlock, Color.Gold, Color.Black); DestDoc.MarkerStrategy.AddMarker(marker); } //DestDoc.CustomLineManager.AddCustomLine(cnt - 1, Color.LightGreen, false); cnt++; } break; } } } finally { SourceTextArea.EndUpdate(); DestTextArea.EndUpdate(); SourceTextArea.ScrollTo(0); DestTextArea.ScrollTo(0); _isDisplayingDiff = false; SourceDoc.ReadOnly = true; DestDoc.ReadOnly = true; } }
// TODO pending issue is that when text is pasted into the editor, validation markers are not updated until their lines are modified (seems like a bug in the editor) protected override void MarkTokens(IDocument document, IList <LineSegment> lines) { var summaryLineNumber = -1; var seenDividingSpace = false; var descriptionStartLineNumber = -1; foreach (var line in document.LineSegmentCollection) { if (summaryLineNumber == -1) { if (!IsEmptyOrWhiteSpace(document, line) && !IsComment(document, line)) { summaryLineNumber = line.LineNumber; } } else if (!seenDividingSpace) { if (IsEmptyOrWhiteSpace(document, line)) { seenDividingSpace = true; } else if (!IsComment(document, line)) { descriptionStartLineNumber = line.LineNumber; break; } } else if (descriptionStartLineNumber != -1) { if (!IsEmptyOrWhiteSpace(document, line) && !IsComment(document, line)) { descriptionStartLineNumber = line.LineNumber; break; } } } const int maxSummaryLength = 50; const int maxDescriptionLength = 80; // NOTE the pattern of removing then adding markers might look suboptimal, but tracking their presence isn't reliable as they can be removed without warning foreach (var line in lines) { var lineNumber = line.LineNumber; if (TryHighlightComment(document, line)) { } else { var color = lineNumber == summaryLineNumber ? ColorSummary : ColorNormal; line.Words = new List <TextWord>(capacity: 1) { new TextWord(document, line, 0, line.Length, color, hasDefaultColor: false) }; if (lineNumber == summaryLineNumber) { document.MarkerStrategy.RemoveMarker(_markerSummaryTooLong); if (line.Length > maxSummaryLength) { _markerSummaryTooLong.Offset = line.Offset + maxSummaryLength; _markerSummaryTooLong.Length = line.Length - maxSummaryLength; document.MarkerStrategy.AddMarker(_markerSummaryTooLong); } } else if (lineNumber == descriptionStartLineNumber) { document.MarkerStrategy.RemoveMarker(_markerSpacerNeeded); if (!seenDividingSpace) { _markerSpacerNeeded.Offset = line.Offset; _markerSpacerNeeded.Length = line.Length; document.MarkerStrategy.AddMarker(_markerSpacerNeeded); } } } document.RequestUpdate( new TextAreaUpdate(TextAreaUpdateType.SingleLine, lineNumber)); } if (descriptionStartLineNumber == -1) { if (_overlengthDescriptionMarkers.Count != 0) { foreach (var marker in _overlengthDescriptionMarkers) { document.MarkerStrategy.RemoveMarker(marker); } _overlengthDescriptionMarkers.Clear(); } return; } var markerIndex = 0; foreach (var line in document.LineSegmentCollection) { if (line.LineNumber < descriptionStartLineNumber) { continue; } if (line.Length > maxDescriptionLength) { var markerOffset = line.Offset + maxDescriptionLength; var markerLength = line.Length - maxDescriptionLength; TextMarker overlengthMarker; if (markerIndex < _overlengthDescriptionMarkers.Count) { overlengthMarker = _overlengthDescriptionMarkers[markerIndex]; } else { overlengthMarker = new TextMarker(markerOffset, markerLength, TextMarkerType.WaveLine, Color.Red) { ToolTip = "Line is too long." }; _overlengthDescriptionMarkers.Add(overlengthMarker); document.MarkerStrategy.AddMarker(overlengthMarker); } overlengthMarker.Offset = markerOffset; overlengthMarker.Length = markerLength; markerIndex++; } } var toRemove = _overlengthDescriptionMarkers.Count - markerIndex; if (toRemove > 0) { for (var i = 0; i < toRemove; i++) { var marker = _overlengthDescriptionMarkers[markerIndex + i]; document.MarkerStrategy.RemoveMarker(marker); } _overlengthDescriptionMarkers.RemoveRange(markerIndex, toRemove); } }
public void Create(int offset, int length, string message, Color markerColor) { var m = new TextMarker(offset, length); markers.Add(m); m.MarkerColor = markerColor; m.ToolTip = message; }
public void Add(TextMarker marker) { markers.Add(marker); Redraw(marker); }
/// <summary> /// Get Textmarker enum type as String /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="tmarker">TextMarker enum type</param> /// <returns>tmarker as string</returns> public static string GetTextMarkerAsString(TextMarker tmarker) { switch (tmarker) { case TextMarker.quotes: return TextMarker.quotes.ToString(); case TextMarker.doubleQuotes: return TextMarker.doubleQuotes.ToString(); default: return TextMarker.doubleQuotes.ToString(); } }
/// <summary> /// Used to remove all text markers from the text editor. /// </summary> bool AllMarkersMatch(TextMarker marker) { return(true); }
bool TryGetMarker(BaseCommandEventArgs e, bool issue, out TextMarker value) { value = null; IVsTextView tv = ((ISelectionContextEx)e.Selection).ActiveFrameTextView; if (tv == null) { LogMessageEditor editor = e.Selection.GetActiveControl <LogMessageEditor>(); if (editor == null) { return(false); } tv = ((IAnkhHasVsTextView)editor).TextView; } int x, y; if (!VSErr.Succeeded(tv.GetCaretPos(out y, out x))) { return(false); } IVsTextLines lines; if (!VSErr.Succeeded(tv.GetBuffer(out lines))) { return(false); } string text, pre = null, post = null; text = GetLine(lines, y); if (string.IsNullOrEmpty(text)) { return(false); } string combined = null; int start = 0; if (y > 0) { pre = GetLine(lines, y - 1); combined = pre + '\n'; start = combined.Length; } combined += text; post = GetLine(lines, y + 1); if (!string.IsNullOrEmpty(post)) { combined += '\n' + post; } if (_issueService == null) { _issueService = e.GetService <IAnkhIssueService>(); } IEnumerable <TextMarker> markers; int posToCheck = x + start; if (issue) { if (!_issueService.TryGetIssues(combined, out markers)) { return(false); } } else { if (!_issueService.TryGetRevisions(combined, out markers)) { return(false); } } foreach (TextMarker im in markers) { if (im.Index > posToCheck) { break; } if (im.Index + im.Length >= posToCheck) { value = im; return(true); } } return(false); }
private void Remove(TextMarker marker) { if (markers.Remove(marker)) { Redraw(marker); } }
static bool IsXPathNodeTextMarkerMatch(TextMarker marker) { return(marker is XPathNodeTextMarker); }
private bool MarkerSelector(TextMarker textmarker) { return(true); }
public ErrorToolTip(VoltaCompilerError error, TextMarker marker) { this.Error = error; this.Marker = marker; }
private void Compile() { TextEditor.Document.MarkerStrategy.RemoveAll(marker => true); var profile = (CompilerProfile)SelProfile.SelectedItem; _compiler.Compile(TextEditor.Text, GetReferences(true, profile), Settings.Default.Language, profile); if (!_compiler.Errors.HasErrors) { MethodDefinition = FindMatchingMethod(); if (profile == Compiler.UnitySilverLightProfile && MethodDefinition != null) { CecilHelper.PatchAssemblyNames(MethodDefinition.Module, Compiler.MicrosoftPublicKeyToken, Compiler.MicrosoftClr2Version, Compiler.SilverLightPublicKeyToken, Compiler.UnitySilverLightVersion); } if (profile == Compiler.SilverLight5Profile && MethodDefinition != null) { CecilHelper.PatchAssemblyNames(MethodDefinition.Module, Compiler.MicrosoftPublicKeyToken, Compiler.MicrosoftClr2Version, Compiler.SilverLightPublicKeyToken, Compiler.SilverLight5Version); CecilHelper.PatchAssemblyNames(MethodDefinition.Module, Compiler.MicrosoftPublicKeyToken, Compiler.MicrosoftClr4Version, Compiler.SilverLightPublicKeyToken, Compiler.SilverLight5Version); } ButOk.Enabled = MethodDefinition != null; VerticalSplitContainer.Panel2Collapsed = true; } else { MethodDefinition = null; ButOk.Enabled = false; CompilerErrorBindingSource.DataSource = _compiler.Errors; VerticalSplitContainer.Panel2Collapsed = false; //Add error markers to the TextEditor foreach (CompilerError error in _compiler.Errors) { if (error.Line <= 0) { continue; } var offset = TextEditor.Document.PositionToOffset(new TextLocation(error.Column, error.Line - 1)); var length = TextEditor.Document.LineSegmentCollection[error.Line - 1].Length - error.Column + 1; if (length <= 0) { length = 1; } else { offset--; } var color = error.IsWarning ? Color.Orange : Color.Red; var marker = new TextMarker(offset, length, TextMarkerType.WaveLine, color) { ToolTip = error.ErrorText }; TextEditor.Document.MarkerStrategy.AddMarker(marker); } } TextEditor.Refresh(); MethodHandler.HandleItem(MethodDefinition); }
private static bool remove_pred(TextMarker marker) { return(true); }
public void AddMarker(TextMarker item) { markersTable.Clear(); textMarker.Add(item); }
public static void Highlight(TextArea textArea) { try { int beg_off = -1; int end_off = -1; List <TextMarker> marks = markers[textArea] as List <TextMarker>; if (marks == null) { marks = new List <TextMarker>(); markers[textArea] = marks; } RemoveMarkers(textArea); string word = GetWordAtOffset(textArea, out beg_off, out end_off); if (string.Compare(word, "begin", true) == 0 || highlighted_keywords[word] != null) { if (string.Compare(word, "class", true) == 0) { if (isClassMember(beg_off, textArea)) { return; } } TmpPos end_pos = GetPositionOfEnd(textArea, end_off); if (end_pos != null) { TextLocation Beg = textArea.Document.OffsetToPosition(beg_off); TextLocation End = textArea.Document.OffsetToPosition(end_off); TextMarker marker = new TextMarker(beg_off, word.Length, TextMarkerType.SolidBlock, System.Drawing.Color.FromArgb(219, 224, 204)); marker.WholeLine = false; textArea.Document.MarkerStrategy.AddMarker(marker); marks.Add(marker); textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Document.GetLineNumberForOffset(beg_off))); textArea.EndUpdate(); Beg = textArea.Document.OffsetToPosition(end_pos.start_pos); End = textArea.Document.OffsetToPosition(end_pos.start_pos + end_pos.len); marker = new TextMarker(end_pos.start_pos, end_pos.len, TextMarkerType.SolidBlock, System.Drawing.Color.FromArgb(219, 224, 204)); marker.WholeLine = false; textArea.Document.MarkerStrategy.AddMarker(marker); marks.Add(marker); textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Document.GetLineNumberForOffset(end_pos.start_pos))); textArea.EndUpdate(); textArea.Document.CommitUpdate(); } } else if (string.Compare(word, "end", true) == 0) { TmpPos beg_pos = GetPositionOfBegin(textArea, beg_off); if (beg_pos != null) { TextLocation Beg = textArea.Document.OffsetToPosition(beg_off); TextLocation End = textArea.Document.OffsetToPosition(end_off); TextMarker marker = new TextMarker(beg_off, 3, TextMarkerType.SolidBlock, System.Drawing.Color.FromArgb(219, 224, 204)); marker.WholeLine = false; textArea.Document.MarkerStrategy.AddMarker(marker); marks.Add(marker); textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Document.GetLineNumberForOffset(beg_off))); textArea.EndUpdate(); Beg = textArea.Document.OffsetToPosition(beg_pos.start_pos); End = textArea.Document.OffsetToPosition(beg_pos.start_pos + beg_pos.len); marker = new TextMarker(beg_pos.start_pos, beg_pos.len, TextMarkerType.SolidBlock, System.Drawing.Color.FromArgb(219, 224, 204)); marker.WholeLine = false; textArea.Document.MarkerStrategy.AddMarker(marker); marks.Add(marker); textArea.Document.RequestUpdate(new TextAreaUpdate(TextAreaUpdateType.SingleLine, textArea.Document.GetLineNumberForOffset(beg_pos.start_pos))); textArea.EndUpdate(); textArea.Document.CommitUpdate(); } } } catch (Exception e) { #if DEBUG File.AppendAllText("log.txt", e.Message + Environment.NewLine + e.StackTrace + Environment.NewLine); #endif } }
public void RemoveMarker(TextMarker item) { markersTable.Clear(); textMarker.Remove(item); }
public static List <Error> CheckStructure(TextAreaControl TAC, string file) { TAC.Document.MarkerStrategy.RemoveAll(delegate(TextMarker tm) { return(true); }); int openCurve = 0, closeCurve = 0; int[] openOffsetCurve = new int[2]; int closeOffsetCurve = 0; int offsetError = -1; int offsetOpen = -1; int openCount = 0; //bool errorOpenCurve = false, errorCloseCurve = false; bool only_once = false, new_line = false; List <int> numbersLine = new List <int>(); List <int> warning_comment = new List <int>(); List <Error> error_number = new List <Error>(); List <Error> warning = new List <Error>(); List <Error> report = new List <Error>(); char[] chars = new char[] { '.', ',', '!', '?' }; int len = TAC.Document.TextContent.Length; for (int offset = 0; offset < len; offset++) { char ch = TAC.Document.TextContent[offset]; if (ch == '\r' || ch == '\n') { //Check whitespace on new line if (!new_line && openCurve == 1 && closeCurve == 0 && openCount == 3) { int i = -1; bool ws = false; do { ws = (TAC.Document.TextContent[offset + i] == ' '); i++; } while (!ws && i < 3); if (!ws) { warning.Add(new Error(ErrorType.Message, "New line the whitespace character is missing.", null, offset - 1)); } } new_line = true; only_once = false; continue; } if (ch == Curves[Open]) { openOffsetCurve[1] = openOffsetCurve[0]; openOffsetCurve[0] = offset; openCurve++; if (closeCurve > 0) { closeCurve--; } openCount++; if (openCount == 1) //записываем offset кавычки в первой группе { offsetOpen = offset + 1; } } else if (ch == Curves[Close]) { closeOffsetCurve = offset; closeCurve++; openCurve--; if (openCount == 1) //проверка корректности номера строки в первой группе кавычек { int ln = offset - offsetOpen; string str = TAC.Document.GetText(offsetOpen, ln); if (str.Trim().Length > 0) { int number; if (int.TryParse(str, out number) && number > 0) { if (numbersLine.Contains(number)) { error_number.Add(new Error( ErrorType.Warning, "Duplicate message line number: " + number, null, offsetOpen, ln)); } else { numbersLine.Add(number); } } else { error_number.Add(new Error( ErrorType.Error, "Invalid line number of the message.", null, offsetOpen, ln)); } } else { error_number.Add(new Error( ErrorType.Error, "Missing line number of the message.", null, offsetOpen, ln)); } } else if (openCount == 3) { openCount = 0; } } if (closeCurve > 1) { //errorOpenCurve = true; offsetError = closeOffsetCurve; break; } if (openCurve > 1) { //errorCloseCurve = true; offsetError = openOffsetCurve[1]; break; } else if (openCurve < 0) { //errorCloseCurve = true; offsetError = closeOffsetCurve; break; } //Check whitespace on punctuation if (openCurve == 1 && closeCurve == 0 && Utilities.IsAnyChar(ch, chars)) { char chCheck = TAC.Document.TextContent[offset + 1]; if (char.IsLetter(chCheck)) { warning.Add(new Error(ErrorType.Message, "The whitespace character is missing.", null, offset)); } if (char.IsWhiteSpace(chCheck) && TAC.Document.TextContent[offset - 1] != chars[0] && TAC.Document.TextContent[offset] != chars[1] && char.IsLower(TAC.Document.TextContent, offset + 2)) { warning.Add(new Error(ErrorType.Message, "The sentence begins with a small letter instead of the capital letter.", null, offset + 2)); } } // Comment check characters if (openCurve == 0 && closeCurve == 1) { if (!only_once && !char.IsWhiteSpace(ch) && ch != Curves[Open] && ch != Curves[Close]) { only_once = true; if (ch != '#') { warning_comment.Add(offset); } } } else { only_once = false; } new_line = false; } #region Build reporting error foreach (Error error in error_number) { TextLocation tLoc = TAC.Document.OffsetToPosition(error.line); if (error.column == 0) { error.column = 2; error.line--; } TextMarker tm = new TextMarker(error.line, error.column, TextMarkerType.WaveLine, Color.Red); tm.ToolTip = error.message; TAC.Document.MarkerStrategy.AddMarker(tm); report.Add(new Error(error.type, error.message, file, tLoc.Line + 1, tLoc.Column)); if (report.Count == 1) { TAC.Caret.Position = tLoc; } } if (offsetError > -1) { TextLocation tLoc = TAC.Document.OffsetToPosition(offsetError); TAC.Caret.Position = tLoc; LineSegment ls = TAC.Document.GetLineSegment(tLoc.Line); TextMarker tm = new TextMarker(ls.Offset, ls.Length, TextMarkerType.WaveLine, Color.Red); tm.ToolTip = "Wrong structure of the paired curves brackets."; TAC.Document.MarkerStrategy.AddMarker(tm); report.Add(new Error(ErrorType.Error, tm.ToolTip, file, tLoc.Line + 1, 0)); } foreach (Error error in warning) { TextMarker tm = new TextMarker(error.line - 1, 3, TextMarkerType.WaveLine, Color.Blue); tm.ToolTip = error.message; //"The white space character is missing."; TAC.Document.MarkerStrategy.AddMarker(tm); TextLocation tl = TAC.Document.OffsetToPosition(error.line); report.Add(new Error(error.type, error.message, file, tl.Line + 1, tl.Column)); } foreach (int offset in warning_comment) { TextLocation tLoc = TAC.Document.OffsetToPosition(offset); LineSegment ls = TAC.Document.GetLineSegment(tLoc.Line); int length = offset - ls.Offset; length = ls.Length - length; TextMarker tm = new TextMarker(offset, length, TextMarkerType.Underlined, Color.ForestGreen); tm.ToolTip = "Missing '#' character of comment?"; TAC.Document.MarkerStrategy.AddMarker(tm); report.Add(new Error(ErrorType.None, tm.ToolTip, file, tLoc.Line + 1, tLoc.Column)); } #endregion TAC.Refresh(); return(report); }
/// <summary> /// Get character based on the Textmarker enum type /// </summary> /// <remarks></remarks> /// <seealso cref=""/> /// <param name="tmarker">TextMarker enum</param> /// <returns>Character based on the tmarker</returns> public static char GetTextMarker(TextMarker tmarker) { switch (tmarker) { case TextMarker.quotes: return '\''; case TextMarker.doubleQuotes: return '"'; default: return '"'; } }