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: Tue, 10 Dec 2024 22:18:20 -0800 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> <8A7428E6-50EE-4783-82FF-3A62C4756C56@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="31242"; 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 Wed Dec 11 07:20:15 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 1tLG51-0007zb-Qd for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 11 Dec 2024 07:20:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tLG4r-0002hB-59; Wed, 11 Dec 2024 01:20: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 1tLG4p-0002fs-RU for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2024 01:20:04 -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 1tLG4p-00074n-Eq for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2024 01:20:03 -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=TInk021ROFIya7/d9Yv5VBHWceSQcV/ymxuePmepqLw=; b=IdjlzAh4e8IlVHK0iWsfvr3LPT2fE065rbyobb9YCKjNrboWIT3peBKiTSaGLeRVrs8XRP1a1w8Jz5jmIyg4b4NmSeRRFa4DDAEkzHZmFl++CCgOgSf2ecflN4Qv3gHLi3e5sqqKvro7bqC2LakfSNnVPPkanc6hl9Rdq6Svy9xTGJQIHwYXHstuaAJbNOlgKne1lKGkFdZpeST4EsW2nv2Lq3zADpulkN8slGEVHCRsKlQNIc3LFfirakwbB1jse7njrA629oyMn5DoCOXgrW0tZa4ufYjk/tHO50l4PhF/Xb3HV+kLYBKRMy0mLDrFGEaNlvOC4TFRTi/4GmQUJg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tLG4o-0006Rg-Dt for bug-gnu-emacs@gnu.org; Wed, 11 Dec 2024 01:20: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: Wed, 11 Dec 2024 06:20: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.173389798224737 (code B ref 74386); Wed, 11 Dec 2024 06:20:02 +0000 Original-Received: (at 74386) by debbugs.gnu.org; 11 Dec 2024 06:19:42 +0000 Original-Received: from localhost ([127.0.0.1]:60824 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLG4T-0006Qu-HU for submit@debbugs.gnu.org; Wed, 11 Dec 2024 01:19:41 -0500 Original-Received: from mail-pg1-f171.google.com ([209.85.215.171]:61781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tLG4Q-0006Qd-5V for 74386@debbugs.gnu.org; Wed, 11 Dec 2024 01:19:40 -0500 Original-Received: by mail-pg1-f171.google.com with SMTP id 41be03b00d2f7-7fd581c2bf4so1583547a12.3 for <74386@debbugs.gnu.org>; Tue, 10 Dec 2024 22:19:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733897912; x=1734502712; 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=TInk021ROFIya7/d9Yv5VBHWceSQcV/ymxuePmepqLw=; b=J6ctC4L9t2paobWhrjWyyMXuAVRn3IH5+m9jWqfadxCOaHn5HjdrFhWEF5dWOwfkaW nc2oN6kjqwM+Aj8KvMvPTeZjdIy8qI5WE+EIMKdawMQIHFApAy5yBLb9KHVaapN/Dxr/ WD36z9X4ZraJZ15v0ZGO4KnA9huxmopMW452JXAxb/LXYQQj14Bun5nxnHSFz0FBfjyu 9cq0hhGDIatBH5Gonzfn8fgnnPZDbwuck7/rglDwAcchnsUU0RNsxYexDnDQc1NB3EDV gXT7928uX9+tG4xX0+WG4kHQWOyXALG31r5a02GWEVeBSeX6Oc8qIGfiRUq+mZRGk3Ah gOhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733897912; x=1734502712; 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=TInk021ROFIya7/d9Yv5VBHWceSQcV/ymxuePmepqLw=; b=u3vB3dL/0WC8HVSUAd0ews+2wnB44R4CJ3cLUfhFnRsIM5b8C8h9HcM3OBv+N5m81A wncbBDfuZ1kmak8lXnAXbNKYQSw7njfpaGlc4DjrNMT94MfJcM63KjOGOajaiZxO8347 Nf6/yMpx78pmD2vO0jpKK30oy/yFtLmIVIoW3CYRyqckyPbmBWxUgBGYWRWdCGqdFoUn TMVzwzXs1Va/1tn6Ft/WtTLhNeMs7CGCtMWTm4GIaEIrw6eUll9wruhCzq0tmkSaT/tX HklQT59WJ0HBE+zp2d4FgSunoP8t4rzL3SFxMpbh6kVmFvr4dGLO9lCbCRgN3AHBliwh pAdA== X-Forwarded-Encrypted: i=1; AJvYcCV8JWmcj8EnY5NuphmeCvydvFn6GBMECkoLW2fETW3A1/qJXMorrPTaQvx29ifwXdj7WRHckw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YyFHJtOP41ydkQFvQ40Fie/stV4pTzVuDFiSvlx0xmjG5smu4h1 EaqpxOPRLvVRnJLjdNDLjc11tiGclKz+1pJFfbFEfb8I+IlwYKzY X-Gm-Gg: ASbGncuGML/8iq36I1hsf/XFBu9YjmPGsENir64w7cXRJm8j8STrBdh+rjdS3j2Qvtd fOZcVF0XxCETMryU3fWVKOoqemNqs2wLytrM22063sMy0BTiwqTMrKdixWbJLPqSL3Op3gqUa4D Tax3KsXLnWd/pfyUKQhDshF4PCGB8TTgCRYvyU06yqYqOQr/HdJEnukzE/0tJklptAqiK+Yr7yv zkro9I6EhoaE63bVQ9ZRYI91hBXvWeXyTcPdtfE4NmqPlaf7ERp3SQhNfklFFwRwm5Me1N3kOfd 3w== X-Google-Smtp-Source: AGHT+IHc7axPuiH+IWvhITe29E0bOf1G2fzVDaoBqjB1Xv+UyjUGZ2+nCGYkEFsWpNmiIZkr/tAbVQ== X-Received: by 2002:a17:90b:5204:b0:2ea:61de:38f7 with SMTP id 98e67ed59e1d1-2f12802ccd0mr2950958a91.29.1733897912269; Tue, 10 Dec 2024 22:18:32 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:f90e:3b71:6ee2:6197]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2f12fcd4917sm227872a91.38.2024.12.10.22.18.31 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Dec 2024 22:18:31 -0800 (PST) In-Reply-To: <8A7428E6-50EE-4783-82FF-3A62C4756C56@gmail.com> 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:296799 Archived-At: > On Dec 1, 2024, at 6:31=E2=80=AFPM, Yuan Fu wrote: >=20 >=20 >=20 >> On Dec 1, 2024, at 2:33=E2=80=AFPM, Dmitry Gutov = wrote: >>=20 >> On 01/12/2024 21:10, Yuan Fu wrote: >>> 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++). >>=20 >> 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. >>=20 >> 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. >=20 > Not hard-coded, but customizable, like this: >=20 > Yuan >=20 > Circling back on this. WDYT? I think this would benefit all =E2=80=9Cmoder= n=E2=80=9D languages with chaining method calls. Yuan=