public override void CompleteStatement(MonoDevelop.Ide.Gui.Document doc) { var fixer = new ConstructFixer(doc.GetFormattingOptions(), doc.Editor.CreateNRefactoryTextEditorOptions()); int newOffset; if (fixer.TryFix(doc.Editor.Document, doc.Editor.Caret.Offset, out newOffset)) { doc.Editor.Caret.Offset = newOffset; } }
static string OutputNode(MonoDevelop.Ide.Gui.Document doc, AstNode node) { using (var stringWriter = new System.IO.StringWriter()) { // formatter.Indentation = indentLevel; var formatter = new TextWriterTokenWriter(stringWriter); stringWriter.NewLine = doc.Editor.EolMarker; var visitor = new CSharpOutputVisitor(formatter, doc.GetFormattingOptions()); node.AcceptVisitor(visitor); return(stringWriter.ToString()); } }