diff --git a/src/common/settings.ts b/src/common/settings.ts index 36ce8700..e62af274 100644 --- a/src/common/settings.ts +++ b/src/common/settings.ts @@ -196,8 +196,28 @@ function getOptionalGlobalValue(config: WorkspaceConfiguration, key: string): return inspect?.globalValue; } +/** + * Returns the global settings for the extension. + * + * ## Notes + * + * The global settings do not belong to a specific workspace. This means that + * variables such as `${workspaceFolder}` or `${workspaceFolder:...}` are not + * resolved. The language server does not support these variables, so they are + * filtered out. For example, if `configuration` has either of these variables, + * it will be set to `null`. + */ export async function getGlobalSettings(namespace: string): Promise { const config = getConfiguration(namespace); + + let configuration = getGlobalValue(config, "configuration", null); + if (typeof configuration === "string" && configuration.search(/\$\{workspaceFolder/) !== -1) { + logger.info( + `Resetting '${namespace}.configuration' to null in global settings because it contains workspace specific variables`, + ); + configuration = null; + } + return { nativeServer: getGlobalValue(config, "nativeServer", "auto"), cwd: process.cwd(), @@ -205,7 +225,7 @@ export async function getGlobalSettings(namespace: string): Promise { path: getGlobalValue(config, "path", []), ignoreStandardLibrary: getGlobalValue(config, "ignoreStandardLibrary", true), interpreter: [], - configuration: getGlobalValue(config, "configuration", null), + configuration, importStrategy: getGlobalValue(config, "importStrategy", "fromEnvironment"), codeAction: getGlobalValue(config, "codeAction", {}), lint: {