Received: (at 76704) by debbugs.gnu.org; 9 Mar 2025 10:00:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 09 06:00:29 2025 Received: from localhost ([127.0.0.1]:58440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1trDSO-00065G-Pg for submit <at> debbugs.gnu.org; Sun, 09 Mar 2025 06:00:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48564) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1trDSN-000650-7N for 76704 <at> debbugs.gnu.org; Sun, 09 Mar 2025 06:00:27 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1trDSH-0001sq-31; Sun, 09 Mar 2025 06:00:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Z6Qqot/kDbyo5g5CPGNeWs2GCwsIe9N/BwZCxfQ0/zU=; b=n67fXmLiF+rs MgBvDWBJlGAFtVnXyoj9B0C1rj2vN4iyIQSAUfad0M1V/+J0IzQ6J3AZbJnQH9x/wl59nobOFR/ND GPBLAQZAxsvbJy+8DiDa2z9OJcPE2etCwPv1lybTObHutdQ6gFWb/szSRJ0fIJI5mgPozki3sZ4j2 zRK93GXJm0FvDt8fcMa826z008qL2sAzSmknTCXNqj2e23KUJ2UIc8MgD9HSzji38mk8m5d6BqG0B 52AEtDq7ucbregb3M8Sd/9uTPZueCAOqKliN0C39TTFUN/wBJ63o+icTZL9yc8msukLShStKPeRpi gw8x8qiWmvIAotufuqhXlQ==; Date: Sun, 09 Mar 2025 12:00:16 +0200 Message-Id: <861pv6h6bz.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Fabian Brosda <f.brosda@HIDDEN>, Juri Linkov <juri@HIDDEN>, Vincenzo Pupillo <v.pupillo@HIDDEN> In-Reply-To: <871pvfkyjc.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN) Subject: Re: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode References: <871pvfkyjc.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 76704 Cc: 76704 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Date: Sun, 02 Mar 2025 20:44:39 +0100 > From: Fabian Brosda via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> > > Hi, > > when using js-ts-mode instead of js-mode, braces, which are put on a > separate line are indented one level too much. Here is a simple example > of how the indentation looks like, after using indent-region on the > whole function: > > ``` > function test(x) > { > if(x) > { > return a; > } > else > { > return b; > } > } > > ``` > > The used tree-sitter grammar is downloaded from > https://github.com/tree-sitter/tree-sitter-javascript. > > Having braces on a separate line is probably not the most common for > javascript, but using indent-region in the js-mode, does yield the > expected result. The js.el file does already contain a comment > mentioning braces in js--treesit-indent-rules. But even based on the > git history it is not clear to me, what exactly is meant: > > ``` > ;; "{" on the newline. > ((node-is "statement_block") parent-bol js-indent-level) > ``` > > Link: https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/js.el#L3457 > > If I replace 'js-indent-level' with '0' in this line, the indentation would > be correct, but this might have unwanted side-effects I overlooked. > > My current emacs version: > > GNU Emacs 30.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.48, > cairo version 1.18.2) > > Thanks for looking into this. Juri and Vincenzo, any comments?
bug-gnu-emacs@HIDDEN
:bug#76704
; Package emacs
.
Full text available.Stefan Kangas <stefankangas@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at submit) by debbugs.gnu.org; 3 Mar 2025 04:32:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 02 23:32:29 2025 Received: from localhost ([127.0.0.1]:42408 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1toxTg-0004kJ-9t for submit <at> debbugs.gnu.org; Sun, 02 Mar 2025 23:32:29 -0500 Received: from lists.gnu.org ([2001:470:142::17]:40948) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <f.brosda@HIDDEN>) id 1topFE-0004Gq-7M for submit <at> debbugs.gnu.org; Sun, 02 Mar 2025 14:45:01 -0500 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 <f.brosda@HIDDEN>) id 1topF5-0006aC-Gq for bug-gnu-emacs@HIDDEN; Sun, 02 Mar 2025 14:44:52 -0500 Received: from mout.gmx.net ([212.227.17.22]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <f.brosda@HIDDEN>) id 1topF2-0002wr-PG for bug-gnu-emacs@HIDDEN; Sun, 02 Mar 2025 14:44:50 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.de; s=s31663417; t=1740944683; x=1741549483; i=f.brosda@HIDDEN; bh=QCFlf7ilhII+7tS/JX3Yi+c7vmnOROffbhWCoCyaTt8=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:MIME-Version: Content-Type:cc:content-transfer-encoding:content-type:date:from: message-id:mime-version:reply-to:subject:to; b=DUDJ2PtF1HzTxcFJuupWqxlN+7j/iuhAh0BAMVbcaqP6VbyuuVWNihlhX7BzXEG+ w0AOp/bpjD2STaLN6EgV3TbYYiY09ixFJBFsj3WdIASkFw+KsvyfVv4uF+Wm+esKI a9RwRs6ZEA1dE/sOADyNBV/C6wz+6Ew+pYnzdPR+Mj16g1jhcbKhG1TMmced42G+3 hH9F5M1NP2LH/3QwznOdEpfWKsDEpuDfDWgQSAoPp5ILqWNl6kvn5wCAanmKrLmM9 ckNjRRbHn6/mEihDSHSvLSe44ZOfLzK0AAc+jzgjmdTUDj1CiHn9sE7qFQNONer36 oO/yGJnWAI3LjucVBQ== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost ([93.195.180.29]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MsYqp-1t0zlw0YLj-0179I4 for <bug-gnu-emacs@HIDDEN>; Sun, 02 Mar 2025 20:44:43 +0100 From: Fabian Brosda <f.brosda@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: 30.1; Indentation of braces on separate line in js-ts-mode X-Debbugs-Cc: Date: Sun, 02 Mar 2025 20:44:39 +0100 Message-ID: <871pvfkyjc.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: text/plain X-Provags-ID: V03:K1:lfnmKodBZqZlylb5rFNrTBvrnLMhQLfpS6dsJWNsWF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FzGzn57M9GRmpgG5b+fDUeBP4yZQxOfuWagfppW jwTNU06FtGZ6gunB/s6NtSYFmKT3CPVmYTrmNgEcKRtnocSifOgk1/ULj3/Ow4+SDPbjn3hfr 1PxTkbVXg3rzwnr3SXyFxoWCZw5nlID1QpOf7yfFsaPjPLjNsEf1al1rAlTMgpYt4beiN9ZWd M1mzJvFCOF7PEn8En+R+b1UsahUTg0Z3vPgKpZk09LOyPgs/jFA0eAMvxmqeWD6v8lHVubstV Kz5ZiVwCbXINPEVrPEH+37Ff4t5F25SfF3Q+qgm4PsfZkzvzL6sccMjtNazkspBlG/hNbvsjl TOuA/+MLo1LAdgqCJli6SWlNDl07sRv4MOk0yflkZiQRV18d+jjxHMTekeXatqXwR9xu3kURG ujaqNkEDNlOU5iexWoBadbxMR9QO0ZVYGyTSvG7bfG4h1x1uxIKKTDVw5Xz8cth034fR7u1jF mcs92icIrKr0xmXu6gSBfcHrbdSuYAnZnQo12kr4BN0Cl+xI7E0wt7XrLprwfXTAYncOpf+pJ E0jv4hrp6tMaeA2KVxDyl4WjhCd+V8IEKYPTTx7SlZp1RQ2ma3F3yZSsEFtY6vO8jbrpbd6Zt oqUIb1GCvQ0CuI2t40EKqgY24rY8= Received-SPF: pass client-ip=212.227.17.22; envelope-from=f.brosda@HIDDEN; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.01, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 02 Mar 2025 23:32:18 -0500 X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) Hi, when using js-ts-mode instead of js-mode, braces, which are put on a separate line are indented one level too much. Here is a simple example of how the indentation looks like, after using indent-region on the whole function: ``` function test(x) { if(x) { return a; } else { return b; } } ``` The used tree-sitter grammar is downloaded from https://github.com/tree-sitter/tree-sitter-javascript. Having braces on a separate line is probably not the most common for javascript, but using indent-region in the js-mode, does yield the expected result. The js.el file does already contain a comment mentioning braces in js--treesit-indent-rules. But even based on the git history it is not clear to me, what exactly is meant: ``` ;; "{" on the newline. ((node-is "statement_block") parent-bol js-indent-level) ``` Link: https://github.com/emacs-mirror/emacs/blob/master/lisp/progmodes/js.el#L3457 If I replace 'js-indent-level' with '0' in this line, the indentation would be correct, but this might have unwanted side-effects I overlooked. My current emacs version: GNU Emacs 30.1 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.48, cairo version 1.18.2) Thanks for looking into this. Fabian
Fabian Brosda <f.brosda@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#76704
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.