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: Tue, 24 Dec 2024 13:03:45 -0800 Message-ID: <49EB9C70-DB16-4846-9646-F0C89B2D28D8@gmail.com> References: <87plox4mtp.fsf@masteringemacs.org> <86ikueiekp.fsf@mail.linkov.net> <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> 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="38022"; 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 Tue Dec 24 22:05:13 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 1tQC5Z-0009eU-Af for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Dec 2024 22:05:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQC5R-0001g9-1K; Tue, 24 Dec 2024 16:05: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 1tQC5O-0001g0-Nf for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 16:05:02 -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 1tQC5O-0000SA-Ck for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 16:05: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=pw+CT7yyoTg/NEj1lCxzBu99hJh9zssiDact1hlttTQ=; b=CQRDHjQm/0rLmoiXk1M/hNc+22k1pk2I1ulCsSY18gvPcNwEap+yUk4Gz06oe2QmEIEeDfM4us65qS8Kd5hYpdcAhVDwuP7k/0oFwy4viSMzeeSPG1ZPhahtDGS8QDKVN9BvM17U/a9LotR+TfroFjzHcZWCRKWctmru9e0KeZz1jqhFQ60YzF6MMtKqeKt8HGucvGuqg13GqkYHEmhdaZ9laLGIFp5O/WY2VdtrAova+sjoh8OHVc0K9CAOjGUEebz4PxgymG6zX81P045clBJVsWzVlDJifCFQx4eVHc/Ovz7Phszr3WD10KclKlwzN6HwHPXoh/ns8fjf/SVVSg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQC5O-00072a-74 for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 16:05: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: Tue, 24 Dec 2024 21:05: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.173507429927049 (code B ref 74963); Tue, 24 Dec 2024 21:05:02 +0000 Original-Received: (at 74963) by debbugs.gnu.org; 24 Dec 2024 21:04:59 +0000 Original-Received: from localhost ([127.0.0.1]:34832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQC5L-00072D-Ci for submit@debbugs.gnu.org; Tue, 24 Dec 2024 16:04:59 -0500 Original-Received: from mail-pl1-f172.google.com ([209.85.214.172]:57605) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQC5J-000725-D8 for 74963@debbugs.gnu.org; Tue, 24 Dec 2024 16:04:58 -0500 Original-Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-21628b3fe7dso54169385ad.3 for <74963@debbugs.gnu.org>; Tue, 24 Dec 2024 13:04:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735074237; x=1735679037; 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=pw+CT7yyoTg/NEj1lCxzBu99hJh9zssiDact1hlttTQ=; b=hZvo+0swoQG0fl5k9DLE+pc52jVqO+C5kka7O6WojDz+2/K1Lk09dIqMwlKbtys16o m+2mpAynsuU/lUvMuIvszVKoVin4l+GKFWPyBepglwXHuni6xnJT28F9WHYymohUaWaB 3bX+qlUEy5AyzhD6Fz8Pe0mPZ3E6HzdK2dVC6yXQThKBz9UVxBQoNbdK3ze3fUaGpdqD Ce+/dUIMGGKmuMm4kkxVqm3RgIcCDkWAsx0Zm18l3utn8otT4fsD8XAf7fBRbShrdFQM 0dG0gCdgDTB/wBwRbSPZ9iSMhYrHHfN7cL1VaAjAt/nBBYeGQxqjeycK3hVzdvhC530z bRjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735074237; x=1735679037; 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=pw+CT7yyoTg/NEj1lCxzBu99hJh9zssiDact1hlttTQ=; b=jArNPFXUrtBeRrMoSGjvVSIwcjKgWZx69o2V2o5eaM1nf7Nip1dwLKIRUq+Z87/I29 rxwynxRvRuJXJdhykiNggycz11gYucSnmWVUS6xF/Bnzzu5u4AIzPI07lY6IbOYPxHw9 4vgnSV6xe9QB46Is6SwWpG4sLcZlCBO9/6P3iHdmFUyCVLbC808jFeuRnEhlkuxLfIMP qVxJTWR3safDSH3slcM5wPvgsFVcgpZHlkzP8SzwzJRr18rX3JYZLSIPGbjrZlfK+EFF PlKUwxjA82dgxMKJyF0p+mtuMrhoOymffZuDvmbi4/1d8f2/8Tm5Ovrum3FkirOiZG7k 4xnQ== X-Gm-Message-State: AOJu0YxfJReTjH/IhPldgtNoRrSoeOK2VDce3/K3gs8/xqrboKyU3vzh dRwdHC/zODyTZqU2CFqNDjDvPzX4TbLIqflR/zhE8jap/ELr+RhxKsCGmQ== X-Gm-Gg: ASbGnctao82MF+gZDm35zEvcW+rS67ASUB/wJ5DoGBSesFSG4i8GV6DRmsL3kpepzzj drelg+MeM5vd3omK5gq/5TnsxOmusnhZj+v9Ksa+WYsTF3kO1uCnl9m8bW8mCDAdDWgB2bRbbZF 8jdLDXD8RwsPZh7lt6VrMDFYU+pRBezs/o5qdyVV3JxLp1HGnXWEYM2F26f0518v+Ori/G+I2Gi USY9Dt/Awa0e1r0KupUBQRJPwxv084w/Amx+IrT1AWA8/MVJOmecWvfGbMA/1BHHsK8PyK6nm6T KYRg X-Google-Smtp-Source: AGHT+IEXRVl1/c6rtgmRhnjND/1xr3KQcni+1fbShz26POjem7KxVKqm7XFlS95V9feZbjI+iyhEQg== X-Received: by 2002:a05:6a20:9144:b0:1e0:d1db:4d8a with SMTP id adf61e73a8af0-1e5e047801cmr28967664637.10.1735074236792; Tue, 24 Dec 2024 13:03:56 -0800 (PST) Original-Received: from smtpclient.apple ([2601:646:8f81:6120:1d98:6810:9846:b152]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72aad84ee4csm10069982b3a.82.2024.12.24.13.03.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Dec 2024 13:03:56 -0800 (PST) In-Reply-To: <875xn9j7d6.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:297700 Archived-At: > On Dec 24, 2024, at 9:52=E2=80=AFAM, Juri Linkov = wrote: >=20 >> I=E2=80=99ll go with the (and named =E2=80=9Cunless=E2=80=9D) route = because after thinking >> about it more, =E2=80=9C(unless)=E2=80=9D will be hard to work with = because the string >> predicate is actually a regexp. >=20 > Is it possible to mark all node names specified in = treesit-thing-settings > as named? >=20 > I just discovered a new problem: >=20 > 1. With typescript-ts-mode on the following snippet: >=20 > type NodeInfo =3D > | (BaseNode & { > subtypes: BaseNode[]; > }) > | (BaseNode & { > fields: { [name: string]: ChildNode }; > children: ChildNode[]; > }); >=20 > You can move point inside "string" and type C-M-f or C-M-b. > But point doesn't move. >=20 > This is because treesit-thing-settings defines a named node "string". > But anonymous node has the same name "string": >=20 > (index_signature [ name: (identifier) : > index_type: (predefined_type string) >=20 > and (treesit-node-at (point)) returns > # >=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. 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. Yuan=