|
|
|
@ -37,7 +37,7 @@ namespace ICSharpCode.NRefactory.FormattingTests |
|
|
|
changes.Sort ((x, y) => y.Offset.CompareTo (x.Offset)); |
|
|
|
changes.Sort ((x, y) => y.Offset.CompareTo (x.Offset)); |
|
|
|
StringBuilder b = new StringBuilder(text); |
|
|
|
StringBuilder b = new StringBuilder(text); |
|
|
|
foreach (var change in changes) { |
|
|
|
foreach (var change in changes) { |
|
|
|
// Console.WriteLine ("---- apply:" + change);
|
|
|
|
//Console.WriteLine ("---- apply:" + change);
|
|
|
|
// Console.WriteLine (adapter.Text);
|
|
|
|
// Console.WriteLine (adapter.Text);
|
|
|
|
if (change.Offset > b.Length) |
|
|
|
if (change.Offset > b.Length) |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
@ -53,7 +53,7 @@ namespace ICSharpCode.NRefactory.FormattingTests |
|
|
|
{ |
|
|
|
{ |
|
|
|
var adapter = new ReadOnlyDocument (input); |
|
|
|
var adapter = new ReadOnlyDocument (input); |
|
|
|
var visitor = new AstFormattingVisitor (policy, adapter, factory); |
|
|
|
var visitor = new AstFormattingVisitor (policy, adapter, factory); |
|
|
|
|
|
|
|
visitor.EolMarker = "\n"; |
|
|
|
var compilationUnit = new CSharpParser ().Parse (new StringReader (input), "test.cs"); |
|
|
|
var compilationUnit = new CSharpParser ().Parse (new StringReader (input), "test.cs"); |
|
|
|
compilationUnit.AcceptVisitor (visitor, null); |
|
|
|
compilationUnit.AcceptVisitor (visitor, null); |
|
|
|
|
|
|
|
|
|
|
|
@ -73,7 +73,7 @@ namespace ICSharpCode.NRefactory.FormattingTests |
|
|
|
protected static void Continue (CSharpFormattingOptions policy, IDocument document, string expectedOutput) |
|
|
|
protected static void Continue (CSharpFormattingOptions policy, IDocument document, string expectedOutput) |
|
|
|
{ |
|
|
|
{ |
|
|
|
var visitior = new AstFormattingVisitor (policy, document, factory); |
|
|
|
var visitior = new AstFormattingVisitor (policy, document, factory); |
|
|
|
|
|
|
|
visitior.EolMarker = "\n"; |
|
|
|
var compilationUnit = new CSharpParser ().Parse (new StringReader (document.Text), "test.cs"); |
|
|
|
var compilationUnit = new CSharpParser ().Parse (new StringReader (document.Text), "test.cs"); |
|
|
|
compilationUnit.AcceptVisitor (visitior, null); |
|
|
|
compilationUnit.AcceptVisitor (visitior, null); |
|
|
|
string newText = ApplyChanges (document.Text, visitior.Changes); |
|
|
|
string newText = ApplyChanges (document.Text, visitior.Changes); |
|
|
|
|