google / google/closure-compiler
SourceMapConsumerV3 feature request: allow disabling of approximated mappings
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Filing off of https://groups.google.com/g/closure-compiler-discuss/c/rhAsFdwsnmQ so that this shows up in our bug scrub meeting. (and so that someone more familiar with SourceMapConsumerV3 than me will look at it)
Here's Kyle's original request:
> I am a consumer of SourceMapConsumerV3 :)
>
> I am using the getMappingForLine API to retrieve a source line from a transpiled line and column.
>
> There are some cases where calling this API will not find a direct mapping and approximate it, either by retrieving previous transpiled line mappings or by grabbing a mapping with a different column than was requested.
>
> It would be nice if one could opt out of this behavior, so that the caller could have the visibility that a mapping was not found vs it being approximated.
>
> Are there any objections to this feature request? If not I would be willing to contribute the change.
and a followup message:
> rough example here: https://github.com/kmantzel/closure-compiler/pull/1/files
>
> Also I know I originally mentioned that the approximation can "grab a mapping with a different column than was requested", but I think that was an error on my part for not understanding source mapping. As a variable name can span multiple columns. So I just ended up making the approximation around the existing `getPreviousLine` method for now.
>
> Just out of curiosity, is changing the behavior without this feature flag an option?
Contributor guide
Assessment
This issue has not been assessed yet.