mooz/js2-mode

Automatically detect JSX in Emacs 27 outside js2-minor-mode

jacksonrayhamilton opened this issue · 1 comments

If, for the sake of Emacs 27 users,

  • #527 was completed, such that code with JSX could be linted, and/or
  • #528 was completed, such that JSX code could be highlighted outside js2-minor-mode, and/or
  • #529 was completed, such that JSX code could be indented outside js2-minor-mode,

then, in the interest of not treating JS code as JSX code too eagerly, and in staying consistent with the behavior of the child js-mode, js2-mode could hinge its support of parsing and handling JSX code on the detection of the use of JSX in the code.

Actually, the detection logic will already be inherited by the body of the js-mode function, so some of that work is already done. This issue proposes that we finish the job by making the following changes:

  • Add (js-use-syntactic-mode-name) to the body of the js2-mode function (originally proposed here), so that the state of JSX support is made apparent to the user
  • Refactor js2-jsx-mode to behave more like js-jsx-mode in Emacs 27 (originally proposed here)
  • Document the nature of this detection in js2-mode by referring back to js-mode’s documentation thereof

I'm okay with that. Anyway, the big part is integrating rjsx-mode.