Skip to content

Commit d8e4548

Browse files
committed
Switch to the new vscode-js-debug extension per default
1 parent 4cad43b commit d8e4548

File tree

4 files changed

+13
-64
lines changed

4 files changed

+13
-64
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Unreleased
22
* Support primitive `adbPath` expansion ([#3](https://github.com/mpotthoff/vscode-android-webview-debug/pull/3)) by [@buschtoens](https://github.com/buschtoens)
3+
* Switch to the new [vscode-js-debug](https://github.com/microsoft/vscode-js-debug) extension per default
34

45
## 1.1.2 - 2021-06-18
56
* Allow the user to select which page to debug in case multiple are available ([#2](https://github.com/mpotthoff/vscode-android-webview-debug/issues/2))

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ A VS Code extension to debug your JavaScript code in the Google Chrome browser o
2222

2323
## Requirements
2424

25-
### Debugger for Chrome
25+
### vscode-js-debug
2626

27-
This extension uses the [Debugger for Chrome](https://github.com/Microsoft/vscode-chrome-debug) extension under the hood.
27+
This extension uses the [vscode-js-debug](https://github.com/microsoft/vscode-js-debug) extension under the hood.
2828

2929
## Using the debugger
3030

@@ -34,7 +34,9 @@ When your launch config is set up, you can debug your project. Pick a launch con
3434

3535
Right now the extension only supports attaching to an already running Google Chrome or WebView instance. This can be configured in the `.vscode/launch.json` file in the root directory of your project.
3636

37-
> All configuration options of the `attach` configuration of the [Debugger for Chrome](https://github.com/Microsoft/vscode-chrome-debug#attach) extension are supported.
37+
In case you want to use the old [Debugger for Chrome](https://github.com/Microsoft/vscode-chrome-debug) extension you can set `debug.javascript.usePreview` to `false`.
38+
39+
> All configuration options of the `pwa-chrome: attach` configuration of the [vscode-js-debug](https://github.com/microsoft/vscode-js-debug/blob/main/OPTIONS.md#pwa-chrome-attach) extension are supported.
3840
3941
You can optionally specify a port to use for the debugging connection or let the extension automatically choose an unsued one.
4042

package.json

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -71,61 +71,6 @@
7171
"port": {
7272
"type": "number",
7373
"default": 9222
74-
},
75-
"sourceMaps": {
76-
"type": "boolean",
77-
"default": true
78-
},
79-
"trace": {
80-
"type": [
81-
"boolean",
82-
"string"
83-
],
84-
"enum": [
85-
"verbose",
86-
true
87-
],
88-
"default": true
89-
},
90-
"url": {
91-
"type": "string",
92-
"default": "http://localhost:8080"
93-
},
94-
"webRoot": {
95-
"type": "string",
96-
"default": "${workspaceFolder}"
97-
},
98-
"pathMapping": {
99-
"type": "object",
100-
"default": {}
101-
},
102-
"sourceMapPathOverrides": {
103-
"type": "object",
104-
"default": {}
105-
},
106-
"smartStep": {
107-
"type": "boolean",
108-
"default": true
109-
},
110-
"skipFiles": {
111-
"type": "array",
112-
"default": []
113-
},
114-
"timeout": {
115-
"type": "number",
116-
"default": 10000
117-
},
118-
"disableNetworkCache": {
119-
"type": "boolean",
120-
"default": true
121-
},
122-
"urlFilter": {
123-
"type": "string",
124-
"default": ""
125-
},
126-
"showAsyncStacks": {
127-
"type": "boolean",
128-
"default": true
12974
}
13075
}
13176
}
@@ -171,6 +116,6 @@
171116
"typescript": "4.3.5"
172117
},
173118
"extensionDependencies": [
174-
"msjsdiag.debugger-for-chrome"
119+
"ms-vscode.js-debug"
175120
]
176121
}

src/debugConfigurationProvider.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,10 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
8383
delete debugConfiguration.preLaunchTask;
8484
}
8585

86+
const useNewDebugger = vscode.workspace.getConfiguration("debug.javascript").get<boolean>("usePreview") ?? true;
87+
8688
// Rewrite type to chrome
87-
debugConfiguration.type = "chrome";
89+
debugConfiguration.type = useNewDebugger ? "pwa-chrome" : "chrome";
8890

8991
// Test the bridge to ensure that the required executables exist
9092
await bridge.test();
@@ -198,10 +200,9 @@ export class DebugConfigurationProvider implements vscode.DebugConfigurationProv
198200
// Forward the debugger to the local port
199201
debugConfiguration.port = await bridge.forwardDebugger(webView, debugConfiguration.port);
200202

201-
// In case neither url and urlFilter are configured we are going to try and
202-
// retrieve the list of available pages. If more than one is available we will allow
203-
// the user to choose one to debug.
204-
if (!debugConfiguration.url && !debugConfiguration.urlFilter) {
203+
// In case the old debugger is used and neither url and urlFilter are configured we are going to try and
204+
// retrieve the list of available pages. If more than one is available we will allow the user to choose one to debug.
205+
if (!useNewDebugger && !debugConfiguration.url && !debugConfiguration.urlFilter) {
205206
try {
206207
const pages = await bridge.getWebViewPages(debugConfiguration.port);
207208
if (pages.length > 1) {

0 commit comments

Comments
 (0)