Browse Source

Add CSharpFormattingOptions.IndentationString

pull/998/merge
Siegfried Pammer 8 years ago
parent
commit
f80f164118
  1. 2
      ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpFormattingOptions.cs
  2. 2
      ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs
  3. 4
      ILSpy/TextView/AvalonEditTextOutput.cs

2
ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpFormattingOptions.cs

@ -86,6 +86,8 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -86,6 +86,8 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor
}
#region Indentation
public string IndentationString { get; set; } = "\t";
public bool IndentNamespaceBody { // tested
get;
set;

2
ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs

@ -45,7 +45,7 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor @@ -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;
}

4
ILSpy/TextView/AvalonEditTextOutput.cs

@ -76,6 +76,8 @@ namespace ICSharpCode.ILSpy.TextView @@ -76,6 +76,8 @@ namespace ICSharpCode.ILSpy.TextView
int indent;
/// <summary>Whether indentation should be inserted on the next write</summary>
bool needsIndent;
public string IndentationString { get; set; } = "\t";
internal readonly List<VisualLineElementGenerator> elementGenerators = new List<VisualLineElementGenerator>();
@ -176,7 +178,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -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);
}
}
}

Loading…
Cancel
Save