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 issue with Atom 1.6 #148

Closed
armed opened this issue Mar 18, 2016 · 18 comments
Closed

Syntax highlighting issue with Atom 1.6 #148

armed opened this issue Mar 18, 2016 · 18 comments

Comments

@armed
Copy link

armed commented Mar 18, 2016

Tags is not highlighted when JSX inside parentheses:
screen shot 2016-03-18 at 4 55 28 pm

But highlights if without parentheses:
screen shot 2016-03-18 at 5 00 17 pm

@sompylasar
Copy link

The issue appears in 0.14.1 and does not appear in 0.14.0.

@sompylasar
Copy link

This commit, besides the README change, is the only change between 0.14.0 and 0.14.1 (refs #138).

@levrik
Copy link

levrik commented Mar 20, 2016

I can add that the auto closing is not working anymore since Atom 1.6

sompylasar added a commit to sompylasar/atom-react that referenced this issue Mar 20, 2016
The match proposed in orktes@c267e8e somehow prevents the lines inside a pair of following parentheses from being parsed as JSX; the parser falls back to plain JS where angle brackets are highlighted as operators. This causes orktes#148

The match in this fix embraces the whole expression and instructs to parse its contents with nested patterns which include JSX.
@sompylasar
Copy link

A duct tape fix here: #149
Either TextMate grammars are crap in terms of describing nested language constructs, or grammar developers can't grasp the concepts that enable doing it properly.

sompylasar added a commit to sompylasar/atom-react that referenced this issue Mar 20, 2016
Fix tests to pass on types of numeric constants.
@orktes
Copy link
Owner

orktes commented Mar 20, 2016

Hi! This should be fixed in v0.14.2.

@orktes
Copy link
Owner

orktes commented Mar 20, 2016

Closing for now! Feel free to reopen if issues persist.

@orktes orktes closed this as completed Mar 20, 2016
@sompylasar
Copy link

@orktes thank you for the more generic fix, which is here in case someone is interested (referencing an issue from a commit really helps).

I can't verify the fix because of a funny bug: I've accidentally installed the facebook/react library instead of this package via apm install [email protected]. And I'm still struggling to get rid of it to no avail, it got cached somewhere. For the future, you should really consider changing the published name to something like atom-react in the Atom Package Directory.

@orktes
Copy link
Owner

orktes commented Mar 20, 2016

True! normally I try to remember do that but only noticed the existence of this issue after pushing. Nowadays it seems to be possible to rename packages in a way that request to the old package get redirected to the new one (upgrades etc.). So not a bad idea! I'll look into it.

@sompylasar
Copy link

@orktes the wrong react got cached in ~/.atom/.apm, resolved after removing that directory. (atom/apm#529)

@ilyapalkin
Copy link

@sompylasar @orktes Highlighting doesn't work for [email protected] and Atom 1.6.0:

  • JSX file is considered as Plain Text

Highlighting is broken for [email protected]

  • JSX file is considered as JavaScript (JSX)

It works for [email protected]

  • JSX file is considered as JavaScript (JSX)

@silvenon
Copy link

@ilyapalkin Atom sometimes saves the grammar you previously set for that file (i.e. what the broken [email protected] set for you). All my new JSX files are loaded with the proper grammar in 0.14.2.

@ilyapalkin
Copy link

@silvenon in version 0.14.1 it sets JavaScript (JSX) and higlighting looks similar to #148 (comment):

image

When I install 0.14.2 there is no JavaScript (JSX) grammar at all.

@silvenon
Copy link

I have no idea why this would happen, have you tried reinstalling the package?

@vaclavsvejcar
Copy link

@silvenon I have the same issue with 0.14.2, reinstalling does not help. With 0.14.2, I can't even select the Javascript (JSX) mode (not available in the modes list). When I downgrade to 0.14.0 or 0.14.1, the Javascript (JSX) mode is available, though the syntax highlighting is broken exactly same as @ilyapalkin showed on screenshot.

Tested on Atom 1.6.0, OS X 10.11.3

@sompylasar
Copy link

This is probably the same issue I encountered here. Try removing ~/.atom/.apm and then do a fresh install via GUI.

@vaclavsvejcar
Copy link

@sompylasar you're right, thanks, cleaning ~/.atom/.apm/react was sufficient and solved the issue for me

@ilyapalkin
Copy link

cleaning ~/.atom/.apm/react was sufficient and solved the issue for me

+1

@enriquecaballero
Copy link

Some weird stuff is happening again.

screen shot 2016-04-08 at 12 24 07 am

Not sure if the import statements, along with the class definition, should look like that.

I'm on Atom 1.6.2 with the 0.15.0 react package, on OS X 10.11.4.

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

8 participants