C# Class Microsoft.R.Editor.SmartIndent.SmartIndenter

Provides block and smart indentation in R code
Inheritance: ISmartIndent
Show file Open project: Microsoft/RTVS Class Usage Examples

Public Methods

Method Description
Attach ( ITextView textView ) : SmartIndenter
Dispose ( ) : void
GetBlockIndent ( ITextSnapshotLine line ) : int
GetDesiredIndentation ( ITextSnapshotLine line ) : int?
GetDesiredIndentation ( ITextSnapshotLine line, IndentStyle indentStyle ) : int?
GetSmartIndent ( ITextSnapshotLine line, AstRoot ast = null, int originalIndentSizeInSpaces = -1, bool formatting = false ) : int

Determines level of indentation in the line from AST and surrounding context. Called when user hits ENTER and editor needs to know level of indentation in the new line as well as when code is being auto-formatted and range formatter needs to know how to indent freshly formatted lines of code.

InnerIndentSizeFromLine ( ITextSnapshotLine line, Microsoft.R.Core.Formatting.RFormatOptions options ) : int
InnerIndentSizeFromNode ( ITextBuffer textBuffer, IAstNode node, Microsoft.R.Core.Formatting.RFormatOptions options ) : int
OuterIndentSizeFromLine ( ITextSnapshotLine line, Microsoft.R.Core.Formatting.RFormatOptions options ) : int
OuterIndentSizeFromNode ( ITextBuffer textBuffer, IAstNode node, Microsoft.R.Core.Formatting.RFormatOptions options ) : int

Private Methods

Method Description
GetFirstArgumentIndent ( ITextSnapshot snapshot, IFunction fc ) : int
SmartIndenter ( ITextView textView ) : System

Method Details

Attach() public static method

public static Attach ( ITextView textView ) : SmartIndenter
textView ITextView
return SmartIndenter

Dispose() public method

public Dispose ( ) : void
return void

GetBlockIndent() public static method

public static GetBlockIndent ( ITextSnapshotLine line ) : int
line ITextSnapshotLine
return int

GetDesiredIndentation() public method

public GetDesiredIndentation ( ITextSnapshotLine line ) : int?
line ITextSnapshotLine
return int?

GetDesiredIndentation() public method

public GetDesiredIndentation ( ITextSnapshotLine line, IndentStyle indentStyle ) : int?
line ITextSnapshotLine
indentStyle IndentStyle
return int?

GetSmartIndent() public static method

Determines level of indentation in the line from AST and surrounding context. Called when user hits ENTER and editor needs to know level of indentation in the new line as well as when code is being auto-formatted and range formatter needs to know how to indent freshly formatted lines of code.
public static GetSmartIndent ( ITextSnapshotLine line, AstRoot ast = null, int originalIndentSizeInSpaces = -1, bool formatting = false ) : int
line ITextSnapshotLine Line to find the indent for
ast Microsoft.R.Core.AST.AstRoot Optional AST
originalIndentSizeInSpaces int
formatting bool /// Indicates if current call is from formatter or /// from the core editor for indentation when user typed Enter. ///
return int

InnerIndentSizeFromLine() public static method

public static InnerIndentSizeFromLine ( ITextSnapshotLine line, Microsoft.R.Core.Formatting.RFormatOptions options ) : int
line ITextSnapshotLine
options Microsoft.R.Core.Formatting.RFormatOptions
return int

InnerIndentSizeFromNode() public static method

public static InnerIndentSizeFromNode ( ITextBuffer textBuffer, IAstNode node, Microsoft.R.Core.Formatting.RFormatOptions options ) : int
textBuffer ITextBuffer
node IAstNode
options Microsoft.R.Core.Formatting.RFormatOptions
return int

OuterIndentSizeFromLine() public static method

public static OuterIndentSizeFromLine ( ITextSnapshotLine line, Microsoft.R.Core.Formatting.RFormatOptions options ) : int
line ITextSnapshotLine
options Microsoft.R.Core.Formatting.RFormatOptions
return int

OuterIndentSizeFromNode() public static method

public static OuterIndentSizeFromNode ( ITextBuffer textBuffer, IAstNode node, Microsoft.R.Core.Formatting.RFormatOptions options ) : int
textBuffer ITextBuffer
node IAstNode
options Microsoft.R.Core.Formatting.RFormatOptions
return int