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

Proper JSX support in the code editor #19

Closed
sapegin opened this issue Oct 13, 2015 · 11 comments
Closed

Proper JSX support in the code editor #19

sapegin opened this issue Oct 13, 2015 · 11 comments

Comments

@sapegin
Copy link
Member

sapegin commented Oct 13, 2015

Try something like this.

@sapegin sapegin added the bug label Oct 13, 2015
@mik01aj
Copy link
Collaborator

mik01aj commented Nov 4, 2015

+1. It looks ugly :)

image

@sapegin
Copy link
Member Author

sapegin commented Nov 5, 2015

Looks like it doesn’t help much :-(

@sapegin
Copy link
Member Author

sapegin commented Nov 6, 2015

The best I could achieve so far:

@mik01aj
Copy link
Collaborator

mik01aj commented Nov 7, 2015

Much better than it was. Thanks 👍

@mik01aj
Copy link
Collaborator

mik01aj commented Nov 10, 2015

Have you tried https://github.com/antimatter15/codemirror-jsx? // EDIT: I see that the timbur's version that you tried is actually a fork of this one. So maybe it's not even worth trying...

And codemirror/codemirror5#3122 is still open, we might get something useful from there later.

Also notice that on http://gaearon.github.io/react-hot-loader/ they do have CodeMirror with proper JSX support, so it's definitely possible. That's how they init the CodeMirror:

this.editor = CodeMirror.fromTextArea(this.refs.editor.getDOMNode(), {
      mode: 'javascript',
      lineNumbers: false,
      lineWrapping: true,
      smartIndent: false,  // javascript mode does bad things with jsx indents
      matchBrackets: true,
      theme: 'solarized-light',
      readOnly: this.props.readOnly,
      tabWidth: 2
    });

And if all fails, I see a workaround:

.cm-error { background: none; }

@sapegin
Copy link
Member Author

sapegin commented Nov 10, 2015

They highlight most of the JSX in one color:

But we can apply the same hack with hiding error.

sapegin added a commit that referenced this issue Nov 18, 2015
Hack to make JSX highlighting better. #19.
@sapegin
Copy link
Member Author

sapegin commented Dec 1, 2015

I’m closing it until CodeMirror has proper support.

@sapegin sapegin closed this as completed Dec 1, 2015
@petetnt
Copy link
Contributor

petetnt commented Jan 5, 2016

@sapegin @mik01aj Just pinging you that CodeMirror has proper support as of codemirror/codemirror5@b3f9487

@sapegin
Copy link
Member Author

sapegin commented Jan 5, 2016

@petetnt Cooooooool! Thanks!

@sapegin sapegin reopened this Jan 5, 2016
@petetnt
Copy link
Contributor

petetnt commented Jan 5, 2016

Oh yeah forgot to add that codemirror/codemirror5#3745 tracks the issues the mode still might have (it has gotten some great updates in the past few days too) 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants