C# Class ICSharpCode.NRefactory.CSharp.CSharpFormatter

The C# Formatter generates a set of text replace actions to format a region in a C# document.
Datei anzeigen Open project: 0xd4d/NRefactory Class Usage Examples

Public Methods

Method Description
AddFormattingRegion ( DomRegion region ) : void

Adds a region in the document that should be formatted.

AnalyzeFormatting ( IDocument document, SyntaxTree syntaxTree, CancellationToken token = default(CancellationToken) ) : FormattingChanges

Analyzes the formatting of a given document and syntax tree.

CSharpFormatter ( CSharpFormattingOptions policy, ICSharpCode.NRefactory.CSharp.TextEditorOptions options = null ) : System

Initializes a new instance of the ICSharpCode.NRefactory.CSharp.CSharpFormatter class.

Format ( IDocument document ) : string

Format the specified document and gives back the formatted text as result.

Format ( string text ) : string

Format the specified text and gives back the formatted text as result.

Private Methods

Method Description
InternalFormat ( IDocument document ) : string

Method Details

AddFormattingRegion() public method

Adds a region in the document that should be formatted.
public AddFormattingRegion ( DomRegion region ) : void
region DomRegion
return void

AnalyzeFormatting() public method

Analyzes the formatting of a given document and syntax tree.
public AnalyzeFormatting ( IDocument document, SyntaxTree syntaxTree, CancellationToken token = default(CancellationToken) ) : FormattingChanges
document IDocument Document.
syntaxTree SyntaxTree Syntax tree.
token System.Threading.CancellationToken The cancellation token.
return FormattingChanges

CSharpFormatter() public method

Initializes a new instance of the ICSharpCode.NRefactory.CSharp.CSharpFormatter class.
public CSharpFormatter ( CSharpFormattingOptions policy, ICSharpCode.NRefactory.CSharp.TextEditorOptions options = null ) : System
policy CSharpFormattingOptions The formatting policy to use.
options ICSharpCode.NRefactory.CSharp.TextEditorOptions The text editor options (optional). Default is: TextEditorOptions.Default
return System

Format() public method

Format the specified document and gives back the formatted text as result.
public Format ( IDocument document ) : string
document IDocument
return string

Format() public method

Format the specified text and gives back the formatted text as result.
public Format ( string text ) : string
text string
return string