mxw / vim-jsx

React JSX syntax highlighting and indenting for vim.
1.59k stars 95 forks source link

Apostrophes not supported? #46

Closed kendagriff closed 7 years ago

kendagriff commented 9 years ago

Syntax gets goofed up when using apostrophes:

screen shot 2015-05-19 at 11 32 54 am

tecfu commented 9 years ago

How about when you escape the apostrophe as in

<Header> You\'s is my name.</Header>
kendagriff commented 9 years ago

screen shot 2015-05-20 at 6 39 18 am

Still the same. Perhaps it's a plugin conflict?

mxw commented 9 years ago

Just double-quote the whole raw string. Handling raw strings with single quotes is unsupported at present.

dickfickling commented 9 years ago

Sorry, why was this closed? Double-quoting the raw string would cause the double quotes to appear in the final HTML. You said it's "unsupported at present" - isn't that exactly why you'd want to keep it open?

mxw commented 9 years ago

@richardfickling—When I implemented the syntax file, I pointedly made it so that quoted strings were highlighted as JS strings when they were the children of JSX nodes. I think it used to be the case that string literal children would be interpreted as string literals, rather than having their surrounding quotes escaped and made part of the string... either this was never the case, or it is no longer the case.

Supporting both string-literals-as-children and quotes-embedded-in-bare-strings was a wontfix, but since the former is no longer correct, the fix is easy—I'll have it up shortly.

davidjb commented 7 years ago

Seeing the same results (with the latest master) as @kendagriff's screenshots when apostrophe characters are used -- could this be reopened?

mxw commented 7 years ago

Whoops, I didn't actually mean to reopen this. I can't repro; can you read the README and then take the outlined steps?

davidjb commented 7 years ago

Sorry for the noise, it was a conflict between setting filetype; my vimrc set it and vim-jsx sets it too.