summaryrefslogtreecommitdiff
path: root/lisp/progmodes/js.el
diff options
context:
space:
mode:
authorTheodor Thornhill <theo@thornhill.no>2022-12-17 23:11:57 +0100
committerYuan Fu <casouri@gmail.com>2022-12-17 15:35:48 -0800
commit9fcf764dd73449fb469a7c7eb29aec3c06cdf067 (patch)
treee4be882d682562397e6ec5ff2bfd12d9bcb29aaf /lisp/progmodes/js.el
parent69f2c71135f8bc89cf4d816fd5f4c2b0a0e30469 (diff)
downloademacs-9fcf764dd73449fb469a7c7eb29aec3c06cdf067.tar.gz
Indentation fixes for jsx/tsx (bug#60169)
* lisp/progmodes/js.el (js--treesit-indent-rules): Simplify the rules. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--indent-rules): Simplify the rules.
Diffstat (limited to 'lisp/progmodes/js.el')
-rw-r--r--lisp/progmodes/js.el11
1 files changed, 5 insertions, 6 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index a776ff91f9b..8c1ee495c2d 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3451,14 +3451,13 @@ This function is intended for use in `after-change-functions'."
((parent-is "statement_block") parent-bol js-indent-level)
;; JSX
- ((parent-is "jsx_opening_element") parent js-indent-level)
- ((match "<" "jsx_fragment") parent 0)
- ((parent-is "jsx_fragment") parent js-indent-level)
+ ((node-is "jsx_fragment") parent typescript-ts-mode-indent-offset)
+ ((node-is "jsx_element") parent typescript-ts-mode-indent-offset)
+ ((node-is "jsx_expression") parent typescript-ts-mode-indent-offset)
+ ((node-is "jsx_self_closing_element") parent typescript-ts-mode-indent-offset)
((node-is "jsx_closing_element") parent 0)
- ((node-is "jsx_text") parent js-indent-level)
- ((parent-is "jsx_element") parent js-indent-level)
((node-is "/") parent 0)
- ((parent-is "jsx_self_closing_element") parent js-indent-level)))))
+ ((node-is ">") parent 0)))))
(defvar js--treesit-keywords
'("as" "async" "await" "break" "case" "catch" "class" "const" "continue"