Column Breakpoints gets Added to next line
Categories
(DevTools :: Debugger, defect, P3)
Tracking
(Not tracked)
People
(Reporter: Honza, Unassigned)
References
(Blocks 1 open bug)
Details
Originally reported here: https://github.com/firefox-devtools/debugger/issues/7166
So when we add a column breakpoints from a prettified source, it is most likely that it will not add the breakpoint where we want it to.
I did some digging and found that prettyFast is generating correct source map, but the source-map
package has a function generatedPositionFor
that we use to calculate the generated line and column.
It turns out that this function returns the start of the mapping. e.g.
Generated file:
function e(t){var e=n();return t.replace(e.protocol)}
Original(Pretty) file:
function e(t) {
var e = n();
return t.replace(e.protocol)
}
And I ask to get generated position for
location = {
line: 3,
column: 12,
}
Then it gives back generated = { line: 1, column: 24, lastColumn: 51 }
Which is the start of the mapping (return t.replace(e.protocol)
)
Now we have start of mapping, now we need to go to the actual column,
One hacky way that can work is: if we add these things together to work with prettify
location.column - spaces in front of the line + generated.column
= 12
- 2
+ 24
= 34
I am pretty sure this is not the right way to do it, please let me know what you think.
There is one more point, we use LEAST_UPPER_BOUND
bias to search this thing, which returns the greater mapping, so our breakpoints get added to the next line.
Description
•