Reputation: 2578
I previously worked with the Scratch 2.0 source code which was largely action script based. I now want to dig into the 3.0 code which has moved across to JavaScript but have little experience in that area. I'm working in Windows 10.
These are the steps I'm taking to prepare the code locally -
git clone https://github.com/llk/scratch-gui
git clone https://github.com/llk/scratch-vm
cd scratch-vm
npm install
npm link
npm run watch
cd ..\scratch-gui
npm install
npm link scratch-vm
npm start
Followed by opening http://localhost:8601
in Chrome browser.
This is fine and allows me to modify the vm code (in VS Code) and "instantly" see the results in the browser. What I want to be able to do is to set breakpoints to be able to step, set watches, etc.
I assume I need to set up launch.json
in order to do this but all configurations I have tried result in a successful compilation followed by a timeout while trying to connect to the runtime process.
This is the launch.json
file that I'm using (though I've tried quite a few variations which have all yielded the same result).
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"name": "Launch Program",
"runtimeExecutable": "npm",
"autoAttachChildProcesses": true,
"runtimeArgs": ["start", "--"],
"protocol": "inspector",
"skipFiles": [
"<node_internals>/**"
],
"sourceMaps": true,
"timeout": 30000,
"outputCapture": "std",
"address": "http://localhost",
"port": 8601
}
]
}
I realise I may well be missing a step or making an obvious mistake but any pointers in the right direction would be very much appreciated.
Upvotes: 1
Views: 465
Reputation: 2578
This is the official page for debugging Scratch 3.0 with Visual Studio. I worked out the additional steps required for getting breakpoints to work over multiple workspaces and they have now been added to the official page under the heading Step 3: More source maps for multi-root workspaces.
Upvotes: 2
Reputation: 49
I have little experience in what you are doing but if it helps the JavaScript breakpoint keyword is:
debugger;
Upvotes: 0