atom-react icon indicating copy to clipboard operation
atom-react copied to clipboard

An apostrophe breaks syntax highlighting

Open dmnd opened this issue 10 years ago • 66 comments

Looks like the grammar thinks it's a Javascript string even when it's in the JSX part of the file:

image

dmnd avatar Jun 26 '14 17:06 dmnd

screenshot 2014-06-28 12 33 37

Sorry for the delay! Published a new version and it should be fixed now. Feel free to reopen if the problem persists.

orktes avatar Jun 28 '14 09:06 orktes

:smiley:

dmnd avatar Jun 28 '14 19:06 dmnd

image

Looks like there's still an issue. This is 0.12.10.

rkovacevic avatar Nov 28 '15 11:11 rkovacevic

screen shot 2015-12-10 at 22 27 27

Still an issue on Atom 1.2.4 and atom-react 0.12.10

reneklacan avatar Dec 10 '15 21:12 reneklacan

also, text inside JSX elements gets keyword highlighting:

image

dmnd avatar Dec 10 '15 21:12 dmnd

@dmnd can you reopen this issue please?

reneklacan avatar Dec 10 '15 21:12 reneklacan

:+1:

reneklacan avatar Dec 10 '15 21:12 reneklacan

I can't find how to reopen, so I just created #124.

dmnd avatar Dec 10 '15 21:12 dmnd

This is still an issue. Is anyone working on the problem? screen shot 2016-04-20 at 1 32 21 pm

jesskrich avatar Apr 20 '16 17:04 jesskrich

It seems to regress often. Whoever fixes it should try to add a regression test too. On Wed, Apr 20, 2016 at 10:33 Jessie Richardson [email protected] wrote:

This is still an issue. Is anyone working on the problem? [image: screen shot 2016-04-20 at 1 32 21 pm] https://cloud.githubusercontent.com/assets/9681896/14684142/69cb5666-06fc-11e6-8503-a06bdf8936b4.png

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/orktes/atom-react/issues/3#issuecomment-212527752

dmnd avatar Apr 20 '16 17:04 dmnd

I've noticed that adding a . on the same line before the apostrophe is sometimes responsible for triggering this.

Macil avatar May 04 '16 23:05 Macil

I also have this problem

pezza3434 avatar May 05 '16 06:05 pezza3434

I have this problem right now too - despite an escape even screen shot 2016-05-23 at 17 30 19

taygrave avatar May 24 '16 00:05 taygrave

I am having this issue too so I've decided against using apostrophes. I just hope the grammar police don't come calling.

willhalling avatar May 25 '16 12:05 willhalling

Any update on this?

joelwass avatar Jul 07 '16 02:07 joelwass

Running into this issue as well, I am coerced into foregoing apostrophes :( Any updates?

syntacticsugar avatar Jul 12 '16 19:07 syntacticsugar

The struggle is still real. Any ideas?

mmperryman avatar Jul 29 '16 13:07 mmperryman

Same issue in my project

leanhdaovn avatar Jul 30 '16 08:07 leanhdaovn

if i use this ’, instead of this ' it works. Not sure if it's grammatically right and allowed. image

amit-coditas avatar Aug 02 '16 12:08 amit-coditas

Same issue here

jgnieuwhof avatar Aug 05 '16 02:08 jgnieuwhof

Same issue for me. A temporary work around is to use ' instead of '.

fakkio avatar Aug 19 '16 17:08 fakkio

I'm having this issue too.

Workaround: put the text in a JavaScript var and insert it into JSX with the {} notation:

  render() {
    const title = "Don't worry, be happy!";
    return (
      <div>
        <h1>{title}</h1>
      </div>
    );
  }

joshuadutton avatar Sep 01 '16 19:09 joshuadutton

This is really bothersome :(

mu-arch avatar Sep 17 '16 02:09 mu-arch

Yes, this is a sad limitation (FOR SUCH A GREAT EDITOR), makes a component almost unusable any time we need someone's stuff to have an apostrophe :-(

sendittokeith avatar Sep 28 '16 21:09 sendittokeith

decorative apostrophe ftw

andrewsunglaekim avatar Sep 29 '16 03:09 andrewsunglaekim

Dirty workaround : use &apos;entity 👎

julienbornstein avatar Oct 07 '16 23:10 julienbornstein

More workarounds with backticks or double quotes:

<span>
  I{`'`}m a workaround. Let{"'"}s get some frosty chocolate milkshakes!
</span>
<span>
  {`Or y'all can just wrap text like this. It's not ideal, but it'll do.`}
</span>

rchanou avatar Oct 07 '16 23:10 rchanou

I have the same problem, any updates? sans titre

kengres avatar Nov 19 '16 20:11 kengres

I'm having the same issue as @kengres.

ghost avatar Nov 28 '16 19:11 ghost

Sames. Question mark also causes a problem - doesn't error-highlight subsequent text but stops syntax highlighting

mattfysh avatar Nov 29 '16 00:11 mattfysh

same as @kengres.

proftom avatar Nov 30 '16 05:11 proftom

I have been working around the issue by adding a double apostrophe or double single quotes

srinath-ragh avatar Dec 04 '16 01:12 srinath-ragh

Rest of team uses WebStorm and (understandably) don't want workarounds for atom-react in the code. Can we get word on if you guys have seen this issue and if its being prioritised? thanks

mattfysh avatar Dec 06 '16 03:12 mattfysh

@proftom @srinath-ragh @justinzelinsky I've installed a package called language-babel and the issue is gone...

kengres avatar Dec 06 '16 07:12 kengres

related issue... https://github.com/orktes/atom-react/issues/212 Also looks like language-babel is no longer supported. Wish I had some free time to help with a fix!

mattfysh avatar Dec 07 '16 04:12 mattfysh

I'm hitting this bug as well. It was first reported two and a half years ago!

In the meantime I'm working around it by doing this {"'"} when I need a single parenthesis.

OriginalPenguin avatar Dec 14 '16 01:12 OriginalPenguin

I'm encountering this as well. I hoped this gets resolved soon. @OriginalPenguin's workaround is ingenious, so thanks for that!

jedau avatar Dec 16 '16 08:12 jedau

This was a problem for me, too. Then I switched the language to JavaScript (JSX) and it started working. The only remaining problem is that syntax highlighting still breaks when the apostrophe isn't followed by another character. So something like dogs' would not work.

thuey avatar Dec 22 '16 15:12 thuey

Actually, a co-worker discovered the language-babel plugin handles the trailing apostrophe as well.

thuey avatar Dec 22 '16 17:12 thuey

Still not working...

screen shot 2017-01-10 at 01 23 48

TuiKiken avatar Jan 09 '17 22:01 TuiKiken

Issue is still around in 2017

chuckhacker avatar Jan 20 '17 02:01 chuckhacker

Switch to language-babel ... much nicer On Fri, 20 Jan 2017 at 1:13 pm, Charles Moyes [email protected] wrote:

Issue is still around in 2017

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/orktes/atom-react/issues/3#issuecomment-273958233, or mute the thread https://github.com/notifications/unsubscribe-auth/AAcs8rHjaklZYH_mYN1ekLmvpSnUdTXfks5rUBgygaJpZM4CH72o .

mattfysh avatar Jan 20 '17 02:01 mattfysh

@orktes Any updates to this?

wlingke avatar Jan 26 '17 00:01 wlingke

language-babel is the way to go, thanks for the recommendation

dovinmu avatar Feb 03 '17 01:02 dovinmu

How is this a thing?

ryan-DESIGN avatar Apr 13 '17 13:04 ryan-DESIGN

I would suggest installing language-bable package.

eldiyar7 avatar May 16 '17 15:05 eldiyar7

Why does this issue still exist...? just ran into it...

lenichols avatar May 31 '17 04:05 lenichols

Good, it's not just me. Was really annoying. Installing Language-babel solved the issue.

andrewasfa avatar Jun 01 '17 10:06 andrewasfa

I believe this post on Stack Overflow should help. https://stackoverflow.com/q/32979512

...
return (
   <div>
     <p>{"I've seen the movie."}</p>
   </div>
 )
...

benjaminu avatar Jul 04 '17 15:07 benjaminu

@orktes I guess you can close this one. As @kengres mentioned long ago there is a solution for this. Installing language-babel on current 1.18.0 version (and assume that also on others) fixes the issue

vinagrito avatar Jul 07 '17 11:07 vinagrito

Is there a reason to use this project in 2017? All features from atom-react are native in Atom except the code snippets.

nathan-charrois avatar Jul 31 '17 18:07 nathan-charrois

@NathanCH Atom doesn't include proper indentation support (nested tags and attributes), highlighting and tag auto completion by default.

orktes avatar Aug 01 '17 07:08 orktes

language-babel solves this issue

faltysad avatar Nov 18 '17 16:11 faltysad

Our workaround is to use &apos;

montanaflynn avatar Dec 19 '17 19:12 montanaflynn

@kengres 's methods really work. don't waste time guys

terry-pan-dev avatar Jan 23 '18 00:01 terry-pan-dev

this code is usefull for me. you can use it as follow : <p>Let{"'"}s start by getting to know your business...</p>

ashishtalele avatar Mar 01 '18 13:03 ashishtalele

I installed language-babel and it resolved the issue for me.

https://atom.io/packages/language-babel\

restart Atom after install.

nsellers avatar Mar 07 '18 16:03 nsellers

use different class like Constant.js

declare your text there:

export const TEXT = 'Didn`t find what you want?';

and in your app.js use like this

import { TEXT } from '../Constants';

<Text>{TEXT}</Text>

ZeroCool00 avatar Mar 28 '18 09:03 ZeroCool00

Another workaround: {'We won\'t do anything with you email. It\'s just to prevent spam.'}

A bit cleaner than the others suggested.

lukebrandonfarrell avatar Apr 06 '18 15:04 lukebrandonfarrell

Just downloaded Atom yesterday and this is an issue for me as well :(

lienne avatar Jun 06 '18 20:06 lienne

Follow @nseller's suggestion

https://github.com/orktes/atom-react/issues/3#issuecomment-371200678

benjaminu avatar Jun 06 '18 21:06 benjaminu

Thanks! That worked wonders! :)

lienne avatar Jun 06 '18 21:06 lienne

language-babel

Additional not breaking style alternative: https://atom.io/packages/react

ivanm376 avatar Jul 31 '18 11:07 ivanm376

nseller's comment worked but I had to uninstall atom-react.

StructByLightning avatar Sep 12 '18 02:09 StructByLightning

language-babel worked, and I didn't have to uninstall atom-react OR restart Atom. Cool!

nataliecardot avatar Sep 26 '18 02:09 nataliecardot

I uninstalled atom-react and installed language-babel, and I'm still having this issue with both, even after uninstalling.

image

Edit: Looks like it works as long as I don't use the shorthand syntax and still include the parenthesis in the return: image

alexanderconner avatar Oct 09 '18 23:10 alexanderconner