How to use the cspell-lib.readSettingsFiles function in cspell-lib

To help you get started, we’ve selected a few cspell-lib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github streetsidesoftware / cspell / packages / cspell / src / application.ts View on Github external
async function run(): Promise {

        header();

        const configFiles = (await globP(cfg.configGlob, cfg.configGlobOptions)).filter(util.uniqueFn());
        cfg.info(`Config Files Found:\n    ${configFiles.join('\n    ')}\n`, MessageTypes.Info);
        const config = cspell.readSettingsFiles(configFiles);
        const configInfo: ConfigInfo = { source: configFiles.join(' || '), config };
        // Get Exclusions from the config files.
        const { root } = cfg;
        const globOptions = { root, cwd: root };
        const exclusionGlobs = extractGlobExcludesFromConfig(root, configInfo.source, configInfo.config).concat(cfg.excludes);
        const files = filterFiles(await findFiles(cfg.files, globOptions), exclusionGlobs);

        return processFiles(fileLoader(files), configInfo);
    }
github streetsidesoftware / vscode-spell-checker / packages / _server / src / documentSettings.ts View on Github external
private resolveConfigImports(config: CSpellUserSettings, folderUri: string): CSpellUserSettings {
        const uriFsPath = Uri.parse(folderUri).fsPath;
        const imports = typeof config.import === 'string' ? [config.import] : config.import || [];
        if (!imports.length) {
            return config;
        }
        const importAbsPath = imports.map(file => path.resolve(file, uriFsPath));
        return CSpell.mergeSettings(CSpell.readSettingsFiles(importAbsPath), config);
    }
}
github streetsidesoftware / vscode-spell-checker / packages / _server / src / documentSettings.ts View on Github external
function readSettingsFiles(paths: string[]) {
    log(`readSettingsFiles:`, paths);
    const existingPaths = paths.filter(filename => fs.existsSync(filename));
    return CSpell.readSettingsFiles(existingPaths);
}
github streetsidesoftware / vscode-spell-checker / packages / _server / src / documentSettings.ts View on Github external
private _importSettings() {
        log(`importSettings`);
        const importPaths = [...this.configsToImport.keys()].sort();
        return CSpell.readSettingsFiles(importPaths);
    }
github streetsidesoftware / cspell / packages / cspell / src / application.ts View on Github external
    const pSettings = globP(configGlob, configGlobOptions).then(filenames => ({source: filenames[0], config: cspell.readSettingsFiles(filenames)}));
    const [foundSettings, text] = await Promise.all([pSettings, readFile(filename)]);