Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debuggin works only with javascript, not typescript #104

Open
aabluedragon opened this issue May 30, 2021 · 5 comments
Open

Debuggin works only with javascript, not typescript #104

aabluedragon opened this issue May 30, 2021 · 5 comments
Labels
debugger Features/issues for debugger with vscode

Comments

@aabluedragon
Copy link

aabluedragon commented May 30, 2021

Hello,

I've noticed that breakpoints only work when placing them in .jsx files... meaning .tsx file breakpoints are ignored, even though there sourcemaps.

Do I have anything misconfigured on my side, or is this the status quo?

Also debugger; statements are not caught, only breakpoints you mark actually do halt execution.

@lewiji
Copy link
Contributor

lewiji commented Jun 3, 2021

Iirc, I had to set the mapping from JS to TS using an absolute rather than relative path in my tsconfig to get it to work, but then I could indeed debug from typescript directly. Haven't got the project in front of me to check, but if that doesn't work let me know and I'll see if I can find more details.

@aabluedragon
Copy link
Author

Nothing helps, including writing the absolute path in sourceRoot or rootDir entries in tsconfig.

@lewiji
Copy link
Contributor

lewiji commented Jun 5, 2021

Here's an example tsconfig.json and .vscode/launch.json from a project where I used to debug in TS. I haven't used it in a while (since around January) so I haven't verified these with the latest version but hopefully it helps to verify your config.

tsconfig.json

{
	"include": ["./scripts"],
	"exclude": [".import", "./compiled/", "./node_modules"],
	"compilerOptions": {
                "rootDir": "./scripts",
                "outDir": "./compiled",
		"target": "ESNext",
		"module": "ESNext",
		"moduleResolution": "node",
		"lib": ["ESNext"],
		"experimentalDecorators": true,
		"jsx": "preserve",
		"sourceMap": true,
                "sourceRoot": "/home/ljp/godot/proj/Dungen/scripts/",
		"strict": false,
		"resolveJsonModule": true,
	}
}

I'm not sure exactly which of the options are required to have this functionality work, but I think what worked for me is having the rootDir/outDir set to relative paths, the sourceRoot set to the absolute path of the rootDir, and sourceMap set to true, the other options may not be necessary, but worth experimenting with if those don't work alone.

For the VS Code debug config, I also had sourceMaps set to true there (assuming you're using VS Code):

.vscode/launch.json

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "godot-quickjs",
      "request": "launch",
      "name": "Launch Godot Game",
      "program": "/home/ljp/godot/godot.x11.opt.tools.64",
      "sourceMaps": true,
    }
  ]
}

@aabluedragon
Copy link
Author

I tried playing around with these options, without success.
I'm using Windows btw, seeing your paths /home/ljp/godot/godot.x11.opt.tools.64 looks like your on a POSIX system.
maybe that's why it doesn't work?

@vexCoder
Copy link

vexCoder commented Aug 7, 2022

Did you manage to find a solution for this?

@nmerget nmerget added the debugger Features/issues for debugger with vscode label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger Features/issues for debugger with vscode
Projects
None yet
Development

No branches or pull requests

4 participants