From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#68054: [PATCH] Add tree-sitter indent rule for lexical decls in js/typescript Date: Sat, 30 Dec 2023 12:31:20 -0800 Message-ID: <14DD6D3A-B9F5-4E5F-B85B-0A8DF6961723@gmail.com> References: <797AC075-B0C8-4269-B8E3-A1F2C69FA955@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11918"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 68054@debbugs.gnu.org To: Noah Peart Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 30 21:32:18 2023 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 1rJg0I-0002yg-Fw for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Dec 2023 21:32:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rJg02-0007tr-Ex; Sat, 30 Dec 2023 15:32:02 -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 1rJg01-0007ta-PG for bug-gnu-emacs@gnu.org; Sat, 30 Dec 2023 15:32:01 -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 1rJg01-00030l-Dd for bug-gnu-emacs@gnu.org; Sat, 30 Dec 2023 15:32:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rJg01-0008Ca-PK for bug-gnu-emacs@gnu.org; Sat, 30 Dec 2023 15:32:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Dec 2023 20:32:01 +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.170396830331495 (code B ref 68054); Sat, 30 Dec 2023 20:32:01 +0000 Original-Received: (at 68054) by debbugs.gnu.org; 30 Dec 2023 20:31:43 +0000 Original-Received: from localhost ([127.0.0.1]:45122 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJfzi-0008Bu-Li for submit@debbugs.gnu.org; Sat, 30 Dec 2023 15:31:42 -0500 Original-Received: from mail-ot1-x32b.google.com ([2607:f8b0:4864:20::32b]:50368) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rJfze-00088d-Kw for 68054@debbugs.gnu.org; Sat, 30 Dec 2023 15:31:41 -0500 Original-Received: by mail-ot1-x32b.google.com with SMTP id 46e09a7af769-6dbfdb41a63so2892364a34.0 for <68054@debbugs.gnu.org>; Sat, 30 Dec 2023 12:31:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1703968292; x=1704573092; darn=debbugs.gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gcaI/JcYusr/1+gar0A+t/kwDXmZvvyCAsHcf2JQZHA=; b=FE6ICX3sws159CGXgwP9joLO4pLb+M5nIfk7K4mtNIzTMESdosiHX9biUcDFf49abg q2WOL+F2B4bnEptMGtlzLqUUNNGbM70hmPiLuYSxiTI6t2jv03ULkX6ONbluMxPjmwjR tS8h7eeHjN0Kyzn2JeCUPRhfGEMiJi0tb5tlW9czo1nTxeuVYCK4/J2IQMsVxrYgbIGY u33BSWgsrLevFTAgoOkII1HfVmY+S8dTHMsyWWjkqmO+S+aRS8LQPzEsH99Ouv9ftEDk TqFXU66ZMH9Fjbu9/+DpyuR2/ew15gTuQt391F0J4MKyqcVm79O6p+cEpArPXqoTQiJ5 SOuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703968292; x=1704573092; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gcaI/JcYusr/1+gar0A+t/kwDXmZvvyCAsHcf2JQZHA=; b=piTP312Ad26Hpu8N4toGJVroCcdBRSLAJmoh1qHf2CU2cBD63XSDDbfs02uuGO+FIp Twn7Tob1YR3G6jATX69q3I4W8Wnhnm98FXDVLM7EfDQkDVti4XR1RVqz1Q744v9LEYEn ScWuyP7bbsPJCbuWdDx3ZRPWjpsXRoJTgr9wzUSd5mK8U3aiOnycf/NAlfZd3QlmQpZU wGw/LdAtJoPmKpDkmLiAK2oX3gaWLzfPb5lUCmKs5IHizAQYCUwJMAjEhiomCtYcdaBA uR7tCd7evEdtFafZ4XvlXakOvkya45HIjMjybVeSn2QVlQI5Z7IHf7fMwZc5yxbUaBlT i6Jg== X-Gm-Message-State: AOJu0Yx+Vl1TVUxmObWZmWffB8Mdioxra8JWMxf3bY6hm5G9EvRx6ZR4 oRhBB0EuWH+Km0iQK0kuEl4= X-Google-Smtp-Source: AGHT+IF+8EBrO/Cl+nLoeZq8OySnm+/mNIdJqniKGgLQnSA9JH5fn+EAwQv4kWImmgUEwB+f9g7x8w== X-Received: by 2002:a05:6870:91d6:b0:203:bf30:bbf3 with SMTP id c22-20020a05687091d600b00203bf30bbf3mr17048768oaf.75.1703968291997; Sat, 30 Dec 2023 12:31:31 -0800 (PST) Original-Received: from smtpclient.apple (172-117-161-177.res.spectrum.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id y42-20020a056a00182a00b006da76842a66sm500445pfa.85.2023.12.30.12.31.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 30 Dec 2023 12:31:31 -0800 (PST) In-Reply-To: <797AC075-B0C8-4269-B8E3-A1F2C69FA955@gmail.com> X-Mailer: Apple Mail (2.3731.700.6) 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:277099 Archived-At: > On Dec 29, 2023, at 8:24 PM, Yuan Fu wrote: >=20 >=20 >=20 >> On Dec 26, 2023, at 10:21 PM, Noah Peart = wrote: >>=20 >> Tags: patch >>=20 >> * Bug: `js-ts-mode` and `typescript-ts-mode` are missing indentation >> rules for lexical declarations that span multiple lines. >>=20 >> Recipe to reproduce: >>=20 >> Using the following function to configure js-ts-mode and indent the >> buffer: >>=20 >> (defun try-indent () >> (interactive) >> (js-ts-mode) >> (setq-local indent-tabs-mode nil) >> (setq-local js-indent-level 4) >> (indent-region (point-min) (point-max))) >>=20 >> Add the following example to a buffer and call `try-indent`. >>=20 >> let foo =3D 1, >> bar =3D 2; // no indent rule matches this line >>=20 >> No indentation is applied to the second line. >>=20 >> This patch adds a simple indentation rules for `js-ts-mode` and >> `typescript-ts-mode` to handle the multi-line lexical declarations. It seems that js-mode indents bar to align with foo, rather than = indenting one level. I feel that we should do the same, WDYT? Yuan=