debug jscode cli with vscode
-
I created a project based on the example cli at Install the CLI as Part of a Project. My jscad code works and creates the same stl as using the openjscad.xyz web page.
I'm having problems with vectorChar and I'd like to use vscode to step through the jscad cli code and debug it. I need to do this because the vectorChar code in the repo is very simple but I'm getting crazy results.
I tried this launch.json ...
"type": "pwa-node", "request": "launch", "name": "Launch Program", "skipFiles": [ "<node_internals>/**" ], "program": "jscad"
I pretty much knew it wouldn't work because jscode doesn't exist in my app's folder. Can anyone tell me what I should put in for "program" to run the jscad cli in debug mode?
-
@mark-hahn super thanks!
There’s still a little wizardry going on here. But I’ll try this with VSCODE, and then ask a few more questions.
-
I should add the steps needed to use vscode to debug.
- Clone the jscad cli repo
- Do an npm install
- Create a standard launch profile for node.
Here is my launch.json file ...
"version": "0.2.0", "configurations": [ { "type": "pwa-node", "request": "launch", "name": "Launch Program", "skipFiles": [ "<node_internals>/**" ], "program": "node_modules/@jscad/cli/cli.js", "args": ["text-gen.js"] } ] }
After this I just set a breakpoint in my jscode and launched the debugger. Worked great.
P.S. If anyone is curious I was able to fix my vectorChar problem. It was in my code but I was only able to find my problem by using the debugger.
-
@mark-hahn Super!
We often get asked how to use JSCAD inside VSCODE, so please let use know how to setup a project and debug. It would be a HUGE plus for JSCAD to be able to debug designs.
-
I found the answer to my problem right after posting this. I tried forever to figure this out before posting. This seems to happen to me a lot.
For lurkers: The "program" option in the launch file should be "node_modules/@jscad/cli/cli.js"