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 highlighting for JSX fragment #535

Merged
merged 3 commits into from
Oct 23, 2017

Conversation

uniqueiniquity
Copy link
Contributor

Adds support for #534 (also see facebook/jsx#93 for more info).


#jsx tags
jsx-fragment:
name: meta.tag.fragment.tsx
Copy link
Member

Choose a reason for hiding this comment

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

Instead of adding new rule for jsx-fragment,
Update: jsx-tag-without-attributes-in-expression and jsx-tag-without-attributes as:

  #jsx tags
  jsx-tag-without-attributes-in-expression:
    begin: |-
      (?x)
        (?<=[({\[,?=>:*]|&&|\|\||\?|\Wreturn|^return|\Wdefault|^)\s*
        (?=(<)\s*((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?<!\.|-))?\s*(>))
    end: (?!\s*(<)\s*((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?<!\.|-))?\s*(>))
    patterns:
    - include: '#jsx-tag-without-attributes'

  jsx-tag-without-attributes:
    name: meta.tag.without-attributes.tsx
    begin: (<)\s*((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?<!\.|-))?\s*(>)
    end: (</)\s*((?:[a-z][a-z0-9]*|([_$a-zA-Z][-$\w.]*))(?<!\.|-))?\s*(>)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

@sheetalkamat
Copy link
Member

You also need to add the testcase mentioned in #534 here.

Copy link
Member

@sheetalkamat sheetalkamat left a comment

Choose a reason for hiding this comment

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

Need testcase + it would be just better to update jsx-tag-without attributes instead of creating new rule.

@uniqueiniquity
Copy link
Contributor Author

Yeah the intent here was not for this to be a complete PR, I was actually just trying to get appveyor to run the tests since they're so broken locally.

@uniqueiniquity
Copy link
Contributor Author

Now ready for review with test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants