Skip to content

Commit

Permalink
feat: add "deno.future" setting (#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
nayeemrmn authored Apr 3, 2024
1 parent b96858e commit 22cfa4e
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 5 deletions.
12 changes: 10 additions & 2 deletions client/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,16 @@ export function startLanguageServer(
return;
}

const env = {
const config = vscode.workspace.getConfiguration(EXTENSION_NS);

const env: Record<string, string> = {
...process.env,
"DENO_V8_FLAGS": getV8Flags(),
"NO_COLOR": true,
"NO_COLOR": "1",
};
if (config.get<boolean>("future")) {
env["DENO_FUTURE"] = "1";
}

const serverOptions: ServerOptions = {
run: {
Expand Down Expand Up @@ -345,6 +350,9 @@ export function test(
if (cacheDir?.trim()) {
env["DENO_DIR"] = cacheDir.trim();
}
if (config.get<boolean>("future")) {
env["DENO_FUTURE"] = "1";
}
const nameRegex = `/^${name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}$/`;
const args = ["test", ...testArgs, "--filter", nameRegex, path];

Expand Down
13 changes: 10 additions & 3 deletions client/src/debug_config_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> = {};
if (settings.cache) {
env["DENO_DIR"] = settings.cache;
}
if (settings.future) {
env["DENO_FUTURE"] = "1";
}
return env;
}

#getAdditionalRuntimeArgs() {
Expand Down
1 change: 1 addition & 0 deletions client/src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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") ||
Expand Down
3 changes: 3 additions & 0 deletions client/src/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ export async function denoUpgradePromptAndExecute(
if (cacheDir?.trim()) {
env["DENO_DIR"] = cacheDir.trim();
}
if (config.get<boolean>("future")) {
env["DENO_FUTURE"] = "1";
}
const definition: tasks.DenoTaskDefinition = {
type: tasks.TASK_TYPE,
command: "upgrade",
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 22cfa4e

Please sign in to comment.