diff --git a/client/src/commands.ts b/client/src/commands.ts index 38227c67..3bf05fde 100644 --- a/client/src/commands.ts +++ b/client/src/commands.ts @@ -112,11 +112,16 @@ export function startLanguageServer( return; } - const env = { + const config = vscode.workspace.getConfiguration(EXTENSION_NS); + + const env: Record = { ...process.env, "DENO_V8_FLAGS": getV8Flags(), - "NO_COLOR": true, + "NO_COLOR": "1", }; + if (config.get("future")) { + env["DENO_FUTURE"] = "1"; + } const serverOptions: ServerOptions = { run: { @@ -345,6 +350,9 @@ export function test( if (cacheDir?.trim()) { env["DENO_DIR"] = cacheDir.trim(); } + if (config.get("future")) { + env["DENO_FUTURE"] = "1"; + } const nameRegex = `/^${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$/`; const args = ["test", ...testArgs, "--filter", nameRegex, path]; diff --git a/client/src/debug_config_provider.ts b/client/src/debug_config_provider.ts index 3564eb9a..61fdbdd9 100644 --- a/client/src/debug_config_provider.ts +++ b/client/src/debug_config_provider.ts @@ -9,9 +9,16 @@ export class DenoDebugConfigurationProvider #extensionContext: DenoExtensionContext; #getEnv() { - const cache = - this.#extensionContext.clientOptions.initializationOptions().cache; - return cache ? { "DENO_DIR": cache } : undefined; + const settings = this.#extensionContext.clientOptions + .initializationOptions(); + const env: Record = {}; + if (settings.cache) { + env["DENO_DIR"] = settings.cache; + } + if (settings.future) { + env["DENO_FUTURE"] = "1"; + } + return env; } #getAdditionalRuntimeArgs() { diff --git a/client/src/extension.ts b/client/src/extension.ts index ec05cdce..2d6f4384 100644 --- a/client/src/extension.ts +++ b/client/src/extension.ts @@ -44,6 +44,7 @@ function handleConfigurationChange(event: vscode.ConfigurationChangeEvent) { event.affectsConfiguration("deno.enable") || event.affectsConfiguration("deno.disablePaths") || event.affectsConfiguration("deno.enablePaths") || + event.affectsConfiguration("deno.future") || event.affectsConfiguration("deno.internalInspect") || event.affectsConfiguration("deno.logFile") || event.affectsConfiguration("deno.path") || diff --git a/client/src/upgrade.ts b/client/src/upgrade.ts index 19197e09..e45e4e80 100644 --- a/client/src/upgrade.ts +++ b/client/src/upgrade.ts @@ -36,6 +36,9 @@ export async function denoUpgradePromptAndExecute( if (cacheDir?.trim()) { env["DENO_DIR"] = cacheDir.trim(); } + if (config.get("future")) { + env["DENO_FUTURE"] = "1"; + } const definition: tasks.DenoTaskDefinition = { type: tasks.TASK_TYPE, command: "upgrade", diff --git a/package.json b/package.json index df358f85..21170bb3 100644 --- a/package.json +++ b/package.json @@ -323,6 +323,16 @@ 1000 ] }, + "deno.future": { + "type": "boolean", + "markdownDescription": "Enable breaking features likely to be shipped in Deno 2.0.", + "default": false, + "scope": "window", + "examples": [ + true, + false + ] + }, "deno.importMap": { "type": "string", "default": null,