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#68054: [PATCH] Add tree-sitter indent rule for lexical decls in js/typescript Date: Thu, 25 Apr 2024 02:15:16 +0300 Message-ID: <3cf27c4d-d5ee-423c-a0d2-cfae297d36ae@gutov.dev> References: <797AC075-B0C8-4269-B8E3-A1F2C69FA955@gmail.com> <14DD6D3A-B9F5-4E5F-B85B-0A8DF6961723@gmail.com> <5fd5b131-962a-489d-a674-0e199cdfff25@gutov.dev> <49231C5D-E89E-4AA3-AB02-51340994EA20@gmail.com> <661fc11d-6da8-4fe5-a900-80ed1b41823a@gutov.dev> 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="9607"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: Yuan Fu , 68054@debbugs.gnu.org To: Noah Peart Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Apr 25 01:17:02 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 1rzlrJ-0002FD-NT for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 25 Apr 2024 01:17:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzlqu-0000n4-GD; Wed, 24 Apr 2024 19:16:36 -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 1rzlqC-0000Vd-4H for bug-gnu-emacs@gnu.org; Wed, 24 Apr 2024 19:15:52 -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 1rzlqB-00076H-PS for bug-gnu-emacs@gnu.org; Wed, 24 Apr 2024 19:15:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rzlqS-0000sg-GV for bug-gnu-emacs@gnu.org; Wed, 24 Apr 2024 19:16:08 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Apr 2024 23:16:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68054 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 68054-submit@debbugs.gnu.org id=B68054.17140005513195 (code B ref 68054); Wed, 24 Apr 2024 23:16:08 +0000 Original-Received: (at 68054) by debbugs.gnu.org; 24 Apr 2024 23:15:51 +0000 Original-Received: from localhost ([127.0.0.1]:60226 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzlqA-0000pT-Hy for submit@debbugs.gnu.org; Wed, 24 Apr 2024 19:15:51 -0400 Original-Received: from fout7-smtp.messagingengine.com ([103.168.172.150]:41421) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzlq3-0000my-Rw for 68054@debbugs.gnu.org; Wed, 24 Apr 2024 19:15:48 -0400 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfout.nyi.internal (Postfix) with ESMTP id 1184F13800C8; Wed, 24 Apr 2024 19:15:21 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 24 Apr 2024 19:15:21 -0400 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=fm1; t=1714000521; x=1714086921; bh=ZS9TBSe8zScFtgzwvK7ZKQh2GKDBZP3P3UUz+lDGo+Q=; b= FlgFGNQftCQ13tNghFEhZQBLMy5w1l8wVycUXP9ckTAuQC1rv4OW6SC55J6qzBAH mzG1Ou83jyjMnRBWMnNOkhU5gUWvtwbQaWLNI/bVb5h2HWsNyLDgz5gwJ+TJix1g nA9dLC+83gMYLHuQGD5RAJjNyE1MB5ETkOIWTyADyMVY7gmihyJX90PjoViWfaWf 05T7wiQchb6F3I5ZqACryUOp/4pd4kokazE5Svbh1TrNZcgarvcY79rmu50D1awF 0pVD/hXPHpXVq7QGlxxfRg9VtLR4WiRBn8lpYo/cxl3okm9ixtdbQJzSNmoU7O8L e+FNr20fwqPzab44FStaUg== 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-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1714000521; x= 1714086921; bh=ZS9TBSe8zScFtgzwvK7ZKQh2GKDBZP3P3UUz+lDGo+Q=; b=T a+lW/m6AmWRj4SeiXW5VIizvI0xNnWNQsJzRe0vN7HZ8FJMCjFIEv2DyziivOJ7F RmVhC19eIhXfi3mPvIjxHOl6p3Ny+x3cofxc1m7pSSgIKy319RUgXIUUhNXHmd2P DHVVOWWE6EYidCAN9u6ARbWfEKAWcIYdY5D3/wvxeXTD588P+DT4jej/OpZ6GSzE eekP+I3qXJPx+Brk1vuA4c9XJVdzrLiCIzRbMhoHzzsn2sdLP+oZ8KlFBRSGGKzI ZGGqzGwKXZYK7sF6uLtOEYoXUQi78fNfNwTXK5xZ0LnQcZ76NjZ3itbwFbHIZHtM cmreijj80Xy8zImFfI+Ng== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudeliedgvdduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepgeelfeetkefghfdvhfdtgeevveevteetgeetveegtedthefhudekteehffeu keeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 24 Apr 2024 19:15:19 -0400 (EDT) Content-Language: en-US In-Reply-To: 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:283934 Archived-At: On 24/04/2024 05:36, Noah Peart wrote: > > What js-mode does (looks like 3) shouldn't be too bad, but I wouldn't > mind an extra indentation level for such cases, too (example 2). > > The problem I found with option 2/3 was cases like the following (which > also seem like the most common) where I expect the start of > the function be indented according to `typescript-ts-mode-indent-offset`, > not with the declaration keyword "const" as in `js-mode` (and option 3). > >     const someFuncWithReallyLongName = >       async (x: number, y: number, z: number): Promise => { >         // ... >       }; I don't know, in my understanding the line break after the "=" (or its absence) is usually a good enough look to choose between indentation offsets for a given statement. I.e. with the break after = it would be indented deeply, and without it (keeping "async" on the first line) the body would have the same base indentation as the "const" statement. Though of course some users like it differently anyway.