C# 클래스 Microsoft.R.Core.Formatting.BraceHandler

Provides set of services for brace handling in formatting
파일 보기 프로젝트 열기: Microsoft/RTVS 1 사용 예제들

공개 메소드들

메소드 설명
BraceHandler ( TokenStream tokens, TextBuilder tb ) : System
GetCloseCurlyBraceIndentSize ( RToken closeCurlyBraceToken, TextBuilder tb, Microsoft.R.Core.Formatting.RFormatOptions options ) : int

Given closing curly brace tries to find keyword that is associated with the scope and calculate indentation based on the keyword line.

GetMatchingBraceToken ( RTokenType tokenType ) : RTokenType
GetOpenCurlyBraceIndentSize ( RToken openCurlyBraceToken, TextBuilder tb, Microsoft.R.Core.Formatting.RFormatOptions options ) : int

Given opening curly brace tries to find keyword that is associated with the scope and calculate indentation based on the keyword line.

HandleBrace ( ) : void
IsInArguments ( ) : bool

Tells if scope is opening inside function or indexer arguments and hence user indentation of curly braces must be respected.

비공개 메소드들

메소드 설명
AssociateKeywordPositionWithOpenBrace ( RToken openBrace, int keywordPosition ) : void

Associates keyword with the open brace. Used when formatter needs to determine indentation level of the new formatting scope when it encounters { token.

Closing curly indentation is defined by the line that either holds the opening curly brace or the line that holds keyword that defines the expression that the curly belongs to. Examples: x <- function(a) { } x <- function(a) { } First keyword is associated with the open brace, then, when brace pair closes, association is propagated to the closing brace and then to the opening curly. When curly pair closes formatter then finds appropriate indentation based on the line that contains the keyword token.

AssociateKeywordPositionWithToken ( RToken source, RToken target ) : void

Propagates keyword association to the target token. AssociateKeywordPositionWithOpenBrace

GetNearestNonWhitespaceIndex ( ) : int
TryPopMatchingBrace ( RToken token ) : RToken

메소드 상세

BraceHandler() 공개 메소드

public BraceHandler ( TokenStream tokens, TextBuilder tb ) : System
tokens TokenStream
tb Microsoft.Languages.Core.Formatting.TextBuilder
리턴 System

GetCloseCurlyBraceIndentSize() 공개 메소드

Given closing curly brace tries to find keyword that is associated with the scope and calculate indentation based on the keyword line.
public GetCloseCurlyBraceIndentSize ( RToken closeCurlyBraceToken, TextBuilder tb, Microsoft.R.Core.Formatting.RFormatOptions options ) : int
closeCurlyBraceToken RToken
tb Microsoft.Languages.Core.Formatting.TextBuilder
options Microsoft.R.Core.Formatting.RFormatOptions
리턴 int

GetMatchingBraceToken() 공개 정적인 메소드

public static GetMatchingBraceToken ( RTokenType tokenType ) : RTokenType
tokenType RTokenType
리턴 RTokenType

GetOpenCurlyBraceIndentSize() 공개 메소드

Given opening curly brace tries to find keyword that is associated with the scope and calculate indentation based on the keyword line.
public GetOpenCurlyBraceIndentSize ( RToken openCurlyBraceToken, TextBuilder tb, Microsoft.R.Core.Formatting.RFormatOptions options ) : int
openCurlyBraceToken RToken
tb Microsoft.Languages.Core.Formatting.TextBuilder
options Microsoft.R.Core.Formatting.RFormatOptions
리턴 int

HandleBrace() 공개 메소드

public HandleBrace ( ) : void
리턴 void

IsInArguments() 공개 메소드

Tells if scope is opening inside function or indexer arguments and hence user indentation of curly braces must be respected.
public IsInArguments ( ) : bool
리턴 bool