INNER CODE UNIT · TypeScript

isBracketsInPrefix

tim-koehler/Helm-Intellisense · src/utils.ts:19

function isBracketsInPrefix(prefix: string): boolean {
    let prevChar = '';
    for (let index = prefix.length - 1; index >= 0; index--) {
        if (prefix.charAt(index) === '}') {
            return false;
        }
        if (prefix.charAt(index) === '{' && prevChar === '{') {
            return true;
        }
        prevChar = prefix.charAt(index);
    }
    return false;
}

/**
 * Retrieves the word at and around the position. A word is considered to be
 * the sequence of characters from the last and to the next whitespace.
 */

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…