Microsoft.Languages.Core.Formatting.IndentBuilder.GetLineIndentSize C# (CSharp) Method

GetLineIndentSize() public static method

Determines indentation based on the leading whitespace in the current line.
public static GetLineIndentSize ( TextBuilder tb, int position, int tabSize ) : int
tb TextBuilder
position int
tabSize int
return int
        public static int GetLineIndentSize(TextBuilder tb, int position, int tabSize) {
            for (int i = position - 1; i >= 0; i--) {
                if (CharExtensions.IsLineBreak(tb.Text[i])) {
                    return TextIndentInSpaces(tb.Text.Substring(i + 1), tabSize);
                }
            }
            return 0;
        }
    }