chore: cede default type ownership and mark deprecated

For https://github.com/microsoft/vscode-js-debug/issues/1065
This commit is contained in:
Connor Peet 2021-08-03 12:42:46 -07:00
Родитель f57a5cb107
Коммит 691214becb
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CF8FD2EA0DBC61BD
7 изменённых файлов: 17 добавлений и 84 удалений

Просмотреть файл

@ -1,6 +1,6 @@
{
"name": "node-debug2",
"displayName": "Node Debug",
"displayName": "[Deprecated] Node Debug",
"version": "1.42.10",
"publisher": "ms-vscode",
"description": "%extension.description%",
@ -51,8 +51,8 @@
},
"main": "./out/src/extension",
"activationEvents": [
"onDebug:extensionHost",
"onDebugResolve:extensionHost",
"onDebug:legacy-extensionHost",
"onDebugResolve:legacy-extensionHost",
"onCommand:extension.node-debug2.toggleSkippingFile"
],
"scripts": {
@ -67,8 +67,8 @@
"package": "gulp package"
},
"engines": {
"vscode": "^1.47.0",
"node": ">=6.3.0"
"vscode": "^1.60.0-insider",
"node": ">=10"
},
"repository": {
"type": "git",
@ -88,30 +88,11 @@
],
"debuggers": [
{
"type": "extensionHost",
"type": "legacy-extensionHost",
"label": "VS Code Extension Development",
"program": "./out/src/nodeDebug.js",
"runtime": "node",
"aiKey": "AIF-d9b70cd4-b9f9-4d70-929b-a071c400b217",
"configurationSnippets": [
{
"label": "%extensionHost.snippet.launch.label%",
"description": "%extensionHost.snippet.launch.description%",
"body": {
"type": "extensionHost",
"request": "launch",
"name": "%extensionHost.launch.config.name%",
"runtimeExecutable": "^\"\\${execPath}\"",
"args": [
"^\"--extensionDevelopmentPath=\\${workspaceFolder}\""
],
"outFiles": [
"^\"\\${workspaceFolder}/out/**/*.js\""
],
"preLaunchTask": "npm"
}
}
],
"configurationAttributes": {
"launch": {
"required": [
@ -206,7 +187,7 @@
}
},
{
"type": "node2",
"type": "legacy-node2",
"label": "Node.js v6.3+",
"program": "./out/src/nodeDebug.js",
"runtime": "node",

Просмотреть файл

@ -7,7 +7,7 @@ import * as Core from 'vscode-chrome-debug-core';
export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerCommand('extension.node-debug2.toggleSkippingFile', toggleSkippingFile));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('extensionHost', new ExtensionHostDebugConfigurationProvider()));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('legacy-extensionHost', new ExtensionHostDebugConfigurationProvider()));
}
export function deactivate() {
@ -28,54 +28,6 @@ function toggleSkippingFile(path: string | number): void {
class ExtensionHostDebugConfigurationProvider implements vscode.DebugConfigurationProvider {
resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, debugConfiguration: vscode.DebugConfiguration): vscode.ProviderResult<vscode.DebugConfiguration> {
if (useV3()) {
folder = folder || (vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0] : undefined);
debugConfiguration['__workspaceFolder'] = folder?.uri.fsPath;
debugConfiguration.type = 'pwa-extensionHost';
} else {
annoyingDeprecationNotification();
}
return debugConfiguration;
}
}
const v3Setting = 'debug.javascript.usePreview';
function useV3() {
return getWithoutDefault(v3Setting) ?? true;
}
function getWithoutDefault<T>(setting: string): T | undefined {
const info = vscode.workspace.getConfiguration().inspect<T>(setting);
return info?.workspaceValue ?? info?.globalValue;
}
let hasShownDeprecation = false;
async function annoyingDeprecationNotification() {
if (hasShownDeprecation) {
return;
}
const useNewDebugger = 'Upgrade';
hasShownDeprecation = true;
const inspect = vscode.workspace.getConfiguration().inspect(v3Setting);
const isWorkspace = inspect?.workspaceValue === false;
const result = await vscode.window.showWarningMessage(
`You're using a ${isWorkspace ? 'workspace' : 'user'} setting to use VS Code's legacy Node.js debugger, which will be removed soon. Please update your settings using the "Upgrade" button to use our modern debugger.`,
useNewDebugger,
);
if (result !== useNewDebugger) {
return;
}
const config = vscode.workspace.getConfiguration();
if (inspect?.globalValue === false) {
config.update(v3Setting, true, vscode.ConfigurationTarget.Global);
}
if (inspect?.workspaceValue === false) {
config.update(v3Setting, true, vscode.ConfigurationTarget.Workspace);
}
}

Просмотреть файл

@ -901,7 +901,7 @@ export class NodeDebugAdapter extends ChromeDebugAdapter {
}
private isExtensionHost(): boolean {
return this._adapterID === 'extensionHost2' || this._adapterID === 'extensionHost';
return this._adapterID === 'extensionHost2' || this._adapterID === 'legacy-extensionHost';
}
}

Просмотреть файл

@ -36,7 +36,7 @@ async function patchLaunchArgs(launchArgs: any): Promise<void> {
export function setup(_opts?: { port?: number, alwaysDumpLogs?: boolean }) {
const opts = Object.assign(<ts.ISetupOpts>{
entryPoint: './out/src/nodeDebug.js',
type: 'node2',
type: 'legacy-node2',
patchLaunchArgs
}, _opts);
@ -49,4 +49,4 @@ export function teardown() {
export const lowercaseDriveLetterDirname = __dirname.charAt(0).toLowerCase() + __dirname.substr(1);
export const PROJECT_ROOT = path.join(lowercaseDriveLetterDirname, '../../');
export const DATA_ROOT = path.join(PROJECT_ROOT, 'testdata/');
export const DATA_ROOT = path.join(PROJECT_ROOT, 'testdata/');

Просмотреть файл

@ -6,7 +6,7 @@
"configurations": [
{
"name": "Launch Program",
"type": "node2",
"type": "legacy-node2",
"request": "launch",
"program": "${workspaceFolder}/out/bundle.js",
"cwd": "${workspaceFolder}",
@ -14,4 +14,4 @@
"sourceMaps": true
}
]
}
}

Просмотреть файл

@ -2,7 +2,7 @@
"version": "0.2.0",
"configurations": [
{
"type": "node2",
"type": "legacy-node2",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/src/sourceA.ts",
@ -12,4 +12,4 @@
"cwd": "${workspaceFolder}"
}
]
}
}

4
testdata/webpack/.vscode/launch.json поставляемый
Просмотреть файл

@ -6,7 +6,7 @@
"configurations": [
{
"name": "Launch Program",
"type": "node2",
"type": "legacy-node2",
"request": "launch",
"program": "${workspaceFolder}/out/bundle.js",
"cwd": "${workspaceFolder}",
@ -14,4 +14,4 @@
"sourceMaps": true
}
]
}
}