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: Fri, 26 Apr 2024 04:06:05 +0300 Message-ID: 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> <3cf27c4d-d5ee-423c-a0d2-cfae297d36ae@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="14894"; 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 Fri Apr 26 03:07:20 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 1s0A3b-0003dt-FO for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 26 Apr 2024 03:07:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s0A3C-00013O-IX; Thu, 25 Apr 2024 21:06:54 -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 1s0A37-00013C-0I for bug-gnu-emacs@gnu.org; Thu, 25 Apr 2024 21:06:49 -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 1s0A36-0007Mg-OC for bug-gnu-emacs@gnu.org; Thu, 25 Apr 2024 21:06:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1s0A3O-0001G0-FH for bug-gnu-emacs@gnu.org; Thu, 25 Apr 2024 21:07:06 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 26 Apr 2024 01:07:06 +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.17140936024561 (code B ref 68054); Fri, 26 Apr 2024 01:07:06 +0000 Original-Received: (at 68054) by debbugs.gnu.org; 26 Apr 2024 01:06:42 +0000 Original-Received: from localhost ([127.0.0.1]:33497 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s0A2w-0001At-7V for submit@debbugs.gnu.org; Thu, 25 Apr 2024 21:06:40 -0400 Original-Received: from wfout8-smtp.messagingengine.com ([64.147.123.151]:57353) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1s0A2q-00018Z-W1 for 68054@debbugs.gnu.org; Thu, 25 Apr 2024 21:06:35 -0400 Original-Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfout.west.internal (Postfix) with ESMTP id 6BE0A1C000F1; Thu, 25 Apr 2024 21:06:08 -0400 (EDT) Original-Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 25 Apr 2024 21:06:08 -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=fm2; t=1714093567; x=1714179967; bh=CRPRLT/JIRJXBqn2l3qdLdXSzGc16lWT7nIqS8GlDaE=; b= YoFz39+0Rd7uS5YZddJ7/L/q1FH3gErrcqddLzdogO4HUYGOIrnDfj5lrvhlAQ19 2/eyQqWibFVw/xT0xklFKoOQtzOU5X40u/aFzq+NWYRgwyOigs5cHiAGLx0QspM9 oMlLhmsLqo3bLr6ACHWZFFNZeROOecQjglGPqLqmJAtfZtGG/9rjZEzq+SdIsT/t xD3pE55Vv4URLOWWrIYyVILpg8h0RDqiWMcGT+OW4vBE08ljqahrVeaJB1nMF+M+ SUbS79hTZNbsm6V7CauD9ue5eK1AkepnYA8iFhhMx8ka7pT8NhZT2V6X2+fJCBZf LI89IgTPIHJKu+yL7+dHVA== 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=1714093567; x= 1714179967; bh=CRPRLT/JIRJXBqn2l3qdLdXSzGc16lWT7nIqS8GlDaE=; b=G WaUd0SwCtskHsrKs0wDXhqwZVeX2RpswyK5zGaNF/LOOnkAFq2PGiZgYNUWU8auG MycNupTu5RxWyF26VhU4paDsF8rkI7tsemUsLlDTX2mSMF6wM+N9Wx8aNeNlLJ3G GJJR/jd8VGqSzONGs5ZmXYfDIMoa/Xvgq6g3szgSAqq7r+MpkWXFTaA1vuC/KW9y NidQKbWgPzboKxABgoJHwm/aNHXXBnUlDuRrMWAIVyhoTU3gchtQXyHc+w8Rt5Z8 qDOhn65xNKRi/aOBn51dZMfeqET5ilKhBuO+aDPGrKxQ7O+S/Qfw0zX8TLKPRRpI tUKytpXz6uIi4Pqu/r48w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrudelkedggeduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvvehfhfgjtgfgsehtkeertddtvdejnecuhfhrohhmpeffmhhi thhrhicuifhuthhovhcuoegumhhithhrhiesghhuthhovhdruggvvheqnecuggftrfgrth htvghrnhepgeelfeetkefghfdvhfdtgeevveevteetgeetveegtedthefhudekteehffeu keeknecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepug hmihhtrhihsehguhhtohhvrdguvghv X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 25 Apr 2024 21:06:06 -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:283961 Archived-At: On 26/04/2024 01:48, Noah Peart wrote: > Ok, I can make a patch for option 3 (the same as js-mode) instead. It's > implementation is the simplest also.  Would that work? I'd be okay with it, yes, thank you. If only because it's good to have similar defaults in both modes, and evolve them together until one is deprecated. FTR, the option more in line with my previous explanation would be option 3, I think. Rhere's no real need to implement it right now, I guess, but for illustration: const a = (x: string): string => { return x + x; }, bbb = { "x": 0 }, cccc = 1, ddddd = 0; const bbb = { "x": 0 }, a = (x: string): string => { return x + x; }, bbb = { "x": 0 }, cccc = 1, ddddd = 0; js-mode also has by necessity the below exceptions: when the first variable's value starts on the same line, and it's multiline (usually that means that the same line ends with a {), then its indentation level goes back to the statement, not to the "const" keyword: const a = (x: string): string => { return x + x; } var bbb = { "x": 0 } This is basically to support the non-multivar declarations better. js-ts-mode now has the exact same indentation; these cases might come up when you change how the first two cases indent, however.