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 13:09:10 -07:00
Родитель b9dd541193
Коммит 20203f217e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: CF8FD2EA0DBC61BD
5 изменённых файлов: 16 добавлений и 59 удалений

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

@ -1,6 +1,6 @@
{
"name": "debugger-for-chrome",
"displayName": "Debugger for Chrome",
"displayName": "[Deprecated] Debugger for Chrome",
"version": "4.12.12",
"icon": "images/icon.png",
"description": "%extension.description%",
@ -17,7 +17,8 @@
"ui"
],
"engines": {
"vscode": "^1.47.0"
"vscode": "^1.60.0-insider",
"node": ">=10"
},
"categories": [
"Debuggers"
@ -77,8 +78,7 @@
},
"main": "./out/src/extension",
"activationEvents": [
"onDebugInitialConfigurations",
"onDebugResolve:chrome",
"onDebugResolve:legacy-chrome",
"onCommand:extension.chrome-debug.toggleSkippingFile",
"onCommand:extension.chrome-debug.toggleSmartStep"
],
@ -113,19 +113,9 @@
"language": "fsharp"
}
],
"configuration": {
"properties": {
"debug.chrome.useV3": {
"type": "boolean",
"description": "%debug.chrome.useV3.description%",
"deprecationMessage": "%debug.chrome.useV3.deprecated%",
"default": true
}
}
},
"debuggers": [
{
"type": "chrome",
"type": "legacy-chrome",
"label": "Chrome (legacy)",
"program": "./out/src/chromeDebug.js",
"runtime": "node",
@ -444,12 +434,12 @@
{
"command": "extension.chrome-debug.toggleSkippingFile",
"group": "navigation",
"when": "inDebugMode && debugType == 'chrome' && callStackItemType == 'stackFrame'"
"when": "inDebugMode && debugType == 'legacy-chrome' && callStackItemType == 'stackFrame'"
},
{
"command": "extension.chrome-debug.toggleSmartStep",
"group": "navigation",
"when": "inDebugMode && debugType == 'chrome' && callStackItemType == 'stackFrame'"
"when": "inDebugMode && debugType == 'legacy-chrome' && callStackItemType == 'stackFrame'"
}
]
},

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

@ -30,7 +30,5 @@
"chrome.breakOnLoad.description": "Experimental feature - If true, the debug adapter will attempt to set breakpoints in scripts before they are loaded, so it can hit breakpoints at the beginnings of those scripts. Has a perf impact.",
"chrome.breakOnLoadStrategy.description": "The strategy to use for breakOnLoad.",
"chrome.breakOnLoadStrategy.instrument.description": "Tell Chrome to pause as each script is loaded, resolving sourcemaps and setting breakpoints",
"chrome.breakOnLoadStrategy.regex.description": "Sets breakpoints optimistically in files with the same name as the file in which the breakpoint is set.",
"debug.chrome.useV3.description": "Controls whether to delegate \"chrome\"-type launch configs to the js-debug extension.",
"debug.chrome.useV3.deprecated": "This setting is deprecated - please use `debug.javascript.usePreview` instead"
}
"chrome.breakOnLoadStrategy.regex.description": "Sets breakpoints optimistically in files with the same name as the file in which the breakpoint is set."
}

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

@ -11,31 +11,17 @@ import { defaultTargetFilter, getTargetFilter } from './utils';
const localize = nls.loadMessageBundle();
const DEBUG_SETTINGS = 'debug.chrome';
export function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(vscode.commands.registerCommand('extension.chrome-debug.toggleSkippingFile', toggleSkippingFile));
context.subscriptions.push(vscode.commands.registerCommand('extension.chrome-debug.toggleSmartStep', toggleSmartStep));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('chrome', new ChromeConfigurationProvider()));
context.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('legacy-chrome', new ChromeConfigurationProvider()));
}
export function deactivate() {
}
const DEFAULT_CONFIG = {
type: 'chrome',
request: 'launch',
name: localize('chrome.launch.name', 'Launch Chrome against localhost'),
url: 'http://localhost:8080',
webRoot: '${workspaceFolder}'
};
export class ChromeConfigurationProvider implements vscode.DebugConfigurationProvider {
provideDebugConfigurations(folder: vscode.WorkspaceFolder | undefined, token?: vscode.CancellationToken): vscode.ProviderResult<vscode.DebugConfiguration[]> {
return Promise.resolve([DEFAULT_CONFIG]);
}
/**
* Try to add all missing attributes to the debug configuration being launched.
*/
@ -47,8 +33,7 @@ export class ChromeConfigurationProvider implements vscode.DebugConfigurationPro
return null;
}
const v3 = useV3();
if (config.request === 'attach' && !v3) {
if (config.request === 'attach') {
const discovery = new Core.chromeTargetDiscoveryStrategy.ChromeTargetDiscovery(
new Core.NullLogger(), new Core.telemetry.NullTelemetryReporter());
@ -70,14 +55,7 @@ export class ChromeConfigurationProvider implements vscode.DebugConfigurationPro
}
}
if (v3) {
folder = folder || (vscode.workspace.workspaceFolders ? vscode.workspace.workspaceFolders[0] : undefined);
config['__workspaceFolder'] = folder?.uri.fsPath;
config.type = 'pwa-chrome';
} else {
resolveRemoteUris(folder, config);
}
resolveRemoteUris(folder, config);
return config;
}
}
@ -94,15 +72,6 @@ function getFsPath(uri: vscode.Uri): string {
fsPath;
}
function useV3() {
return getWithoutDefault('debug.chrome.useV3') ?? getWithoutDefault('debug.javascript.usePreview') ?? true;
}
function getWithoutDefault<T>(setting: string): T | undefined {
const info = vscode.workspace.getConfiguration().inspect<T>(setting);
return info?.workspaceValue ?? info?.globalValue;
}
function mapRemoteClientUriToInternalPath(remoteUri: vscode.Uri): string {
const uriPath = getFsPath(remoteUri);
const driveLetterMatch = uriPath.match(/^[A-Za-z]:/);

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

@ -128,7 +128,7 @@ suite('Chrome Debug Adapter etc', () => {
const DEBUGGER_LINE = 2;
await dc.initializeRequest({
adapterID: 'chrome',
adapterID: 'legacy-chrome',
clientID: 'visualstudio',
linesStartAt1: true,
columnsStartAt1: true,
@ -146,7 +146,7 @@ suite('Chrome Debug Adapter etc', () => {
const DEBUGGER_LINE = 2;
await dc.initializeRequest({
adapterID: 'chrome',
adapterID: 'legacy-chrome',
clientID: 'visualstudio',
linesStartAt1: true,
columnsStartAt1: true,
@ -236,4 +236,4 @@ async function waitForUrl(dc: DebugClient, url: string): Promise<DebugProtocol.E
return url;
}, timeoutMs, intervalDelayMs).catch(err => { throw err; });
}
}

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

@ -88,7 +88,7 @@ export async function setupWithTitle(testTitle: string, port?: number, launchPro
testLaunchProps = launchProps;
}
const debugClient = await ts.setup({ entryPoint: DEBUG_ADAPTER, type: 'chrome', patchLaunchArgs: args => patchLaunchArgs(args, testTitle), port: port });
const debugClient = await ts.setup({ entryPoint: DEBUG_ADAPTER, type: 'legacy-chrome', patchLaunchArgs: args => patchLaunchArgs(args, testTitle), port: port });
debugClient.defaultTimeout = DefaultTimeoutMultiplier * 10000 /*10 seconds*/;
if (isThisV2) { // The logging proxy breaks lots of tests in v1, possibly due to some race conditions exposed by the extra delay