Skip to content

Commit bb134aa

Browse files
committed
chore: take ownership of the default launch types
For #1065
1 parent beae729 commit bb134aa

13 files changed

+94
-172
lines changed

.vscode/launch.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
},
5454
{
5555
"name": "Extension",
56-
"type": "extensionHost",
56+
"type": "pwa-extensionHost",
5757
"request": "launch",
5858
"skipFiles": [
5959
"<node_internals>/**"
@@ -173,4 +173,4 @@
173173
]
174174
}
175175
]
176-
}
176+
}

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,11 @@
22

33
This changelog records changes to stable releases since 1.50.2. "TBA" changes here may be available in the [nightly release](https://github.com/microsoft/vscode-js-debug/#nightly-extension) before they're in stable. Note that the minor version (`v1.X.0`) corresponds to the VS Code version js-debug is shipped in, but the patch version (`v1.50.X`) is not meaningful.
44

5-
## Nightly
5+
## v1.60 (August 2021)
66

7+
### v1.60.0 - 2021-08-03
8+
9+
- chore: take ownership of the default launch types ([#1065](https://github.com/microsoft/vscode-js-debug/issues/1065))
710
- fix: apply electron updates for debugging vscode webviews ([ref](https://github.com/microsoft/vscode/issues/128637))
811

912
## v1.59 (July 2021)

COMMON_PROBLEMS.md

-16
Original file line numberDiff line numberDiff line change
@@ -41,19 +41,3 @@ You launch your app, but the debugger doesn't connect to it. You're using an old
4141
### Solution
4242

4343
We've seen some transient issues with early Node 10 point releases. To fix this we, recommend updating to a later Node 10 release (10.22.1 being the most recent at the time of writing), or to a newer version of Node altogether if nothing is keeping you on 10.
44-
45-
## My configuration property shows as invalid
46-
47-
### Symptoms
48-
49-
You're adding a configuration property to your launch.json, but it shows an invalid, even if it works.
50-
51-
### Solution
52-
53-
This can happen for newly introduced options. To fix this, you should prefix your launch type with `pwa-`, for example:
54-
55-
- `node` -> `pwa-node`
56-
- `chrome` -> `pwa-chrome`
57-
- `extensionHost` -> `pwa-extensionHost`
58-
59-
This is needed because the old configuration types are still "owned" by the old debuggers, and just redirect to this new debugger. While most additional options will be blindly passed along, they don't appear the old schemas and some may not work.

gulpfile.js

+1-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const gulp = require('gulp');
88
const minimist = require('minimist');
99
const nls = require('vscode-nls-dev');
1010
const path = require('path');
11-
const replace = require('gulp-replace');
1211
const sourcemaps = require('gulp-sourcemaps');
1312
const tsb = require('gulp-tsb');
1413
const rename = require('gulp-rename');
@@ -39,13 +38,6 @@ const distDir = 'dist';
3938
const distSrcDir = `${distDir}/src`;
4039
const nodeTargetsDir = `targets/node`;
4140

42-
/**
43-
* If --drop-in is set, commands and debug types will be set to 'chrome' and
44-
* 'node', rendering them incompatible with the base debuggers. Useful
45-
* to only set this to true to publish, and develop as namespaced extensions.
46-
*/
47-
const namespace = process.argv.includes('--drop-in') ? '' : 'pwa-';
48-
4941
/**
5042
* Whether we're running a nightly build.
5143
*/
@@ -86,7 +78,6 @@ async function readJson(file) {
8678
return JSON.parse(contents);
8779
}
8880

89-
const replaceNamespace = () => replace(/NAMESPACE\((.*?)\)/g, `${namespace}$1`);
9081
const tsProject = tsb.create('./tsconfig.json');
9182

9283
gulp.task('clean-assertions', () => del(['src/test/**/*.txt.actual']));
@@ -99,7 +90,6 @@ gulp.task('compile:ts', () =>
9990
tsProject
10091
.src()
10192
.pipe(sourcemaps.init())
102-
.pipe(replaceNamespace())
10393
.pipe(tsProject())
10494
.pipe(
10595
sourcemaps.write('.', {
@@ -162,7 +152,7 @@ gulp.task('compile:dynamic', async () => {
162152

163153
gulp.task('compile:static', () =>
164154
merge(
165-
gulp.src(['LICENSE', 'package.json']).pipe(replaceNamespace()),
155+
gulp.src(['LICENSE', 'package.json']),
166156
gulp.src(['resources/**/*', 'README.md', 'src/**/*.sh'], { base: '.' }),
167157
).pipe(gulp.dest(buildDir)),
168158
);

package-lock.json

-80
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"description": "An extension for debugging Node.js programs and Chrome.",
1717
"license": "MIT",
1818
"engines": {
19-
"vscode": "^1.58.0-insider",
19+
"vscode": "^1.60.0-insider",
2020
"node": ">=10"
2121
},
2222
"icon": "resources/logo.png",
@@ -136,7 +136,6 @@
136136
"gulp": "^4.0.2",
137137
"gulp-filter": "^7.0.0",
138138
"gulp-rename": "^2.0.0",
139-
"gulp-replace": "^1.1.3",
140139
"gulp-sourcemaps": "^3.0.0",
141140
"gulp-tsb": "^4.0.6",
142141
"gulp-util": "^3.0.8",
@@ -184,7 +183,7 @@
184183
{
185184
"id": "jsBrowserBreakpoints",
186185
"name": "Browser breakpoints",
187-
"when": "debugConfigurationType == 'NAMESPACE(chrome)'"
186+
"when": "debugConfigurationType == 'pwa-chrome'"
188187
}
189188
]
190189
},

src/build/generate-contributions.ts

+39-25
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
Contributions,
1212
DebugType,
1313
IConfigurationTypes,
14+
preferredDebugTypes,
1415
} from '../common/contributionUtils';
1516
import { knownToolToken } from '../common/knownTools';
1617
import { mapValues, sortKeys, walkObject } from '../common/objUtils';
@@ -1038,39 +1039,50 @@ export const debuggers = [
10381039
function buildDebuggers() {
10391040
// eslint-disable-next-line
10401041
const output: any[] = [];
1041-
for (const d of debuggers) {
1042-
let entry = output.find(o => o.type === d.type);
1043-
if (!entry) {
1044-
// eslint-disable-next-line
1045-
const { request, configurationAttributes, required, defaults, ...rest } = d;
1046-
entry = {
1047-
...rest,
1048-
aiKey: appInsightsKey,
1049-
configurationAttributes: {},
1050-
configurationSnippets: [],
1051-
};
1052-
output.push(entry);
1042+
const ensureEntryForType = (type: string, d: typeof debuggers[0]) => {
1043+
let entry = output.find(o => o.type === type);
1044+
if (entry) {
1045+
return entry;
10531046
}
10541047

1055-
entry.configurationSnippets.push(...d.configurationSnippets);
1056-
entry.configurationAttributes[d.request] = {
1057-
required: d.required,
1058-
properties: mapValues(
1059-
d.configurationAttributes as { [key: string]: DescribedAttribute<unknown> },
1060-
({ docDefault: _, ...attrs }) => attrs,
1061-
),
1048+
// eslint-disable-next-line
1049+
const { request, configurationAttributes, required, defaults, ...rest } = d;
1050+
entry = {
1051+
...rest,
1052+
type,
1053+
aiKey: appInsightsKey,
1054+
configurationAttributes: {},
1055+
configurationSnippets: [],
10621056
};
1057+
output.push(entry);
1058+
return entry;
1059+
};
1060+
1061+
for (const d of debuggers) {
1062+
const primary = ensureEntryForType(d.type, d);
1063+
const entries = [primary];
1064+
const preferred = preferredDebugTypes.get(d.type);
1065+
if (preferred) {
1066+
entries.unshift(ensureEntryForType(preferred, d));
1067+
}
1068+
1069+
entries[0].configurationSnippets.push(...d.configurationSnippets);
1070+
1071+
for (const entry of entries) {
1072+
entry.configurationAttributes[d.request] = {
1073+
required: d.required,
1074+
properties: mapValues(
1075+
d.configurationAttributes as { [key: string]: DescribedAttribute<unknown> },
1076+
({ docDefault: _, ...attrs }) => attrs,
1077+
),
1078+
};
1079+
}
10631080
}
10641081

10651082
return walkObject(output, sortKeys);
10661083
}
10671084

10681085
const configurationSchema: ConfigurationAttributes<IConfigurationTypes> = {
1069-
[Configuration.UsePreviewDebugger]: {
1070-
type: 'boolean',
1071-
default: true,
1072-
description: refString('configuration.usePreview'),
1073-
},
10741086
[Configuration.NpmScriptLens]: {
10751087
enum: ['top', 'all', 'never'],
10761088
default: 'top',
@@ -1408,7 +1420,9 @@ if (require.main === module) {
14081420
},
14091421
activationEvents: [
14101422
...[...allCommands].map(cmd => `onCommand:${cmd}`),
1411-
...debuggers.map(dbg => `onDebugResolve:${dbg.type}`),
1423+
...[...debuggers.map(dbg => dbg.type), ...preferredDebugTypes.keys()].map(
1424+
t => `onDebugResolve:${t}`,
1425+
),
14121426
`onWebviewPanel:${Contributions.DiagnosticsView}`,
14131427
],
14141428
contributes: {

src/build/strings.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,6 @@ const strings = {
275275
'Where a "Run" and "Debug" code lens should be shown in your npm scripts. It may be on "all", scripts, on "top" of the script section, or "never".',
276276
'configuration.terminalOptions':
277277
'Default launch options for the JavaScript debug terminal and npm scripts.',
278-
'configuration.usePreview': 'Use the new in-preview JavaScript debugger for Node.js and Chrome.',
279278
'configuration.suggestPrettyPrinting':
280279
'Whether to suggest pretty printing JavaScript code that looks minified when you step into it.',
281280
'configuration.automaticallyTunnelRemoteServer':
@@ -297,7 +296,7 @@ const strings = {
297296
'Auto attach to every Node.js process launched in the terminal.',
298297
'configuration.autoAttachMode.disabled': 'Auto attach is disabled and not shown in status bar.',
299298
'configuration.breakOnConditionalError':
300-
'Whether to stop when conditional breakpoints throw an error. Note: your launch.json `type` must be prefixed with `pwa-` to use this, such as `pwa-node`.',
299+
'Whether to stop when conditional breakpoints throw an error.',
301300
'configuration.unmapMissingSources':
302301
"Configures whether sourcemapped file where the original file can't be read will automatically be unmapped. If this is false (default), a prompt is shown.",
303302
'configuration.defaultRuntimeExecutables':

src/common/contributionUtils.ts

+12-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export const enum Contributions {
1919

2020
export const enum Commands {
2121
AddCustomBreakpoints = 'extension.js-debug.addCustomBreakpoints',
22-
AttachProcess = 'extension.NAMESPACE(node-debug).attachNodeProcess',
22+
AttachProcess = 'extension.pwa-node-debug.attachNodeProcess',
2323
AutoAttachClearVariables = 'extension.js-debug.clearAutoAttachVariables',
2424
AutoAttachSetVariables = 'extension.js-debug.setAutoAttachVariables',
2525
AutoAttachToProcess = 'extension.js-debug.autoAttachToProcess',
@@ -41,12 +41,19 @@ export const enum Commands {
4141
OpenEdgeDevTools = 'extension.js-debug.openEdgeDevTools',
4242
}
4343

44+
export const preferredDebugTypes: ReadonlyMap<DebugType, string> = new Map([
45+
[DebugType.Node, 'node'],
46+
[DebugType.Chrome, 'chrome'],
47+
[DebugType.ExtensionHost, 'extensionHost'],
48+
[DebugType.Edge, 'msedge'],
49+
]);
50+
4451
export const enum DebugType {
45-
ExtensionHost = 'NAMESPACE(extensionHost)',
52+
ExtensionHost = 'pwa-extensionHost',
4653
Terminal = 'node-terminal',
47-
Node = 'NAMESPACE(node)',
48-
Chrome = 'NAMESPACE(chrome)',
49-
Edge = 'NAMESPACE(msedge)',
54+
Node = 'pwa-node',
55+
Chrome = 'pwa-chrome',
56+
Edge = 'pwa-msedge',
5057
}
5158

5259
// constructing it this way makes sure we can't forget to add a type:
@@ -104,7 +111,6 @@ export const enum AutoAttachMode {
104111
Always = 'always',
105112
}
106113
export const enum Configuration {
107-
UsePreviewDebugger = 'debug.javascript.usePreview',
108114
NpmScriptLens = 'debug.javascript.codelens.npmScripts',
109115
TerminalDebugConfig = 'debug.javascript.terminalOptions',
110116
PickAndAttachDebugOptions = 'debug.javascript.pickAndAttachOptions',
@@ -126,7 +132,6 @@ export type DebugByLinkState = 'on' | 'off' | 'always';
126132
* Type map for {@link Configuration} properties.
127133
*/
128134
export interface IConfigurationTypes {
129-
[Configuration.UsePreviewDebugger]: boolean;
130135
[Configuration.NpmScriptLens]: 'all' | 'top' | 'never';
131136
[Configuration.TerminalDebugConfig]: Partial<ITerminalLaunchConfiguration>;
132137
[Configuration.PickAndAttachDebugOptions]: Partial<INodeAttachConfiguration>;

0 commit comments

Comments
 (0)