Skip to content

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

@bdentino

Description

@bdentino

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

Metadata

Metadata

Assignees

Labels

author-verification-requestedIssues potentially verifiable by issue authorbugIssue identified by VS Code Team member as probable bugverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions