Last active
March 13, 2017 05:17
-
-
Save mkenne11/ec197096052c450b54d534dc176517ad to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Step 1. Setup VSCode project build and debug configuration. | |
Under the `.vscode` folder create 'launch.json` and 'tasks.json` files. The contents of both files is shown below. | |
a. launch.json | |
``` | |
{ | |
// Use IntelliSense to learn about possible Node.js debug attributes. | |
// Hover to view descriptions of existing attributes. | |
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Electron Main", | |
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron", | |
"program": "${workspaceRoot}/compiled/src/main/Main.js", | |
"protocol": "legacy", | |
"stopOnEntry": false, | |
"args": [], | |
"cwd": "${workspaceRoot}/", | |
"runtimeArgs": [ | |
"--enable-logging" | |
], | |
"env": {}, | |
"sourceMaps": true, | |
"outFiles": [ | |
"${workspaceRoot}/compiled/src" | |
], | |
"internalConsoleOptions": "openOnSessionStart", | |
"console": "integratedTerminal" | |
}, | |
{ | |
"name": "Debug renderer process", | |
"type": "chrome", | |
"request": "launch", | |
"runtimeExecutable": "${workspaceRoot}/node_modules/.bin/electron", | |
"runtimeArgs": [ | |
"${workspaceRoot}/", | |
"--enable-logging", | |
"--remote-debugging-port=9222" | |
], | |
"webRoot": "${workspaceRoot}/", | |
"sourceMaps": true, | |
"internalConsoleOptions": "openOnSessionStart" | |
} | |
] | |
} | |
``` | |
b. tasks.json | |
``` | |
{ | |
"version": "0.1.0", | |
"command": "npm", | |
"isShellCommand": true, | |
"args": [], | |
"showOutput": "always", | |
"echoCommand": true, | |
"tasks": [ | |
{ | |
"taskName": "prestart", | |
"args": ["run", "prestart"], | |
"suppressTaskName": true | |
}, | |
{ | |
"taskName": "compile", | |
"args": ["run", "compile"], | |
"suppressTaskName": true | |
} | |
] | |
} | |
``` | |
## Step 2. Build the project | |
After first installing black-screen and after each time black-screen is modified the project needs to be re-built prior to launching a debug session. | |
To build the project from inside vscode bring up the search box by entering `ctrl + p`, and then enter `task prestart`. | |
Note. If the code has been modified and no updates to dependent node modules are required you can compile the project by entering `task compile` into the search box. | |
Or alternatively from the command line run `npn run prestart`. | |
## Step 3. Debug the project | |
Source maps are enabled for the black-screen project which enables the raw Typescript code to be debugged. However, you can still jump to generated Javascript files by placing breakpoints in files under the `compiled\src` folder. | |
In the project enter debugging mode by selecting <b>View</b> > <b>Debug</b> from the menu. Or alternatively, use select the `Shift + Ctrl + D` keys. | |
To launch a debug session, from the <b>Debug</b> window in the top LHS select `Debug rendered process` and press the Play button. | |
Note. Prior to launching a debug session, select a breakpoint in the code. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment