Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
            }
        }