]> code.delx.au - gnu-emacs-elpa/blobdiff - js2-mode.el
Add js2-jsx-mode
[gnu-emacs-elpa] / js2-mode.el
index 643e921ce1962a7f52503fc9a5986c9d6ee0ed43..dd97aba50f694b845d31283e7cf4b81ccf09e111 100644 (file)
@@ -11373,6 +11373,17 @@ Selecting an error will jump it to the corresponding source-buffer error.
 
   (js2-reparse))
 
+;; We may eventually want js2-jsx-mode to derive from js-jsx-mode, but that'd be
+;; a bit more complicated and it doesn't net us much yet.
+;;;###autoload
+(define-derived-mode js2-jsx-mode js2-mode "JSX-IDE"
+  "Major mode for editing JSX code.
+Like `js-jsx-mode', which see.
+Indentation support requires Emacs 25+ (or the latest js.el)."
+  ;; Feature-detect JSX indentation support (in js-mode from Emacs 25+).
+  (if (fboundp 'js-jsx-indent-line)
+      (set (make-local-variable 'indent-line-function) #'js-jsx-indent-line)))
+
 (defun js2-mode-exit ()
   "Exit `js2-mode' and clean up."
   (interactive)