How to use the cspell-lib.constructSettingsForText 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
function calcFinalConfigInfo(
    configInfo: ConfigInfo,
    settingsFromCommandLine: cspell.CSpellUserSettings,
    filename: string,
    text: string
): FileConfigInfo {
    const ext = path.extname(filename);
    const fileSettings = cspell.calcOverrideSettings(configInfo.config, path.resolve(filename));
    const settings = cspell.mergeSettings(cspell.getDefaultSettings(), cspell.getGlobalSettings(), fileSettings, settingsFromCommandLine);
    const languageIds = settings.languageId ? [settings.languageId] : cspell.getLanguagesForExt(ext);
    const config = cspell.constructSettingsForText(settings, text, languageIds);
    return {configInfo: {...configInfo, config}, filename, text, languageIds};
}
github streetsidesoftware / vscode-spell-checker / packages / _server / src / codeActions.ts View on Github external
async function constructSettings(doc: TextDocument): Promise {
        const settings = cspell.constructSettingsForText(await fnSettings(doc), doc.getText(), doc.languageId);
        const dictionary = await cspell.getDictionary(settings);
        return  { settings, dictionary };
    }