node.js debugger setup

Post Reply
noahberkley
Newbie
Posts: 3
Joined: Fri Sep 23, 2022 5:23 pm

node.js debugger setup

Post by noahberkley »

Is there a video or guide on how to set up visual studio code debugging with Switch scripts?

Thanks
User avatar
foxpalace
Member
Posts: 37
Joined: Fri Jan 14, 2011 12:25 pm
Location: Germany

Re: node.js debugger setup

Post by foxpalace »

freddyp
Advanced member
Posts: 1129
Joined: Thu Feb 09, 2012 3:53 pm

Re: node.js debugger setup

Post by freddyp »

Thanks for the video!

There is one thing extra that should be mentioned: this very easy method (it is all pre-configured) is available when you work with script folders. You can use the SwitchScriptTool for that, or you can right click on a "Script element" and create the script folder from there. Extra remark: the use of TypeScript is heavily recommended.
noahberkley
Newbie
Posts: 3
Joined: Fri Sep 23, 2022 5:23 pm

Re: node.js debugger setup

Post by noahberkley »

Thank you both!
cstevens
Member
Posts: 106
Joined: Tue Feb 12, 2013 8:42 pm

Re: node.js debugger setup

Post by cstevens »

I think something got messed up with my attach configuration, none of the variables appear and the debugger doesn't hit any of my break points. I re-watched all the learning path videos, but nothing goes into detail on how this should be configured. This used to work, but I think I developed the script package in a previous version of Switch and now it's not working.

I'm running Switch 2023 Fall.

This is what my launch.json looks like:

Code: Select all

{
  // 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": "Attach",
      "port": 9229,
      "request": "attach",
      "skipFiles": [
        "<node_internals>/**"
      ],
      "type": "node"
    }
  ]
}
cstevens
Member
Posts: 106
Joined: Tue Feb 12, 2013 8:42 pm

Re: node.js debugger setup

Post by cstevens »

Also I see my switch-scripting module is a bit out of date:

Code: Select all

        "node_modules/@types/switch-scripting": {
            "version": "22.1.0",
            "resolved": "https://github.com/enfocus-switch/types-switch-scripting/archive/22.1.0.tar.gz",
            "integrity": "sha512-tZ3xqi1OByOGYmqX6ymjYa6Vw2Q/KhbPeiE4bJflo+/L5kT0jF1hS3dSNt6Fa1/2TplqNPhjLbnv/UE0LVSbyw==",
            "dev": true,
            "license": "UNLICENSED"
        },
Does that matter?
freddyp
Advanced member
Posts: 1129
Joined: Thu Feb 09, 2012 3:53 pm

Re: node.js debugger setup

Post by freddyp »

A common mistake is not being in the correct folder in VSC when attaching. You should have the script folder open at the level of the main.ts. One level too high, one level too low and you do not see the right things.
Post Reply