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

feat: support startColumn option #13887

merged 1 commit into from Oct 28, 2021


Copy link

@JLHwung JLHwung commented Oct 26, 2021

Q                       A
Fixed Issues? Resolves #13884
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? Yes
Tests Added + Pass? Yes
Documentation PR Link babel/website#2586
Any Dependency Changes?
License MIT

This PR implements startColumn option in Babel parser. Like startLine, the startColumn indicates the starting column position of the input string in the source code. For example, consider a wrapper

function (exports, require, module, __filename, __dirname) { [code] }

where [code] is a string from which Babel parser will generate AST. A user will expect the generated location info correctly maps to the location in the wrapped code, in this case, he/she should pass

  "startColumn": 60

to Babel parser so that the line 1 column 0 at [code] maps to line 1 column 60 in the wrapped source. Not that unlike startLine, the startColumn is 0-based, its default value is 0.

Copy link

@babel-bot babel-bot commented Oct 26, 2021

Build successful! You can test your changes in the REPL here:

Copy link

@codesandbox codesandbox bot commented Oct 26, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit ac9c7de:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@nicolo-ribaudo nicolo-ribaudo added this to the v7.16.0 milestone Oct 27, 2021
@nicolo-ribaudo nicolo-ribaudo changed the title feat: support startColumn feat: support startColumn option Oct 28, 2021
@nicolo-ribaudo nicolo-ribaudo merged commit 872086a into babel:main Oct 28, 2021
27 of 29 checks passed
@nicolo-ribaudo nicolo-ribaudo deleted the parser-start-column-option branch Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

4 participants