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

Breakpoints assigned to incorrect line when using register/import transpiler #2122

Open
bdentino opened this issue Nov 2, 2024 · 0 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@bdentino
Copy link

bdentino commented Nov 2, 2024

Describe the bug
I apologize in advance if this is behaving as expected and I've just misconfigured my project. If that's the case I would appreciate any advice on fixing said configuration to achieve the behavior described below.

I have a nodejs typescript project that I run locally in docker. I am using swc register to transpile code as it's loaded instead of running from a build directory. I can connect to debug the project and set breakpoints in the remote files from my local sources, but these breakpoints are generally not inserted into the expected position on the remote code. I believe this is related to the fact that the 'loaded' script is actually transpiled with an inline sourcemap, and vscode seems to be ignoring that sourcemap when it assigns the breakpoint to the mapped source file.

For instance, trying to set a breakpoint locally on line 20 of my untranspiled file results in VSCode requesting a breakpoint at line 20 of the transpiled source, which doesn't exist.

Am I doing something wrong here? Is there some way to explicitly tell vscode where to find sourcemaps for local files so that it knows which line to request the breakpoint at?

To Reproduce
I created a very simple repro here:
https://github.com/bdentino/vscsm-repro

  1. Checkout repo
  2. npm install locally
  3. docker compose up api
  4. In VSCode, attach debugger and set a breakpoint at line 22.
  5. Observe that breakpoint cannot be bound

Image

Log File

vscode-debugadapter-ae11dbf9.json.gz

VS Code Version:
Image

@bdentino bdentino added the bug Issue identified by VS Code Team member as probable bug label Nov 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

2 participants