Skip to content

Instantly share code, notes, and snippets.

@dkackman
Created October 26, 2021 20:17
Show Gist options
  • Save dkackman/ede780f12df027eebb0cdd0f627a3af3 to your computer and use it in GitHub Desktop.
Save dkackman/ede780f12df027eebb0cdd0f627a3af3 to your computer and use it in GitHub Desktop.
VSCode launch tasks for chia electron development
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Electron: Main Process",
"type": "node",
"request": "launch",
"cwd": "${workspaceFolder}/chia-blockchain-gui",
"runtimeExecutable": "${workspaceFolder}/chia-blockchain-gui/node_modules/.bin/electron",
"windows": {
"runtimeExecutable": "${workspaceFolder}/chia-blockchain-gui/node_modules/.bin/electron.cmd"
},
"args": [
"."
],
"runtimeArgs": [
"--remote-debugging-port=9223"
],
"outputCapture": "std",
"console": "integratedTerminal",
"stopOnEntry": false
},
{
"name": "Electron: Renderer Process",
"type": "chrome",
"request": "attach",
"port": 9223,
"webRoot": "${workspaceFolder}/chia-blockchain-gui",
"timeout": 30000
}
],
"compounds": [
{
"name": "Electron: All",
"configurations": [
"Electron: Main Process",
"Electron: Renderer Process"
]
}
]
}
@dkackman
Copy link
Author

dkackman commented Oct 26, 2021

. ./activate
sh install-gui.sh
cd chia-blockchain-gui
npm run electron &
  • create a .vscode folder in the root of the chia repo (NOT the chia-blockchain-gui folder. You'll be working from the main repo)
  • put the launch.json file above in that folder
  • make sure VSCode is configured to use python from the venv
  • run the Electron: All configuration from the VSCode Debug panel.
  • VSCode will enter the venv and start the electron app
  • if you change "stopOnEntry": false to true, VSCode will break in cli.js and then you can continue from there

This assumes that ${workspaceFolder} is the main chia project. If not modify the paths as appropriate.

Make sure to have the python venv setup and VSCode all set to use it.

Electron: Main Process launches the main electron process and the line "console": "integratedTerminal" allows VSCode to enter the venv before doing so. If you want to debug the main process code change stopOnEntry to true.
Electron: Renderer Process attaches to electron's chrome UI instance.
Electron: All start both, including entering the venv for debugging the renderer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment