From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Danny Freeman via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#65134: [PATCH] * lisp/progmodes/js.el Fix js-ts-mode indent bug in JSX expressions Date: Mon, 07 Aug 2023 16:10:13 -0400 Message-ID: <87tttak40q.fsf@dfreeman.email> Reply-To: Danny Freeman Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25180"; mail-complaints-to="usenet@ciao.gmane.io" Cc: v.pupillo@gmail.com To: 65134@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 07 22:11:38 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qT6Zl-0006OW-PZ for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 07 Aug 2023 22:11:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qT6ZF-0002gr-AA; Mon, 07 Aug 2023 16:11:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qT6ZD-0002gE-Ej for bug-gnu-emacs@gnu.org; Mon, 07 Aug 2023 16:11:03 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qT6ZD-00055I-5D for bug-gnu-emacs@gnu.org; Mon, 07 Aug 2023 16:11:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qT6ZC-0000KO-Pl for bug-gnu-emacs@gnu.org; Mon, 07 Aug 2023 16:11:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Danny Freeman Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Aug 2023 20:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 65134 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16914390361211 (code B ref -1); Mon, 07 Aug 2023 20:11:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Aug 2023 20:10:36 +0000 Original-Received: from localhost ([127.0.0.1]:34435 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qT6Yl-0000JT-HV for submit@debbugs.gnu.org; Mon, 07 Aug 2023 16:10:35 -0400 Original-Received: from lists.gnu.org ([2001:470:142::17]:45846) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qT6Yh-0000JC-02 for submit@debbugs.gnu.org; Mon, 07 Aug 2023 16:10:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qT6Ya-0002cR-VV for bug-gnu-emacs@gnu.org; Mon, 07 Aug 2023 16:10:24 -0400 Original-Received: from out-107.mta1.migadu.com ([2001:41d0:203:375::6b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qT6YY-0004sT-Ox for bug-gnu-emacs@gnu.org; Mon, 07 Aug 2023 16:10:24 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dfreeman.email; s=key1; t=1691439017; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=TthWi/UhWihvYRh10Ul72RXmsiLv1RzJIl+URtczXkM=; b=ZMmzDNb7ql33M0bYVeCOsny1SRAcxEr9gY5iMUeREbR7ixpJvMVnCVBdlaV6siEykHuCPh huBZhcf5T+Tj40Hmz2dIISSO+VeXTPrUGPS8qlaHDHbsvC3vSYKYYkjLXOUCbujeZhbm+1 O9sGHkULSvm825Kd9ZKJuc8QGC4yy/Y= X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:203:375::6b; envelope-from=danny@dfreeman.email; helo=out-107.mta1.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:266902 Archived-At: --=-=-= Content-Type: text/plain Tags: patch Hello, I have a patch for a bug I found in js-ts-mode. When editing jsx blocks, the indentation does not work. For example, in a file with the following file with JSX code in it and js-ts-mode enabled ``` function App() { return (
); } ``` placing your cursor at the end of the opening div tag and pressing ENTER does not indent, instead there is no indentation. This patch corrects that by properly expanding the `js-jsx--treesit-indent-compatibility-bb1f97b' function, which returns some indent rules. --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-lisp-progmodes-js.el-Fix-js-ts-mode-indent-bug-in-JS.patch >From c13be16dd796c981455e99af5597d7861ed10631 Mon Sep 17 00:00:00 2001 From: dannyfreeman Date: Mon, 7 Aug 2023 15:55:27 -0400 Subject: [PATCH] * lisp/progmodes/js.el Fix js-ts-mode indent bug in JSX expressions Properly expand the indentation rules. Before this change, treesit indent mechanisms were trying to call this compatability 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." --- lisp/progmodes/js.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index f2d7d3d3ecb..c7a031697f1 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -3474,7 +3474,7 @@ js--treesit-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) -- 2.40.1 --=-=-= Content-Type: text/plain Thank you, -- Danny Freeman --=-=-=--