How to use the cspell-glob.GlobMatcher function in cspell-glob

To help you get started, we’ve selected a few cspell-glob 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 / vscode-spell-checker / packages / _server / src / documentSettings.ts View on Github external
private async _fetchSettingsForFolderUri(uri: string): Promise {
        log(`fetchFolderSettings: URI ${uri}`);
        const cSpellConfigSettings = await this.fetchSettingsFromVSCode(uri);
        const cSpellFolderSettings = this.resolveConfigImports(cSpellConfigSettings, uri);
        const settings = this._cspellFileSettingsByFolderCache.get(uri);
        // cspell.json file settings take precedence over the vscode settings.
        const mergedSettings = CSpell.mergeSettings(cSpellFolderSettings, settings);
        const { ignorePaths = []} = mergedSettings;
        const globs = defaultExclude.concat(ignorePaths);
        const root = Uri.parse(uri).path;
        const globMatcher = new GlobMatcher(globs, root);

        const ext: ExtSettings = {
            uri,
            vscodeSettings: { cSpell: cSpellConfigSettings },
            settings: mergedSettings,
            globMatcher,
        };
        return ext;
    }
github streetsidesoftware / cspell / packages / cspell / src / application.ts View on Github external
function calcExcludeGlobInfo(root: string, commandLineExclude: string | undefined): GlobSrcInfo[] {
    const commandLineExcludes =  {
        globs: commandLineExclude ? commandLineExclude.split(/\s+/g) : [],
        source: 'arguments'
    };
    const defaultExcludes = {
        globs: defaultExcludeGlobs,
        source: 'default'
    };

    const choice = commandLineExcludes.globs.length ? commandLineExcludes : defaultExcludes;
    const matcher = new GlobMatcher(choice.globs, root);
    return [{
        matcher,
        source: choice.source
    }];
}
github streetsidesoftware / cspell / packages / cspell / src / application.ts View on Github external
function extractGlobExcludesFromConfig(root: string, source: string, config: cspell.CSpellUserSettings): GlobSrcInfo[] {
    if (!config.ignorePaths || !config.ignorePaths.length) {
        return [];
    }
    const matcher = new GlobMatcher(config.ignorePaths, root);
    return [{ source, matcher }];
}

cspell-glob

Glob matcher for cspell

MIT
Latest version published 15 days ago

Package Health Score

89 / 100
Full package analysis

Popular cspell-glob functions