protected override void ReplaceFieldDeclaration(ICSharpCode.TextEditor.Document.IDocument document, IField oldField, string newFieldDeclaration)
        {
            // In VB, the field region begins at the start of the declaration
            // and ends on the first column of the line following the declaration.
            int startOffset = document.PositionToOffset(new TextLocation(0, oldField.Region.BeginLine - 1));
            int endOffset   = document.PositionToOffset(new TextLocation(0, oldField.Region.EndLine - 1));

            document.Replace(startOffset, endOffset - startOffset, tabs + newFieldDeclaration + Environment.NewLine);
        }
Beispiel #2
0
        //public override void IndentLines(ICSharpCode.TextEditor.TextArea textArea, int begin, int end)
        //{
        //}

        protected override int SmartIndentLine(ICSharpCode.TextEditor.TextArea area, int line)
        {
            ICSharpCode.TextEditor.Document.IDocument   document    = area.Document;
            ICSharpCode.TextEditor.Document.LineSegment lineSegment = document.GetLineSegment(line - 1);
            if (document.GetText(lineSegment).EndsWith(":"))
            {
                ICSharpCode.TextEditor.Document.LineSegment segment = document.GetLineSegment(line);
                string indent_str = "    ";// ICSharpCode.TextEditor.Actions.Tab.GetIndentationString(document);
                if (!area.TextEditorProperties.ConvertTabsToSpaces)
                {
                    indent_str = "\t";
                }
                string str = base.GetIndentation(area, line - 1) + indent_str;
                document.Replace(segment.Offset, segment.Length, str + document.GetText(segment));
                return(str.Length);
            }
            return(base.SmartIndentLine(area, line));
        }