Skip to content

Commit

Permalink
[support] Provide VSCode configs to debug Electron main and renderer …
Browse files Browse the repository at this point in the history
…threads (LedgerHQ#1958)

* Remove .vscode folder from git ignored

* VSCode default debug configs for Electron main and renderer

* Update LLD README

* Safer .gitignore rules to specifically allow launch.json only
  • Loading branch information
Hakim authored Nov 25, 2022
1 parent cafbd5d commit d5bc651
Showing 3 changed files with 35 additions and 27 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
node_modules
.turbo
.vscode
!.vscode/launch.json
.pnpm-*
/temp
.idea
21 changes: 21 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"version": "0.2.0",
"configurations": [
{
// Start LLD with:
//ELECTRON_ARGS=--remote-debugging-port=8315 pnpm dev:lld
"name": "Attach Electron Renderer",
"type": "chrome",
"request": "attach",
"port": 8315
},
{
// Start LLD with:
//LEDGER_INTERNAL_ARGS=--inspect pnpm dev:lld
"name": "Attach Electron Main",
"type": "node",
"request": "attach",
"skipFiles": ["<node_internals>/**"]
}
]
}
40 changes: 13 additions & 27 deletions apps/ledger-live-desktop/README.md
Original file line number Diff line number Diff line change
@@ -79,49 +79,35 @@ pnpm build:lld

## Debug

If you are using [Visual Studio Code](https://code.visualstudio.com/) IDE, here is a [Launch Configuration](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_launch-configuration) that should allow you to run and debug the main process as well as the render process of the application.

As stated in the [debugging documentation](https://code.visualstudio.com/docs/editor/debugging), this file should be named `launch.json` and located under the `.vscode` folder at the root of the monorepository.
If you are using [Visual Studio Code](https://code.visualstudio.com/) IDE, we provide a [default debug configuration](https://github.com/LedgerHQ/ledger-live/tree/develop/.vscode/launch.json) that you can use to debug the main and renderer processes of the application.

```json
{
"version": "0.2.0",
"compounds": [
{
"name": "Run and Debug LLD",
"configurations": ["Debug Main Process", "Debug Renderer Process"],
"stopAll": true
}
],
"configurations": [
{
"name": "Debug Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}",
"runtimeExecutable": "pnpm",
"args": ["dev:lld"],
"outputCapture": "std",
"resolveSourceMapLocations": null,
"env": {
"ELECTRON_ARGS": "--remote-debugging-port=8315"
}
// Start live desktop with:
//ELECTRON_ARGS=--remote-debugging-port=8315 pnpm dev:lld
"name": "Attach Electron Renderer",
"type": "chrome",
"request": "attach",
"port": 8315
},
{
"name": "Debug Renderer Process",
"type": "chrome",
// Start live desktop with:
//LEDGER_INTERNAL_ARGS=--inspect pnpm dev:lld
"name": "Attach Electron Main",
"type": "node",
"request": "attach",
"address": "localhost",
"port": 8315,
"timeout": 60000
"skipFiles": ["<node_internals>/**"]
}
]
}
```

### Tips

- #### **Can't find Node.js binary "pnpm": path does not exist. Make sure Node.js is installed and in your PATH, or set the "runtimeExecutable" in your launch.json***
- #### **Can't find Node.js binary "pnpm": path does not exist. Make sure Node.js is installed and in your PATH, or set the "runtimeExecutable" in your launch.json\***

Add your terminal PATH as enviroment variable.

0 comments on commit d5bc651

Please sign in to comment.