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

Source mapping doesn't work with multiple sources in one map #84

Open
Zorbn opened this issue Dec 29, 2023 · 1 comment
Open

Source mapping doesn't work with multiple sources in one map #84

Zorbn opened this issue Dec 29, 2023 · 1 comment

Comments

@Zorbn
Copy link

Zorbn commented Dec 29, 2023

The source mapping feature works well when each lua file has its own .lua.map file. However, when using the luaBundle feature of TypeScriptToLua or other tools that generate a single lua file with one .lua.map which points to many source files, the debugger seems to get breakpoints across different files mixed up, and often skips them. For example, if you have a breakpoint in a file like foo.ts in the love-ts test, but no breakpoint in main.ts, then the debugger will ignore the breakpoint in foo.ts and never break.

@Zorbn
Copy link
Author

Zorbn commented Jan 2, 2024

This is fixed in my fork by changing the conditional in Breakpoint.add from

if (mapping.sourceLine === line) {
    sourceFile = file;
    file = scriptFile;
    sourceLine = line;
    line = scriptLine;
    break;
}

to

if (mapping.sourceLine === line && file === sourceMap.sources[mapping.sourceIndex]) {
    sourceFile = file;
    file = scriptFile;
    sourceLine = line;
    line = scriptLine;
    break;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant