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
merged 1 commit into from Oct 28, 2021

Conversation

JLHwung
Copy link
Contributor

@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.

@JLHwung JLHwung added PR: New Feature 🚀 A type of pull request used for our changelog categories pkg: parser PR: Needs Docs labels Oct 26, 2021
@babel-bot
Copy link
Collaborator

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/49454/

@codesandbox-ci
Copy link

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 added the PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release label 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
@nicolo-ribaudo nicolo-ribaudo deleted the parser-start-column-option branch October 28, 2021 23:20
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jan 28, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue pkg: parser PR: New Feature 🚀 A type of pull request used for our changelog categories PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

startPos parser option to complement startLine
4 participants