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
예제 #1
0
        public FormattingScope(TextBuilder tb, TokenStream<RToken> tokens, int openBraceTokenIndex, RFormatOptions options, BraceHandler braceHandler) {
            Debug.Assert(tokens[openBraceTokenIndex].TokenType == RTokenType.OpenCurlyBrace);

            _options = options;
            _tb = tb;
            _previousIndentLevel = tb.IndentBuilder.IndentLevel;

            CloseCurlyBraceTokenIndex = FindMatchingCloseBrace(tokens, openBraceTokenIndex);

            StartingLineIndentSize = braceHandler.GetOpenCurlyBraceIndentSize(tokens[openBraceTokenIndex], tb, options);
            if (StartingLineIndentSize > 0) {
                tb.IndentBuilder.SetIndentLevelForSize(StartingLineIndentSize + _options.IndentSize);
            } else {
                tb.IndentBuilder.NewIndentLevel();
            }
        }
예제 #2
0
        public FormattingScope(TextBuilder tb, TokenStream <RToken> tokens, int openBraceTokenIndex, RFormatOptions options, BraceHandler braceHandler)
        {
            Debug.Assert(tokens[openBraceTokenIndex].TokenType == RTokenType.OpenCurlyBrace);

            _options             = options;
            _tb                  = tb;
            _previousIndentLevel = tb.IndentBuilder.IndentLevel;

            CloseCurlyBraceTokenIndex = FindMatchingCloseBrace(tokens, openBraceTokenIndex);

            StartingLineIndentSize = braceHandler.GetOpenCurlyBraceIndentSize(tokens[openBraceTokenIndex], tb, options);
            if (StartingLineIndentSize > 0)
            {
                tb.IndentBuilder.SetIndentLevelForSize(StartingLineIndentSize + _options.IndentSize);
            }
            else
            {
                tb.IndentBuilder.NewIndentLevel();
            }
        }