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#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode Date: Wed, 25 Dec 2024 01:11:32 -0800 Message-ID: References: <87plox4mtp.fsf@masteringemacs.org> <86ed4zg1cc.fsf@mail.linkov.net> <87zflac68t.fsf@mail.linkov.net> <87jzcdlxdp.fsf@mail.linkov.net> <87o71jocgs.fsf@mail.linkov.net> <5192B278-66C0-48AE-B881-E57CCBB6B501@gmail.com> <87frmtbc9z.fsf@mail.linkov.net> <86bjxh1h86.fsf@gnu.org> <87y10l8h6k.fsf@mail.linkov.net> <87ldwl8g60.fsf@mail.linkov.net> <87wmg53rdj.fsf@mail.linkov.net> <87a5d0n651.fsf@mail.linkov.net> <87zfktphks.fsf@mail.linkov.net> <87ttb0rwni.fsf_-_@mail.linkov.net> <4DFCFBC8-A353-48F2-8257-D6CFB155A030@gmail.com> <875xn9j7d6.fsf@mail.linkov.net> <49EB9C70-DB16-4846-9646-F0C89B2D28D8@gmail.com> <87o7102oar.fsf@mail.linkov.net> 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="6919"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Dmitry Gutov , 74963@debbugs.gnu.org To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Dec 25 10:13:23 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 1tQNSF-0001f4-5i for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 25 Dec 2024 10:13:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQNRw-0001WE-Dl; Wed, 25 Dec 2024 04:13:04 -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 1tQNRv-0001W3-0s for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 04:13: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 1tQNRu-0005w1-OB for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 04:13: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=h4jwJ2sDmw4FZQcttn+BInGZXfUUOC/1YECCYIp+hzE=; b=oMOUHTeCHB6+hsVdnyS9l6zcNEaFgwlm0vBqP5ywSdrAQ1Bhqy0iYiH7jaiBfRo952C+Bfgu9bnufimNS3gILOyz4botmLJMd3/ULqvJzGjGSO0J0OiYNoZ8uBDbQicsa3LpyYs5IhzGhjLI04/3tW4d1klNHidSKQVz4jyFiNsPCzI9AjS63o6zX8FlTo78Rn3FaBxSpT6hueOhAauTmo4GOJrD+/lqQ6h6M46CttGtf0Tv/O849Wc7Je901o//TbScTjVom99+ufh1ZOMCZHNPEqABlO9chna98PdaNoJBpM1F9H2lrLMs+85Rnog6PIkzTbwlFNTFCtqTbPWkyA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQNRu-0000Y9-HT for bug-gnu-emacs@gnu.org; Wed, 25 Dec 2024 04:13: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, 25 Dec 2024 09:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74963 X-GNU-PR-Package: emacs Original-Received: via spool by 74963-submit@debbugs.gnu.org id=B74963.17351179732091 (code B ref 74963); Wed, 25 Dec 2024 09:13:02 +0000 Original-Received: (at 74963) by debbugs.gnu.org; 25 Dec 2024 09:12:53 +0000 Original-Received: from localhost ([127.0.0.1]:36184 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQNRk-0000Xd-E8 for submit@debbugs.gnu.org; Wed, 25 Dec 2024 04:12:52 -0500 Original-Received: from mail-pl1-f169.google.com ([209.85.214.169]:57459) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQNRi-0000XP-JG for 74963@debbugs.gnu.org; Wed, 25 Dec 2024 04:12:51 -0500 Original-Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-2156e078563so56556045ad.2 for <74963@debbugs.gnu.org>; Wed, 25 Dec 2024 01:12:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735117904; x=1735722704; 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=h4jwJ2sDmw4FZQcttn+BInGZXfUUOC/1YECCYIp+hzE=; b=T+vBRfm2LffQl5gBpOJ4TO4z7YPLGxPOu6p2GELE5u8FyTJQWxXYTiLy8Lg6P3pbOV V3USPPwvbUbGzsSl8cuIA7/A7S0E0HFhbMW0aDi4inJhhJ6poQhqdkQYf5MOaH7Kpwqz aoNRw5gcmYxrqnG5bbB02h3Xb93HxYcYGwulcAQO77P4iJE0oQ13U1Mmm6fd4/6X7LVF HQ9N7VbNv1PAJZ6jzBYnViDdW7s2n9j7DpPoxqSah64T6lC3m1GTxqCoW5/G0dWY19Zj qaB7g2Xx9/FIyMsDmImWSZ9nYzYa1i+Cqf3+PFmjPfNQfhyovJNxs4eduiLK0yf6KGck Ru1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735117904; x=1735722704; 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=h4jwJ2sDmw4FZQcttn+BInGZXfUUOC/1YECCYIp+hzE=; b=XoDGpKvkaJdQaI6xtTvKzK76qtF5fYU2OWiGTOGhjm91k70vZ+25fvzzU4duJKxdsm gLVYbbCHYk7MKKjnIYSgh+GY5dMii6/mY4tk28/5FwXuEOxR5xZsFn5DpImSqu+tBO62 EhYLfwq+1b7OQ8AtWoXw1OJ3vd9pvx8pmP9dv5Uhro+abS71ROaYmGVwm/hnQOfU/Vyj tGFsVEYUFW7ZZLew5RJ7tb1DZHMZn3eXxHSdO7yCxkDmMs9fLFYnnLaCtPUpBju0boL6 8U/BUv2e5ANNLGEFyLsdGqx0Lqazk3lB3HctdouFCrbdJkyHEldGg0SJAWJ6DzCus5aG z9bQ== X-Gm-Message-State: AOJu0YwcOrru96fofeTyRdJ3QEonyfROk3HfufVdcmSdmchz7p9xb4yP cXwQ6fHN9Et4C5oZqv9cc1Iklb1FAk9ZMznXSBCt7TZRt2Hw+ATp X-Gm-Gg: ASbGnctUIVvCtzwSWXkbiY1/0fZ/BSD39jfNgGT1BPyhLMcTHYbt7T+JBHGRnFSxT0F D6O2pZHh6/PdE9ft5HZ7Nm0O8v8NcwaZhvPfLa7JJG3N1EsNaFVb5JWwH4xxBcHALfJv2qvpl1f CcPo2X8UB1djJUdG0cl+0Qrte1XSAdySFCBd9lP5NFcHzmM2dntpecyJmxiojw+fyzOr7C8PCR8 b9/d72oRVjf0OpsVOZpQcNrj2y4kbf5q8peZau7UbD1EVaxamWu5eiCv7OVfv4qU4WZzBuafVZg s3I= X-Google-Smtp-Source: AGHT+IFkNUou7Rk5l0Rp1Swb950lByulSSgijnFiBvXw9cV9OuazA2OxxmQtUgJTVOK6fB2kiddSAw== X-Received: by 2002:a05:6a21:3a85:b0:1e1:b8bf:8e80 with SMTP id adf61e73a8af0-1e5e083f145mr29568455637.41.1735117904645; Wed, 25 Dec 2024 01:11:44 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:e179:285e:283:33ae]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad8dbab4sm10872713b3a.94.2024.12.25.01.11.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Dec 2024 01:11:43 -0800 (PST) In-Reply-To: <87o7102oar.fsf@mail.linkov.net> 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:297725 Archived-At: > On Dec 24, 2024, at 11:49=E2=80=AFPM, Juri Linkov = wrote: >=20 >>> This mismatched "string" in TypeScript is even more >>> unexpected than "unless" in Ruby. >>>=20 >>> So probably we need a way to mark all used nodes as named >>> to avoid such unexpected matches. Maybe matching anonymous nodes >>> should be opt-in, and by default match only named nodes. >>=20 >> IMHO this is just an unfortunate bug that needs to be fixed. I agree = that >> this type of bug are hard to avoid, which is a bad thing, but that = doesn=E2=80=99t >> mean we should try to alleviate it at any cost. Making predicates = named by >> default just adds complexity and inflexibility for not much benefit. >=20 > Not sure if a possible flexibility is better than unintended matches. >=20 > When the authors of a ts-mode carefully selected a list of named nodes = to match, > why treesit should try to match some random and unintended anonymous = nodes? I don=E2=80=99t know and can=E2=80=99t prove how much the flexibility is = worth, but the cost on complexity is real. If everywhere else uses thing = predicates as-is, but sexp navigation auto-converts thing predicates = into named predicate, that=E2=80=99s a cognitive burden and a special = case that=E2=80=99s guaranteed to trip people over. OTOH, what=E2=80=99s the downside of wrapping the sexp predicate with = (and named =E2=80=A6), if you only want named nodes to match? I just think the cost outweighs the benefit, if there is any to begin = with. Yuan=