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

Mark JSX components differently from standard HTML tags #415

Closed
mjbvz opened this issue Feb 6, 2017 · 14 comments
Closed

Mark JSX components differently from standard HTML tags #415

mjbvz opened this issue Feb 6, 2017 · 14 comments
Assignees

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Feb 6, 2017

From @tannerlinsley on January 18, 2017 19:14

screen shot 2017-01-18 at 12 11 36 pm

This is no so in Atom (which is honestly the last thing keeping me from moving all the way to vscode):
screen shot 2017-01-18 at 12 13 50 pm

It doesn't seem to be fixed by using any theme, or installing the https://github.com/dzannotti/vscode-babel extension.

Any ideas?

Copied from original issue: microsoft/vscode#18752

@mjbvz mjbvz changed the title JSX components have identical color as standard HTML tags. Mark JSX components differently from as standard HTML tags Feb 6, 2017
@mjbvz
Copy link
Contributor Author

mjbvz commented Feb 6, 2017

The request here would be to mark custom component tags differently from html tags. Right now, both are scoped the same, for example:

entity.name.tag.js
meta.tag.js
meta.jsx.children.tsx
meta.tag.without-attributes.js
meta.var.expr.js
source.js

When I mentioned this to @mhegazy, I believe he suggested that this could be as simple as seeing if the first letter of the tag is capitalized.

@tannerlinsley
Copy link

I agree. First letter being capitalized would be a pretty dead giveaway along with tags that contain object dot notation:
<components.myComponent attr={...} />

@mjbvz mjbvz changed the title Mark JSX components differently from as standard HTML tags Mark JSX components differently from standard HTML tags May 3, 2017
@mjbvz
Copy link
Contributor Author

mjbvz commented May 3, 2017

I tried this in atom with the babel plugin.

For the jsx <div />, div is:

  • source.js.jsx
  • meta.tag.jsx
  • entity.name.tag.open.jsx

For the jsx <Div />, Div is:

  • source.js.jsx
  • meta.tag.jsx
  • entity.name.tag.open.jsx
  • support.class.component.open.jsx

@tannerlinsley
Copy link

So it might only have to do with the syntax highlighting then, if it's already making the distinction.

@mjbvz
Copy link
Contributor Author

mjbvz commented May 3, 2017

Yes, I suspect so. This means that the highlighting won't be right all the time, but it should work in common cases fairly well.

Here's what I believe is the implementation of this in the babel grammar: https://github.com/gandm/language-babel/blob/dbb88f69aaf09bf30e517d6dc1c8144467743299/grammars/Babel%20Language.json#L2183

and here's where I think we would need to update the Typescript react grammar : https://github.com/Microsoft/TypeScript-TmLanguage/blob/master/TypeScriptReact.YAML-tmLanguage#L163

mjbvz added a commit to mjbvz/TypeScript-TmLanguage that referenced this issue May 4, 2017
Fixes microsoft#415

Adds an extra marker for tsx tags that are likly a javascript/typescript class instead of a standard html element

Update tests
mjbvz added a commit to mjbvz/TypeScript-TmLanguage that referenced this issue May 4, 2017
Fixes microsoft#415

Adds an extra marker for tsx tags that are likly a javascript/typescript class instead of a standard html element
mjbvz added a commit to mjbvz/TypeScript-TmLanguage that referenced this issue May 4, 2017
Fixes microsoft#415

Adds an extra marker for tsx tags that are likly a javascript/typescript class instead of a standard html element
@tannerlinsley
Copy link

I'm not sure why this is closed. I just tried to move to VSCode again from Atom and this still isn't fixed. @waderyan any insights here? For someone using JSX and React, this is very sad experience :(

@waderyan
Copy link

waderyan commented Jun 8, 2017

@tannerlinsley can you take a screenshot of what you are seeing? Also please confirm you are on the latest version of VS Code.

@tannerlinsley
Copy link

tannerlinsley commented Jun 8, 2017 via email

@waderyan waderyan reopened this Jun 8, 2017
@waderyan
Copy link

waderyan commented Jun 8, 2017

@mjbvz this seems to have shown up again.

@mjbvz
Copy link
Contributor Author

mjbvz commented Jun 9, 2017

@tannerlinsley Are you using VSCode 1.13?

@tannerlinsley
Copy link

tannerlinsley commented Jun 9, 2017 via email

@mjbvz
Copy link
Contributor Author

mjbvz commented Jun 9, 2017

@tannerlinsley What theme are you using?

@mjbvz
Copy link
Contributor Author

mjbvz commented Jun 15, 2017

Closing as this has been fixed for the included vs code themes

@mjbvz mjbvz closed this as completed Jun 15, 2017
@mwmcode
Copy link

mwmcode commented Nov 14, 2017

This feature is missing from November version (1.18)!?

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

No branches or pull requests

4 participants