From: dannyfreeman <danny@dfreeman.email>
Date: Mon, 7 Aug 2023 19:55:27 +0000 (-0400)
Subject: Properly expand the JSX indentation rules in 'js-ts-mode'
X-Git-Tag: emacs-29.1.90~225
X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=71bc060e4031bee83ec79354bff526fa8a27a81d;p=emacs.git

Properly expand the JSX indentation rules in 'js-ts-mode'

* lisp/progmodes/js.el (js--treesit-indent-rules): Fix
'js-ts-mode' indent bug in JSX expressions. Before this
change, treesit indent mechanisms were trying to call this
compatibility function like a matching or anchor rule.
This resulted in an error when running `indent-for-tab-command`
while the cursor was in a JSX expression:

treesit--simple-indent-eval: Wrong number of
arguments: ((cl-struct-js--pitem-tags ido-cur-list t) nil "Indent rules
helper, to handle different releases of tree-sitter-javascript."

(Bug#65134)
---

diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index bbe3159f596..c583b6f6191 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3474,7 +3474,7 @@ Check if a node type is available, then return the right indent rules."
        ((parent-is "statement_block") parent-bol js-indent-level)
 
        ;; JSX
-       (js-jsx--treesit-indent-compatibility-bb1f97b)
+       ,@(js-jsx--treesit-indent-compatibility-bb1f97b)
        ((node-is "jsx_closing_element") parent 0)
        ((match "jsx_element" "statement") parent js-indent-level)
        ((parent-is "jsx_element") parent js-indent-level)