Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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};
}
private async fetchUriSettings(uri: string): Promise {
log('Start fetchUriSettings:', uri);
const folder = await this.findMatchingFolder(uri);
const folderSettings = await this.fetchSettingsForUri(folder.uri);
const spellSettings = CSpell.mergeSettings(this.defaultSettings, this.importedSettings(), folderSettings.settings);
const fileUri = Uri.parse(uri);
const fileSettings = CSpell.calcOverrideSettings(spellSettings, fileUri.fsPath);
log('Finish fetchUriSettings:', uri);
return fileSettings;
}