INNER CODE UNIT · TypeScript

getAllNamedTemplatesFromFiles

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

export function getAllNamedTemplatesFromFiles(filePath: string): Map<string, string> {
    const startPath = getChartBasePath(filePath) + path.sep + 'templates';
    const files: string[] = getAllFilesFromDirectoryRecursively(startPath);

    const templates = new Map<string, string>();
    for (const tplFile of files) {
        if (!fs.existsSync(tplFile)) {
            continue;
        }
        try {
            const tpls = getListOfNamedTemplates(fs.readFileSync(tplFile, 'utf8'));
            for (const tpl of tpls) {
                templates.set(tpl, tplFile);
            }
        } catch (e) {
            vscode.window.showErrorMessage(`Error in '${tplFile}': ${(e as Error).message}`);
        }
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…