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

Syntax highlighting for JSX not working for React-Native (when JavaScript Atom Grammar is installed) #35532

Closed
agm1984 opened this issue Oct 3, 2017 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *caused-by-extension Issue identified to be caused by an extension javascript JavaScript support issues verified Verification succeeded
Milestone

Comments

@agm1984
Copy link

agm1984 commented Oct 3, 2017

  • VSCode Version: V 1.16.1
  • OS Version: Win 10 Pro

Steps to Reproduce:

  1. Open React-Native project in VS Code
  2. Type JSX

Reproduces without extensions: No

I just ran code --disable-extensions and my colours came back. I found the extension that was causing it: JavaScript Atom Grammar: https://marketplace.visualstudio.com/items?itemName=ms-vscode.js-atom-grammar

Here is a screenshot of a few minutes ago before it was working; only the primitive works.

vscode1

Therefore, this issue is now simply an alert to let you know that this is real and probably happens to others. I am happy to send any other specs as requested.

Here are my user settings:

{
    "atomKeymap.promptV3Features": true,
    "editor.multiCursorModifier": "ctrlCmd",
    "editor.formatOnPaste": true,
    "editor.snippetSuggestions": "top",
    "editor.tabSize": 4,
    "emmet.includeLanguages": {
        "javascript": "javascriptreact"
    },
    "files.associations": {
        "*.js": "javascriptreact"
    },
    "git.enableSmartCommit": true,
    "workbench.iconTheme": "material-icon-theme",
    "workbench.startupEditor": "newUntitledFile"
}

I'm pretty sure that extension was sprinkling syntax highlighting issues elsewhere in my experience also. I highly recommend taking a look at it with respect to its propensity to create such issues. Thanks!

@vscodebot vscodebot bot assigned mjbvz Oct 3, 2017
@vscodebot vscodebot bot added the javascript JavaScript support issues label Oct 3, 2017
@agm1984
Copy link
Author

agm1984 commented Oct 3, 2017

P.S. I also really want word highlighting to work in the minimap when I double click words (ie: highlight all instances of that word). Please increase the tally by 1 for that feature.

This extension works amazing, but I want this to carry into the minimap also: https://marketplace.visualstudio.com/items?itemName=rsbondi.highlight-words

I know others are requesting it also, and I see you are the syntax wizard mjbvz. :) Please relay our concerns to the mothership.

@agm1984 agm1984 changed the title Syntax highlighting for JSX not working for React-Native Syntax highlighting for JSX not working for React-Native (when JavaScript Atom Grammar is installed) Oct 5, 2017
@mjbvz mjbvz assigned aeschli and unassigned mjbvz Oct 9, 2017
@mjbvz mjbvz added the *caused-by-extension Issue identified to be caused by an extension label Oct 9, 2017
@mjbvz
Copy link
Contributor

mjbvz commented Oct 9, 2017

Hey @aeschli, this looks like an issue with the atom language extension. Can you please take a look. Also, any reason why the repo for that extension is private?


@agm1984 I believe that is tracked by #21404 Please open a new issue / feature request if #21404 does not cover what you are looking for

@aeschli
Copy link
Contributor

aeschli commented Oct 9, 2017

I updated the grammar to the latest and made the repo public.
The Atom grammar we publish in that extension doesn't handle JSX, Atom has a different grammar for that. But the extension contributes the grammar for languageId javascript, so JavaScript React should not be affected. So there's a bug there.

The problem is that javascript and javascript react both use source.js as root scope name. The textmate engine uses that scope name as grammar identifier.
@mjbvz Matt I think it would be good to use source.jsx for JavaScript react.

@mjbvz mjbvz self-assigned this Oct 9, 2017
@mjbvz
Copy link
Contributor

mjbvz commented Oct 9, 2017

Thanks @aeschli! Yes we should be able to do that since we already have separate scopes for ts and tsx. I'll look into it for this month

@mjbvz mjbvz added this to the October 2017 milestone Oct 9, 2017
@aeschli
Copy link
Contributor

aeschli commented Oct 10, 2017

Thanks @mjbvz! In order to keep JavaScript specific rules in themes working, 'source.js.jsx' might be a good choice.

@mjbvz mjbvz added the bug Issue identified by VS Code Team member as probable bug label Oct 10, 2017
@mjbvz mjbvz closed this as completed in 63ecf01 Oct 10, 2017
@amackintosh
Copy link

Nice forensic work, thanks

sandy081 pushed a commit that referenced this issue Oct 16, 2017
…when overriding plain old javascript grammar

Fixes #35532
@aeschli aeschli added the verified Verification succeeded label Nov 3, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 24, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug *caused-by-extension Issue identified to be caused by an extension javascript JavaScript support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants
@aeschli @mjbvz @agm1984 @amackintosh and others