From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#74386: Tree-sitter javascript indentation Date: Mon, 2 Dec 2024 00:33:23 +0200 Message-ID: References: <2ce8c98e-c399-46f1-a930-04f27a3d56dd@gutov.dev> <389b6090-6ae9-433a-85cc-a2d2eb84751f@gutov.dev> <86r06t82gl.fsf@gnu.org> <4B4B99E7-C4A1-4124-BC85-2AD66EF0871B@gmail.com> <35B61F44-C551-44DB-A334-A893991BC799@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22156"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: 74386@debbugs.gnu.org, Eli Zaretskii , Theodor Thornhill , marius.kjeldahl@gmail.com To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 01 23:34:28 2024 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 1tHsWJ-0005Xz-2P for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Dec 2024 23:34:28 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHsVy-0001eW-Qs; Sun, 01 Dec 2024 17:34:06 -0500 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 1tHsVu-0001eJ-Pb for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 17:34:03 -0500 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 1tHsVu-0008CD-Fz for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 17:34:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:From:References:MIME-Version:Date:To:Subject; bh=8vCmCqcbc9lXBeuohG9B5QtqaNCg462je9HRQHBE/7E=; b=tTiaDGugK3RuJXGm2jyjvDGhrnZHMJNg+oOqvT5rvjzRNzYVApaVSMj4ybDlopmB0DSg87ccwD6HqnDfl3CrSsQyxO9+XG1Qrn29xpiuW/nTUbWemmCJllLbmW6r3zPeoTYcPACLRPAxy24XpxnbKZXZuIw/q7Vd9XtZ/b0dQpIjFSU6Hxjiz7zXjX2NZnqS6uCUaPbzBNi4M2wpAQJtzLbZDRO5cFZhZrWuBSCyxCLGX/DW725MX2kCZKh3ME6gwjszNIV0TCqwH6iEIHS4L5m4NuMmFE3kKHnXF9mkCeKzEHeyBkKdhkj0pMfpqAUfhj02jNrXLEZmOIYdRmOJBA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHsVt-0004d0-P1 for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 17:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Dec 2024 22:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74386 X-GNU-PR-Package: emacs Original-Received: via spool by 74386-submit@debbugs.gnu.org id=B74386.173309241617745 (code B ref 74386); Sun, 01 Dec 2024 22:34:01 +0000 Original-Received: (at 74386) by debbugs.gnu.org; 1 Dec 2024 22:33:36 +0000 Original-Received: from localhost ([127.0.0.1]:53385 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHsVT-0004c9-RU for submit@debbugs.gnu.org; Sun, 01 Dec 2024 17:33:36 -0500 Original-Received: from fout-b4-smtp.messagingengine.com ([202.12.124.147]:51595) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHsVR-0004bq-4L for 74386@debbugs.gnu.org; Sun, 01 Dec 2024 17:33:34 -0500 Original-Received: from phl-compute-06.internal (phl-compute-06.phl.internal [10.202.2.46]) by mailfout.stl.internal (Postfix) with ESMTP id B6818114006E; Sun, 1 Dec 2024 17:33:27 -0500 (EST) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-06.internal (MEProxy); Sun, 01 Dec 2024 17:33:27 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1733092407; x=1733178807; bh=8vCmCqcbc9lXBeuohG9B5QtqaNCg462je9HRQHBE/7E=; b= EnBaVXG29hv8288ybLWLkSFTdQkxu1x9A40zjvV43aJzx9dzE2IjbhkAx32iPobb sneBVxfiLt9JAg1HedDSfCuxgGfbb5zGnwFw3b8OFIfGtwqmowaxQAOBfZuC+gPE vfYbnrIZu5Ot/cmpeaOm4tK69bRMior/hKgTBwKuKFds2/OgIWhTX8+mLn1fgsDk TuhsvtXz+ccqJQRsnxdWqift2UsrnaUawcH1AApgvJfLijzksdnriIqez0bABkQC wXGZGjldFACecN+YPa1EwGxyVYVoUqp+NU5XBfC0Nrg60tv6ylwEd3rG6GoK2/I7 gaunFCiohE8JdMtE+54f7A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1733092407; x= 1733178807; bh=8vCmCqcbc9lXBeuohG9B5QtqaNCg462je9HRQHBE/7E=; b=x s+YmEZ1NkkYPDMr2eykBxw3GypANA1vVz64Ww5YnGj/pRJ7rJMCwWas8v+01GLgn 8udcmGnDEmRxnzr4RP7oVxqhABXYR9BCDbCE9fIS73Lr/UzatQbF1PauXR8XfKiX yvbOH1PctBXYel69EAITH/vxtzL5HwRwsN0XFgyLQjoT80PrPL0scQ0e4uI03wwW xfsnJ74rcPz5SWYuHC5dTjqp6BZpWFJDhoHqGcQjT+pFJ1bjPtQVIwHjUP0nLGbI EkoaTqMbdwh4e4sXHBfBxJJa+zcGIQMvbwstDG10QS/PkGyfOzQLDXceeqzpLf6w unBsQdA4frMAPt9IEVxUA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrheejgdduiedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdej necuhfhrohhmpeffmhhithhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdrug gvvheqnecuggftrfgrthhtvghrnhepgeelfeetkefghfdvhfdtgeevveevteetgeetveeg tedthefhudekteehffeukeeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomhepughmihhtrhihsehguhhtohhvrdguvghvpdhnsggprhgtphhtthho peehpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopegtrghsohhurhhisehgmhgrih hlrdgtohhmpdhrtghpthhtohepvghlihiisehgnhhurdhorhhgpdhrtghpthhtohepthhh vghosehthhhorhhnhhhilhhlrdhnohdprhgtphhtthhopeejgeefkeeiseguvggssghugh hsrdhgnhhurdhorhhgpdhrtghpthhtohepmhgrrhhiuhhsrdhkjhgvlhgurghhlhesghhm rghilhdrtghomh X-ME-Proxy: Feedback-ID: i07de48aa:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 1 Dec 2024 17:33:25 -0500 (EST) Content-Language: en-US In-Reply-To: <35B61F44-C551-44DB-A334-A893991BC799@gmail.com> 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:296284 Archived-At: On 01/12/2024 21:10, Yuan Fu wrote: > Ah, I see. That’s a good point, and I definitely prefer the indentation result of parent-bol here. The one produced by standalone-parent is just wrong. What we can do is make standalone-parent ignore “.” when checking for “standaloneness”. And perhaps make it configurable so it’s enabled only for modes that this waiver makes sense (C-like languages excluding C and C++). Maybe not by hardcoding this in inside the 'standalone-parent' matcher, but writing this in the indentation rules? Different languages might have differing ASTs for such construct. Or if you meant to do a text search, a period might start a method call, but it could also continue a "range" literal in some other language, or some struct initializer (I think?) in C/C++. Also, some languages allow (and style guides suggest) to have the previous at the end of the line, then followed by newline and then the method name.