function _applyRenderWhitespace(lineContent, len, tokens, fauxIndentLength, tabSize, useMonospaceOptimizations, onlyBoundary) {
        var result = [], resultLen = 0;
        var tokenIndex = 0;
        var tokenType = tokens[tokenIndex].type;
        var tokenEndIndex = tokens[tokenIndex].endIndex;
        var firstNonWhitespaceIndex = strings.firstNonWhitespaceIndex(lineContent);
        var lastNonWhitespaceIndex;
        if (firstNonWhitespaceIndex === -1) {
            // The entire line is whitespace
            firstNonWhitespaceIndex = len;
            lastNonWhitespaceIndex = len;
        }
        else {
            lastNonWhitespaceIndex = strings.lastNonWhitespaceIndex(lineContent);
        }
        var tmpIndent = 0;
        for (var charIndex = 0; charIndex < fauxIndentLength; charIndex++) {
            var chCode = lineContent.charCodeAt(charIndex);
            if (chCode === 9 /* Tab */) {
                tmpIndent = tabSize;
            }
            else {
                tmpIndent++;
            }
        }
        tmpIndent = tmpIndent % tabSize;
        var wasInWhitespace = false;
        for (var charIndex = fauxIndentLength; charIndex < len; charIndex++) {
            var chCode = lineContent.charCodeAt(charIndex);
            var isInWhitespace = void 0;
            if (charIndex < firstNonWhitespaceIndex || charIndex > lastNonWhitespaceIndex) {
                // in leading or trailing whitespace
                isInWhitespace = true;
            }
            else if (chCode === 9 /* Tab */) {
                // a tab character is rendered both in all and boundary cases
                isInWhitespace = true;
            }
            else if (chCode === 32 /* Space */) {
                // hit a space character
                if (onlyBoundary) {
                    // rendering only boundary whitespace
                    if (wasInWhitespace) {
                        isInWhitespace = true;
                    }
                    else {
                        var nextChCode = (charIndex + 1 < len ? lineContent.charCodeAt(charIndex + 1) : 0 /* Null */);
                        isInWhitespace = (nextChCode === 32 /* Space */ || nextChCode === 9 /* Tab */);
                    }
                }
                else {
                    isInWhitespace = true;
                }
            }
            else {
                isInWhitespace = false;
            }
            if (wasInWhitespace) {
                // was in whitespace token
                if (!isInWhitespace || (!useMonospaceOptimizations && tmpIndent >= tabSize)) {
                    // leaving whitespace token or entering a new indent
                    result[resultLen++] = new LinePart(charIndex, 'vs-whitespace');
                    tmpIndent = tmpIndent % tabSize;
                }
            }
            else {
                // was in regular token
                if (charIndex === tokenEndIndex || (isInWhitespace && charIndex > fauxIndentLength)) {
                    result[resultLen++] = new LinePart(charIndex, tokenType);
                    tmpIndent = tmpIndent % tabSize;
                }
            }
            if (chCode === 9 /* Tab */) {
                tmpIndent = tabSize;
            }
            else {
                tmpIndent++;
            }
            wasInWhitespace = isInWhitespace;
            if (charIndex === tokenEndIndex) {
                tokenIndex++;
                tokenType = tokens[tokenIndex].type;
                tokenEndIndex = tokens[tokenIndex].endIndex;
            }
        }
        if (wasInWhitespace) {
            // was in whitespace token
            result[resultLen++] = new LinePart(len, 'vs-whitespace');
        }
        else {
            // was in regular token
            result[resultLen++] = new LinePart(len, tokenType);
        }
        return result;
    }
Whitespace is rendered by "replacing" tokens with a special-purpose `vs-whitespace` type that is later recognized in the rendering phase.
Moreover, a token is created for every visual indent because on some fonts the glyphs used for rendering whitespace (&rarr; or &middot;) do not have the same width as &nbsp;.
The rendering phase will generate `style="width:..."` for these tokens.