private static int computeLeadingWhitespace(CharSequence line, boolean isLastLine) {
        for (int offset = 0; offset < line.length(); offset++) {
            if (line.charAt(offset) != ' ') {
                return offset;
            }
        }

        return isLastLine ? line.length() : -1;
    }
Computes the number of leading whitespace characters in a string.

<p>This method returns -1 if the string contains only whitespace. When determining the whitespace of the
last line, the length of the line is returned if the entire line consists of only spaces. This ensures that
the whitespace of the last line can be used to influence the indentation of the content as a whole
(a significant trailing line policy).

@param line Line to search for whitespace.
@param isLastLine Whether or not this is the last line.
@return Returns the last whitespace index starting at 0 or -1.
smithy-model/src/main/java/software/amazon/smithy/model/loader/IdlStringLexer.java