codemirror5: Failing cases in JSX mode
Following up on: https://github.com/codemirror/CodeMirror/pull/3742
Three from the jsx/index.html page:
- Boolean attributes are not recognized properly (note the red self-closing
/>)
- Block comments styled incorrectly (should be the brown comment color)
- Line comments are not recognized properly (note the red self-closing
/>)
Two other things I’ve found:
4 . Elements should be allowed as attributes

5 . Indentation in JS expressions should be relative to the indentation level of JSX elements. I believe currently they get indented to prior JS indentation level. (this issue is highest priority, if I had to choose)
Current behavior gif here:

Correct position here:

Another example of current behavior (not followed by } char):

Correct position here:

About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 21 (16 by maintainers)
Commits related to this issue
- [jsx mode] Support JS comments Issue #3745 — committed to codemirror/codemirror5 by marijnh 9 years ago
- [xml mode] Allow more direct access to configuration Use it to enable value-less attributes in the JSX mode Issue #3745 — committed to codemirror/codemirror5 by marijnh 9 years ago
- [jsx mode] Improve indentation of nested JavaScript Kludge the xml indentation to ignore inside-tag positions, and properly set start indentation state in javascript mode. Issue #3745 — committed to codemirror/codemirror5 by marijnh 9 years ago
- [jsx mode] Only recognize comments inside of tags Issue #3745 — committed to codemirror/codemirror5 by marijnh 9 years ago
- [jsx mode] Support tag attributes Issue #3745 — committed to codemirror/codemirror5 by marijnh 9 years ago
- [javascript mode] Allow expressions after fat arrow Issue #3745 — committed to codemirror/codemirror5 by marijnh 9 years ago
- [javascript mode] Allow trailing comma in object destructure Issue #3745 — committed to dabbott/CodeMirror by dabbott 9 years ago
- [javascript mode] Allow trailing comma in object destructure Issue #3745 — committed to dabbott/CodeMirror by dabbott 9 years ago
- [javascript mode] Allow trailing comma in object destructure Issue #3745 — committed to codemirror/codemirror5 by dabbott 9 years ago
- [jsx mode] Return empty token when switching inner modes So that addModeClass sees the right mode for the token Issue #3745 — committed to codemirror/codemirror5 by marijnh 8 years ago
- [jsx mode] Improve indention of js blocks Issue #3745 — committed to dabbott/CodeMirror by dabbott 8 years ago
- [jsx mode] Improve indention of js blocks Issue #3745 — committed to codemirror/codemirror5 by dabbott 8 years ago
I don’t really understand why, if there’s already all this. I’m not saying the code should be physically copied, but enabling the Javascript syntax should IMO also enable JSX… especially if TypeScript and others are also already enabled.