Try 2 bias values when calling originalPositionFor from applySourceMap #376
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The method applySourceMap is calling originalPositionFor without providing the
bias
value.By default
bias
equals to GREATEST_LOWER_BOUND which means: if exact column value was not found - take nearest item from the left. In some cases there is "no nearest value on the left" because most correct value is nearest "from the right". I believe it is worth to try to calloriginalPositionFor
with both available bias values rather then just try one and claim that we cannot find mapping while it is exists.Initially the GREATEST_LOWER_BOUND value is used (like it was before). If
originalPositionFor
cannot find relevant mapping then LEAST_UPPER_BOUND bias value is used to search again.I don't think that
applySourceMap
should made any assumptions on the structure of the source maps and it should be symmetric as much as possible (in proposed implementation preference is given to the "left" element but this is how it always was before).