You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+26-25Lines changed: 26 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,11 +5,10 @@ The aim of this repository is to help setting up Visual Studio Code for developm
5
5
Visual Studio Code comes with Electron support and Typescript support out of the box, but bringing the two together requires some advanced knowledge of the available configuration options. The repository contains a README with step by step instructions and an example project to demonstrate how Visual Studio Code, Node, Electron and Typescript must be configured to work together.
6
6
7
7
The latest example project has been created and tested on Linux with
8
-
- Node v16.1.0
9
-
- Electron v12.0.7
10
-
- Typescript v4.2.4
11
-
- Visual Studio Code v1.56.0
12
-
- Debugger for Chrome extension v4.12.12
8
+
- Node v16.3.0
9
+
- Electron v13.1.2
10
+
- Typescript v4.3.2
11
+
- Visual Studio Code v1.57.0
13
12
14
13
## Install application
15
14
```sh
@@ -28,35 +27,37 @@ npm start
28
27
29
28
## Set up Visual Studio Code and start debugging
30
29
31
-
1) Install the "Debugger for Chrome" extension.
32
-
33
-
It is required for debugging renderer processes.
34
-
35
-

30
+
1) Set a breakpoint in `src/main.ts` and `src/renderer.ts`
36
31
37
32
1) In the Run view, select the "Electron: All" configuration.
38
33
39
34
This is a compound configuration that will start both the "Electron: Main" and "Electron: Renderer" configurations.
you have likely come across a [bug](https://github.com/microsoft/vscode/issues/123420) in the new JavaScript debugger for Node.js and Chrome, which is currently in preview and enabled by default. The bugfix will probably be released in Visual Studio Code v1.57. As a temporary workaround, disable the preview debugger.
This is because of a [bug](https://github.com/microsoft/vscode/issues/123420) in the internal JavaScript debugger. As a workaround, you can either update to the latest version of Visual Studio Code, or use the "Debugger for Chrome" extension:
51
+
- Install the "Debugger for Chrome" extension v4.12.12
52
+

53
+
- In `.vscode/launch.json`, change the renderer configuration type from `pwa-chrome` to `chrome`
54
+
- Change settings to prevent the "Debugger for Chrome" extension from using the internal Javascript debugger:
When you run the "Electron: All" configuration the next time, the breakpoint should be hit.
60
61
61
62
62
63
@@ -65,7 +66,7 @@ npm start
65
66
Electron has two kinds of processes: a main process and renderer processes (one for each tab). They need different launch configurations, which are shown below. The code snippets are taken from the [launch configuration](.vscode/launch.json).
66
67
67
68
### Main process
68
-
The main process can be debugged with the pwa-node debugger that ships with Visual Studio Code.
69
+
The main process can be debugged with the pwa-node debugger, that ships with Visual Studio Code.
69
70
70
71
The launch configuration looks like this:
71
72
@@ -94,12 +95,12 @@ In the `sourceMaps` and `resolveSourceMapLocations` sections, we enable the crea
94
95
In the `runtimeArgs` section, we open a port for the renderer process. There is a counterpart defined in the renderer process configuration as shown below.
95
96
96
97
### Renderer process
97
-
Debugging a renderer process requires the "Debugger for Chrome" extension.
98
+
A renderer process can be debugged with the pwa-chrome debugger, that ships with Visual Studio Code.
98
99
99
100
```jsonc
100
101
{
101
102
"name":"Electron: Renderer",
102
-
"type":"chrome", //use the Debugger for Chrome (extension)
103
+
"type":"pwa-chrome", //use the Chrome debugger that comes with VS Code
103
104
"request":"attach",
104
105
"port":9223, //use debug port opened in Electron: Main configuration
0 commit comments