-
-
Notifications
You must be signed in to change notification settings - Fork 41
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
fix: handle end out of range errors #199
Conversation
Please include a test 🙂 |
Hi, any pending task to review/merge? |
Hi, could you please release this change? |
@jridgewell does this seem reasonable to you? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this fix is in the wrong location, because it's so far from the actual spot the bug is introduced. I would update
Lines 105 to 110 in b5ecd82
end = originalPositionFor(sourceMap, { | |
line: lines[lines.length - 1].line, | |
column: endCol - lines[lines.length - 1].startCol, | |
bias: LEAST_UPPER_BOUND | |
}) | |
end.column -= 1 |
const maybeEnd = originalPositionFor(sourceMap, {
line: lines[lines.length - 1].line,
column: endCol - lines[lines.length - 1].startCol,
bias: LEAST_UPPER_BOUND
})
if (maybeEnd) {
end = maybeEnd
end.column -= 1
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, this seems to be fixing an unrelated issue? The case I debugged in #198 does not hit this error case. I'm not sure how this case is hit.
The changes in this PR fix that This works for us too Line 22 in b5ecd82
|
7ddce7a
to
1e93be6
Compare
Not sure what the best solution is here between the options presented by @jridgewell, @wolandec, and @hurstindustries -- open to suggestions from someone who's dug into this deeply. |
Fixes issue
Cannot read properties of undefined (reading 'endCol')
inlib/range.js
See comment by @devcorraliza on #198 (comment) for context