X-Loop: help-debbugs@HIDDEN Subject: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Resent-From: Fabian Brosda <f.brosda@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Mon, 03 Mar 2025 04:33:03 +0000 Resent-Message-ID: <handler.76704.B.174097634918258 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 76704 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 76704 <at> debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN Received: via spool by submit <at> debbugs.gnu.org id=B.174097634918258 (code B ref -1); Mon, 03 Mar 2025 04:33:03 +0000 Received: (at submit) by debbugs.gnu.org; 3 Mar 2025 04:32:29 +0000 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> 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:lfnmKodBZqZlylb5rFNrTBvrnLMhQLfpS6dsJWNsWFsgkCw8Rwq gUGteCuLHVvAF8nMO7i86xwhCfnYydlVYReqldoKS7aPXoufHs79mv/7h2yQEqM45kBtR0d NRVbcrUe0yIhXAtCZfsGCdbznId5isK8lSINfml51KALQibzQlGVz5VLMU0kAaJ1PmmxyG5 mop7g7AIU51pcttLvtTzA== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:D2XF7NTEHa8=;94gfrWJTdUHg0jj3HBkAzREtNjM A+gosHG8Lb0lCVdkaSx3zkrDqLL6d9Eh5L7CgdwBgCS6iEdRRaGggXl/oivrwzJxc5SnOVkt7 oFYef2gkRqFwrv5pMS5UQFLK8MUFA7YA1k4PdnUY5Fi/Y309Bojohci4hVt31y17xnlaApAiU LEwamBJn3hd3e+mP5vlBBaxr3CseMRkosGt6frTvbo1p6nNcjMODZYk7BOykxd8BhUDWP/0ZV iRww57we0xy78Y9w8YkAtKUTySMN30bDKZJhl2rvaTf3ojZPr14q2JD4tbWRFv1aYyJArfGEb i+JFzIdOPArKjLpEe/MNr6CZFNsZaBkb/Kz5R8eTUJpA7oLvWWJj6ERW151oqnNXK7S2lWI// 4hn2SIEWLj2tR5WTUVdkAU8bCwVmeNRAt5BbkkXnrftfaIk81AelDxHo05cVvc6XOTxAQTYL4 G7548zTyW5KN+NbrtqGnpn//hTo0ojZvyz98tVS/rpO9AdHbAOCuw6vU4kOP5w1wXOi4iM0tl we5vsBY87em3JQqRR+DdKLkCYa9qpZu+hNw+u+NPXYJCYjs99GMz+W9nqmrHXZiqSVLkE39Py HiDKXgzmlAVauJCLeCPxKcYj59uPuMLmDxv6mTyoKqccPPn16NVpfKTbM7u5x8M7FK3N9FX3F LiZ8dP1rSon7kRbHWX8pjfYJiDodNU1CgusYwf2jbDab7AnQa9Ogxzd1BfZYoKEO82rcK9W2H RhHPWw0K9lEn2ZutAQhz5natIM8AZP0H8WskZHKrDMCQy6y/m/nXfL1w6fLe9XyQz8lkp0T5j jcPJQxkRdDh1QYlfLXnfhGGah4bKKh0dwRFzGzn57M9GRmpgG5b+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-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
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: Fabian Brosda <f.brosda@HIDDEN> Subject: bug#76704: Acknowledgement (30.1; Indentation of braces on separate line in js-ts-mode) Message-ID: <handler.76704.B.174097634918258.ack <at> debbugs.gnu.org> References: <871pvfkyjc.fsf@HIDDEN> X-Gnu-PR-Message: ack 76704 X-Gnu-PR-Package: emacs Reply-To: 76704 <at> debbugs.gnu.org Date: Mon, 03 Mar 2025 04:33:04 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 76704 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 76704: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76704 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
Received: (at control) by debbugs.gnu.org; 4 Mar 2025 01:24:24 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 03 20:24:24 2025 Received: from localhost ([127.0.0.1]:53296 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1tpH1E-0002nK-2g for submit <at> debbugs.gnu.org; Mon, 03 Mar 2025 20:24:24 -0500 Received: from mail-ej1-x62e.google.com ([2a00:1450:4864:20::62e]:52239) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1tpH1B-0002mt-8T for control <at> debbugs.gnu.org; Mon, 03 Mar 2025 20:24:21 -0500 Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-abfe7b5fbe8so227573466b.0 for <control <at> debbugs.gnu.org>; Mon, 03 Mar 2025 17:24:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741051455; x=1741656255; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=JAVj80lYKtKcK7k+x0HyvG1LkKpncXSdAX4R6HOgv3I=; b=esGxhLTbyRrv/efwJ9zaprIoO2ulKgmAH12LvyBkkp3R08fI/NI62YJwQL9tko3IQD qYZjHM0DC49BScbjS1tDNvSp+zrhKEAF+w5/1JdFfewpZ95s+VyrUUszF5U7o4lpquqA gRmxPlFGnxXBjkf6zExDQyEOlJv1kPnOrQ0a4JgwUZpNOWE+5wvEnpYGQAlnNweMvryD AyjoZpKMCzZ6IsAvohgSF5nPUeEi4kaG4SWbxpJ1xk0Rj3MFUijyvVfaAI+P1EJbyCCS 0O65z42qlPkyLij7hcGH5wsP/McxeOwpUheDEwgkhEjCOtwBVy0HvXgZG+yyrj5oWU6i 0Cfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741051455; x=1741656255; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=JAVj80lYKtKcK7k+x0HyvG1LkKpncXSdAX4R6HOgv3I=; b=jG3ZNnMhNWJk9K56KrPvgc3sDRrdp76JmgvboxZQvinBInUzoMjvF+13RONJWrOO3g 9Tz5lWrVHt9ufVfse8ef74SFmXlQZ+Qy3cwqtr0tIFQC9/Ro8lX9J6j2To33ub1WwVIW l/tJ7V0tGuV6s70QrmIiyeSg4QD+du+gdjraWWDJBSy2fM7Sn5xbzD0RqjucvB1Q+zLF CVRP9noY8pVulS273DpfJHOnWIIY4p3gc1h6YF33Xqj8UFIGbG7qvH0zq3DDyRsbsN6G jJPaM5/4GDcBHjX8DPeWjYVGwSkkjMBUxi4oAaVVxL2OrFZrIho00oN3jYKFK4XbjfZu u9xg== X-Gm-Message-State: AOJu0Yz/k21brOQE8j+wupylRXIGbGuhmP/m7yBXBjQ5gGdFQxP5FmPn B9JaFD8O85rNtBFHKcFb+Hkg3RncLjgf91xpWUdxttI7HDpokg3QIx8j7GipYT4cus/4ww/xaPb XUC+dWYfl0X/jHJvNwwwIlD3DrwPQmH8oEXQ= X-Gm-Gg: ASbGncuGb0+0j/ntEf2t/dtb1DsZlSUkgWPO39byOhL49KUTmjiTjOYz7OSE9gshkgm Ma38DPOzRTZ061/2L5olW/8ggZ8srHng+fai/KJgdl1Mp51WaKSsdOjc7uQMNthD1d6m+LN0Hzo KHmMZ13pkdu2CBpnL7h2J7hOJQKA== X-Google-Smtp-Source: AGHT+IFOz4LtL2OORQV7VWZuoRgGt41YGGb8l9ITyssd8QLLDlDzkx8U3KxKvTjupTNce7LFda8HiC9WNGIXIBogqlc= X-Received: by 2002:a05:6402:350e:b0:5e4:92ca:34d0 with SMTP id 4fb4d7f45d1cf-5e4d6b4bb17mr41998783a12.20.1741051455087; Mon, 03 Mar 2025 17:24:15 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 3 Mar 2025 17:24:14 -0800 From: Stefan Kangas <stefankangas@HIDDEN> MIME-Version: 1.0 Date: Mon, 3 Mar 2025 17:24:14 -0800 X-Gm-Features: AQ5f1JoWUG8GgvU8hgyCDNiRWxJvD7m9ioXdkFVgkEBf8cp2-nV2FIWFt7lQ2Gg Message-ID: <CADwFkmk+4yhdLx0ueWF5Pd_W6usGMGcyEpfZEcNEN3XmgFhkkA@HIDDEN> Subject: control message for bug #76704 To: control <at> debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control 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 (-) severity 76704 minor quit
X-Loop: help-debbugs@HIDDEN Subject: bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode Resent-From: Eli Zaretskii <eliz@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: bug-gnu-emacs@HIDDEN Resent-Date: Sun, 09 Mar 2025 10:01:02 +0000 Resent-Message-ID: <handler.76704.B76704.174151442923395 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: followup 76704 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Fabian Brosda <f.brosda@HIDDEN>, Juri Linkov <juri@HIDDEN>, Vincenzo Pupillo <v.pupillo@HIDDEN> Cc: 76704 <at> debbugs.gnu.org Received: via spool by 76704-submit <at> debbugs.gnu.org id=B76704.174151442923395 (code B ref 76704); Sun, 09 Mar 2025 10:01:02 +0000 Received: (at 76704) by debbugs.gnu.org; 9 Mar 2025 10:00:29 +0000 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> In-Reply-To: <871pvfkyjc.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN) References: <871pvfkyjc.fsf@HIDDEN> X-Spam-Score: -2.3 (--) 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?
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.