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#74386: Tree-sitter javascript indentation Date: Sun, 1 Dec 2024 11:10:14 -0800 Message-ID: <35B61F44-C551-44DB-A334-A893991BC799@gmail.com> 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> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6662"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74386@debbugs.gnu.org, Eli Zaretskii , Theodor Thornhill , marius.kjeldahl@gmail.com To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Dec 01 20:12:27 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 1tHpMo-0001Ze-9y for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 01 Dec 2024 20:12:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHpMT-0003RB-FT; Sun, 01 Dec 2024 14:12:05 -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 1tHpMR-0003Qu-25 for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 14:12: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 1tHpMQ-0006i5-DQ for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 14:12:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:Date:In-Reply-To:From:Mime-Version:To:Subject; bh=Qv6Xnv1CcqrcGnKXYPF3pIehy7vtHnl96OvltCGSPEU=; b=gDm7u+j4ZAMSGmgkbQcj4iEfsYyTSVkfU8BPyjGlzsWP8S2EoMOygMmeAzft2xe9gD9YkarpFmwNxCAjycDqiR8KyrtxaT/Jkjgv342+lFUC9i/1inq8DlBbMpQPFRzXSovTe9hXgGZktLS0DNjxzE9kJ5T6BlY7fgSGq+Ga77brYm/gvCFk42QDbO5hUi5mzBtw3pm2YyJXtS6+1V4qMo7DESOOH3WnPTdcs+37xkvaEmnom6mZ2A7WKWrTcKRgg1NWYfuwgwlGB4Sw9/eVfKsTXnkFnKMVe3Qu8xQEnMqyIEv32SlivOBPAP/zB8mohi0g2sknchO3xeQkfVCc8Q==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHpMQ-0002tM-7f for bug-gnu-emacs@gnu.org; Sun, 01 Dec 2024 14:12:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Dec 2024 19:12:02 +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.173308028911059 (code B ref 74386); Sun, 01 Dec 2024 19:12:02 +0000 Original-Received: (at 74386) by debbugs.gnu.org; 1 Dec 2024 19:11:29 +0000 Original-Received: from localhost ([127.0.0.1]:53100 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHpLt-0002sI-7e for submit@debbugs.gnu.org; Sun, 01 Dec 2024 14:11:29 -0500 Original-Received: from mail-pg1-f181.google.com ([209.85.215.181]:55511) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHpLr-0002s9-Hm for 74386@debbugs.gnu.org; Sun, 01 Dec 2024 14:11:28 -0500 Original-Received: by mail-pg1-f181.google.com with SMTP id 41be03b00d2f7-7fcc00285a9so658250a12.2 for <74386@debbugs.gnu.org>; Sun, 01 Dec 2024 11:11:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733080226; x=1733685026; 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=Qv6Xnv1CcqrcGnKXYPF3pIehy7vtHnl96OvltCGSPEU=; b=Ke+cYkYXuUx/DDycnAK+CGyziQkalZ9esvMPeHqRT6OYhNYcgJ3IkgmdGgPUiuD8Uv WJHMubKZhOd/yJI5+IODRPMthvTSEaqmFo7BaxvCW0l40ECb1AnKTkJE1Q1NYBuxSIi0 Rc2URfnIdDmowRDOYlNBBMOfrxOf7qU57oQ44z2MTikOsPIe1E+AmqzF2JrGtuE2YhKt sZe9cKwDamYLo5OJdWCN1VRfSgeo4/bQBomhGpWu1WGwQlB2UFb6QvQqz2T7HniFi4l+ /KQ3iBiDpYnMB5lm6IwsM/YiN8nrHQsigsJtxgvHJbnuPM4YPxS9FwnTniatp0M8HImm GiaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733080226; x=1733685026; 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=Qv6Xnv1CcqrcGnKXYPF3pIehy7vtHnl96OvltCGSPEU=; b=cKSSZVfVtZE/jp35oaT9zN39mC+vdYdmS7w+APcaTkURsMq4vyYhuIhprSHrDV1gAA 6RV/ByupDwr0brK5CUtAXgzwnkC14jUvgOxZs+GXUxl8T1Dp4vOSSo+700M0hU75OQaZ x+ki4gSl3dmk96eemrMMgYBsMdwA5fJR2ejALHWZGbMUsIgY9yltuqbH0umRtFxkOYzj DgF+z4n2jBV3AgvqEQfEnL6ihgaW0grakQVFaYECp51Q05C9uKWOvakHWGneKhV3/Zcu AKshiEJY/YM4umKHYQqj7hbahuGRLeFmRRKj6H+x9P6GLPfXboU4M9bi0bYm5XWld+l0 pMQQ== X-Forwarded-Encrypted: i=1; AJvYcCVgzo/dMAJt0y8gpC26EFhMY+rjQrmXgjfrcFfUvdEN9Yu+6phzNlBXexX4Ovs+SCsbmRshPg==@debbugs.gnu.org X-Gm-Message-State: AOJu0YxnyMf+YROb1kI1nr7oUchKEzRY8az30vnjM9NLf5gsyJiw9MbY RX8si2jgunjv5+7BChMPZCaxw2cMeIv4k/lDABkfYQj4/ADT1od6 X-Gm-Gg: ASbGncui9eKpV10uL/cF0DdCCMyLA8PqqhcUdiIcTRjxR3k5QgM2Gv0AIcnSuYz0zoP c0GXJWl1vRSssKMnqmv+1UnikqwMa8ESIoTak+OAZp52OSpAp+Kype8x1TpZ6soBndE/hS386L6 +YQDSga3ISpXJshct1LlRyanNoXn8DSkWMpIKm5oBT/TL8Ron4+6jCghHLDmxW64hDqeKBMBwCC p496Bqx+1SB/i0canOE/vwCeqboE+vw7rjReRlNkhXZMV9cG/sYHIAVIHKGcpf3s2lIEtXw9g== X-Google-Smtp-Source: AGHT+IFo2DZlfqkw++lqZRO9BvWPwCsSpboCPUhBh+1EzP//Ajem4BKLabbW9VUrsAQG/2YVMX1nBA== X-Received: by 2002:a05:6a20:12c3:b0:1db:efab:390c with SMTP id adf61e73a8af0-1e0e0b5a079mr33957271637.35.1733080226464; Sun, 01 Dec 2024 11:10:26 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:71b7:718f:7faa:8436]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72541814291sm7153329b3a.142.2024.12.01.11.10.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Dec 2024 11:10:25 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3776.700.51) 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:296275 Archived-At: > On Dec 1, 2024, at 5:11=E2=80=AFAM, Dmitry Gutov = wrote: >=20 > On 01/12/2024 07:23, Yuan Fu wrote: >>>> For more experimenting, also check out 'M-x treesit-explore-mode'. >>>>=20 >>>> And here's how to immediately find out which indentation rule was = used: >>>>=20 >>>> (setq treesit--indent-verbose t) >>> Theo, please chime in. Should Dmitry install his changes? >> The standalone-parent anchor is designed specifically to solve the = bug described here, and changing parent-bol to standalone-parent is very = safe. So IMO we can merge this (either to emacs-30 or master). >=20 > Thanks for your answer. >=20 > What I was wondering, is whether we might need some user option(s) to = switch back to parent-bol instead of standalone-parent for some = constructs, and whether we should replace more uses of parent-bol with = standaline-parent, and if so, which ones. >=20 > Also see the example of the indentation change with that patch = (switching from one fairly popular indentation style to one slightly = less popular - AFAIK). Ah, I see. That=E2=80=99s 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 =E2=80=9C.=E2=80=9D when checking for = =E2=80=9Cstandaloneness=E2=80=9D. And perhaps make it configurable so = it=E2=80=99s enabled only for modes that this waiver makes sense (C-like = languages excluding C and C++). Yuan