Skip to content

feat: if code frame error is on a single line, highlight the whole path#10361

Merged
nicolo-ribaudo merged 2 commits intobabel:masterfrom
SimenB:code-frame-end-line
Oct 29, 2019
Merged

feat: if code frame error is on a single line, highlight the whole path#10361
nicolo-ribaudo merged 2 commits intobabel:masterfrom
SimenB:code-frame-end-line

Conversation

@SimenB
Copy link
Copy Markdown
Contributor

@SimenB SimenB commented Aug 22, 2019

Q                       A
Fixed Issues?
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature? 👍
Tests Added + Pass? No
Documentation PR Link
Any Dependency Changes? No
License MIT

Before:
image

After:
image

buildCodeFrameError doesn't seem to have any tests, at least not any I could find. Thoughts on where I can add one (if you want this)

This might make sense as an option passed to path.buildCodeFrameError rather than buildCodeFrameError forcing it on consumers?

@babel-bot
Copy link
Copy Markdown
Collaborator

babel-bot commented Aug 22, 2019

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

@JLHwung
Copy link
Copy Markdown
Contributor

JLHwung commented Aug 22, 2019

The highlighted path may contain many subpaths even though they are within the same line, i.e.

foo(a, b(f, { g: h(i) }))

If the whole callExpression foo(a, b(f, { g: h(i) })) is highlighted, user may even get more confused than we simply highlight the start foo.

@JLHwung JLHwung added the PR: New Feature 🚀 A type of pull request used for our changelog categories label Aug 22, 2019
@nicolo-ribaudo
Copy link
Copy Markdown
Member

I prefer this PR to the current behavior. In @JLHwung example, if the problem is the whole call expression I don't see why it shouldn't be highlighted.

@nicolo-ribaudo nicolo-ribaudo added this to the v7.7.0 milestone Sep 17, 2019
@existentialism existentialism added the PR: Ready to be Merged A pull request with already two approvals, but waiting for the next minor release label Sep 25, 2019
@nicolo-ribaudo nicolo-ribaudo merged commit f1bc6c4 into babel:master Oct 29, 2019
@SimenB SimenB deleted the code-frame-end-line branch October 29, 2019 22:48
@lock lock Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Jan 29, 2020
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 29, 2020
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: core 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.

5 participants