Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Commit

Permalink
chore: cede default type ownership and mark deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Aug 3, 2021
1 parent b9dd541 commit 20203f2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 59 deletions.
24 changes: 7 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
@@ -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%",
Expand All @@ -17,7 +17,8 @@
"ui"
],
"engines": {
"vscode": "^1.47.0"
"vscode": "^1.60.0-insider",
"node": ">=10"
},
"categories": [
"Debuggers"
Expand Down Expand Up @@ -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"
],
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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'"
}
]
},
Expand Down
6 changes: 2 additions & 4 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
}
37 changes: 3 additions & 34 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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());

Expand All @@ -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;
}
}
Expand All @@ -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]:/);
Expand Down
6 changes: 3 additions & 3 deletions test/int/adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -236,4 +236,4 @@ async function waitForUrl(dc: DebugClient, url: string): Promise<DebugProtocol.E
return url;
}, timeoutMs, intervalDelayMs).catch(err => { throw err; });

}
}
2 changes: 1 addition & 1 deletion test/int/testSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 20203f2

Please sign in to comment.