int (@NotNull ChangeIndentContext context, int line) { int start = context.document.getLineStartOffset(line); int end = context.document.getLineEndOffset(line); int result = 0; CharSequence text = context.document.getCharsSequence(); for (int i = start; i < end; i++) { char c = text.charAt(i); switch (c) { case ' ' -> result++; case '\t' -> result += context.getIndentOptions().TAB_SIZE; default -> { return result; } } } return result; }