public static SourceCodeEditor showHtmlNodeLocation(this SourceCodeEditor codeEditor, HtmlAgilityPack.HtmlNode htmlNode) { var startLine = htmlNode.Line; var startColumn = htmlNode.LinePosition; var endLine = startLine; var endColumn = startColumn; if (htmlNode.NextSibling != null) { endLine = htmlNode.NextSibling.Line; endColumn = htmlNode.NextSibling.LinePosition; } else { endColumn += htmlNode.html().size(); } "selecting CodeEditor location: {0}:{1} -> {2}:{3}".info(startLine, startColumn, endLine, endColumn); codeEditor.clearMarkers(); codeEditor.selectTextWithColor(startLine, startColumn, endLine, endColumn); codeEditor.caret_Line(startLine); codeEditor.refresh(); return(codeEditor); }
public static SourceCodeEditor colorINodes(this SourceCodeEditor codeEditor, List <INode> nodes) { codeEditor.clearMarkers(); foreach (var node in nodes) { codeEditor.selectTextWithColor(node); } codeEditor.refresh(); return(codeEditor); }
public static SourceCodeEditor add_CodeMarker(this SourceCodeEditor codeEditor, int offsetStart, int offsetEnd) { codeEditor.textEditor().invokeOnThread( () => { var position1 = codeEditor.document().OffsetToPosition(offsetStart); var position2 = codeEditor.document().OffsetToPosition(offsetEnd); codeEditor.clearMarkers(); codeEditor.selectTextWithColor(position1, position2) .refresh(); codeEditor.document().MarkerStrategy.TextMarker.first().field("color", Color.Azure); }); return(codeEditor); }