protected string GetIndentation(ICSharpCode.TextEditor.Document.IDocument document, int line) { string lineText = document.GetText(document.GetLineSegment(line)); return lineText.Substring(0, lineText.Length - lineText.TrimStart().Length); }