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

Add opts.message option to code frames #7243

Merged
merged 3 commits into from
Jan 21, 2018
Merged

Conversation

jamiebuilds
Copy link
Contributor

This adds the ability to add inline messages to code frames.

With line and column:

  1 | class Foo {
> 2 |   constructor()
    |                ^ Missing {
  3 | };

With line:

  Missing {
  1 | class Foo {
> 2 |   constructor()
  3 | };

With start and end line and column:

  1 | class Foo {
> 2 |   constructor() {
    |                 ^
> 3 |     console.log(arguments);
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 4 |   }
    | ^^^ something about the constructor body
  5 | };

With start and end line:

  something about the constructor body
  1 | class Foo {
> 2 |   constructor() {
> 3 |     console.log(arguments);
> 4 |   }
  5 | };

@babel-bot
Copy link
Collaborator

babel-bot commented Jan 20, 2018

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

Copy link
Member

@xtuc xtuc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks nice. Could you please update the documentation with the new option?

@existentialism existentialism added the PR: New Feature 🚀 A type of pull request used for our changelog categories label Jan 20, 2018
Copy link
Member

@existentialism existentialism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jamiebuilds
Copy link
Contributor Author

Added some docs

@jamiebuilds jamiebuilds merged commit 5759c33 into master Jan 21, 2018
@jamiebuilds jamiebuilds deleted the code-frame-messages branch January 21, 2018 03:19
aminmarashi pushed a commit to aminmarashi/babel that referenced this pull request Mar 17, 2018
* Add opts.message option to code frames

* Fix for missing loc.start in code-frame

* Add docs
@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label May 2, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 2, 2018
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 PR: New Feature 🚀 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants