Browse Source

Added GetText function to AstNode.

newNRvisualizers
Mike Krüger 14 years ago
parent
commit
73e63ddca1
  1. 15
      ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs

15
ICSharpCode.NRefactory.CSharp/Ast/AstNode.cs

@ -642,6 +642,21 @@ namespace ICSharpCode.NRefactory.CSharp @@ -642,6 +642,21 @@ namespace ICSharpCode.NRefactory.CSharp
}
}
/// <summary>
/// Gets the node as formatted C# output.
/// </summary>
/// <param name='formattingOptions'>
/// Formatting options.
/// </param>
public string GetText (CSharpFormattingOptions formattingOptions = null)
{
if (IsNull)
return "";
var w = new StringWriter ();
AcceptVisitor (new CSharpOutputVisitor (w, formattingOptions ?? new CSharpFormattingOptions ()), null);
return w.ToString ();
}
public bool Contains (int line, int column)
{
return Contains (new TextLocation (line, column));

Loading…
Cancel
Save