Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit ea0ef17

Browse files
committed
add upgrade notification
1 parent f39554d commit ea0ef17

1 file changed

Lines changed: 30 additions & 1 deletion

File tree

src/node/extension/configurationProvider.ts

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ export class NodeConfigurationProvider implements vscode.DebugConfigurationProvi
147147
// add the workspace folder for js-debug, if useV3 is set
148148
if (useV3()) {
149149
config.__workspaceFolder = folder ? '${workspaceFolder}' : config.cwd /* attempt fallback */;
150+
} else {
151+
annoyingDeprecationNotification();
150152
}
151153

152154
// everything ok: let VS Code start the debug session
@@ -469,8 +471,10 @@ async function determineDebugType(config: any, logger: Logger): Promise<string |
469471
}
470472
}
471473

474+
const v3Setting ='debug.javascript.usePreview';
475+
472476
function useV3() {
473-
return getWithoutDefault('debug.javascript.usePreview') ?? true;
477+
return getWithoutDefault(v3Setting) ?? true;
474478
}
475479

476480
function getWithoutDefault<T>(setting: string): T | undefined {
@@ -516,3 +520,28 @@ function parseVersionString(versionString) {
516520

517521
return { nvsFormat, remoteName, semanticVersion, arch };
518522
}
523+
524+
let hasShownDeprecation = false;
525+
526+
async function annoyingDeprecationNotification() {
527+
if (hasShownDeprecation) {
528+
return;
529+
}
530+
531+
const useNewDebugger = 'Upgrade';
532+
hasShownDeprecation = true;
533+
const result = await vscode.window.showWarningMessage("You're using an old Node.js debugger which will be deprecated soon. Please upgrade to our new debugger, and file issues if you run into any problems", useNewDebugger);
534+
535+
if (result !== useNewDebugger) {
536+
return;
537+
}
538+
539+
const config = vscode.workspace.getConfiguration();
540+
const inspect = config.inspect(v3Setting);
541+
if (inspect?.globalValue === false) {
542+
config.update(v3Setting, true, vscode.ConfigurationTarget.Global);
543+
}
544+
if (inspect?.workspaceValue === false) {
545+
config.update(v3Setting, true, vscode.ConfigurationTarget.Workspace);
546+
}
547+
}

0 commit comments

Comments
 (0)