diff --git a/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpFormattingOptions.cs b/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpFormattingOptions.cs index f5bd39d48..9d7e29e36 100644 --- a/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpFormattingOptions.cs +++ b/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpFormattingOptions.cs @@ -86,6 +86,8 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor } #region Indentation + public string IndentationString { get; set; } = "\t"; + public bool IndentNamespaceBody { // tested get; set; diff --git a/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs b/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs index 1b8d4cab5..204d54251 100644 --- a/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs +++ b/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs @@ -45,7 +45,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor if (formattingPolicy == null) { throw new ArgumentNullException ("formattingPolicy"); } - this.writer = TokenWriter.Create(textWriter); + this.writer = TokenWriter.Create(textWriter, formattingPolicy.IndentationString); this.policy = formattingPolicy; } diff --git a/ILSpy/TextView/AvalonEditTextOutput.cs b/ILSpy/TextView/AvalonEditTextOutput.cs index c7f64093e..21dc101b2 100644 --- a/ILSpy/TextView/AvalonEditTextOutput.cs +++ b/ILSpy/TextView/AvalonEditTextOutput.cs @@ -76,6 +76,8 @@ namespace ICSharpCode.ILSpy.TextView int indent; /// Whether indentation should be inserted on the next write bool needsIndent; + + public string IndentationString { get; set; } = "\t"; internal readonly List elementGenerators = new List(); @@ -176,7 +178,7 @@ namespace ICSharpCode.ILSpy.TextView if (needsIndent) { needsIndent = false; for (int i = 0; i < indent; i++) { - b.Append('\t'); + b.Append(IndentationString); } } }