private bool IsCurrentLineTableRow() { int offset = TextEditor.TextArea.Caret.Offset; DocumentLine line = Document.GetLineByOffset(offset); GherkinSimpleParser parser = new GherkinSimpleParser(Document); Token token = parser.ParseToken(GherkinFormatUtil.GetText(Document, line)); return(token.MatchedType == TokenType.TableRow); }
public void UncommentSelectedLines() { using (Document.RunUpdate()) { int start, end; GetSelection(out start, out end); StringBuilder sb = new StringBuilder(); for (int lineNo = start; lineNo <= end; lineNo++) { DocumentLine line = Document.GetLineByNumber(lineNo); string line_text = GherkinFormatUtil.GetText(Document, line); sb.Append(RemoveBeginningChar(line_text, '#')); } var uncommented_lines = sb.ToString(); DocumentLine startLine = Document.GetLineByNumber(start); DocumentLine endLine = Document.GetLineByNumber(end); int length = endLine.Offset - startLine.Offset + endLine.TotalLength; Document.Replace(startLine.Offset, length, uncommented_lines); } }