From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#74963: Ambiguous treesit named and anonymous nodes in ruby-ts-mode Date: Tue, 24 Dec 2024 19:52:53 +0200 Organization: LINKOV.NET Message-ID: <875xn9j7d6.fsf@mail.linkov.net> 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> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36358"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/31.0.50 (x86_64-pc-linux-gnu) Cc: Dmitry Gutov , 74963@debbugs.gnu.org To: Yuan Fu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 24 18:55:41 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 1tQ989-0009Er-7c for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 24 Dec 2024 18:55:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQ97e-0005hn-9m; Tue, 24 Dec 2024 12:55:10 -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 1tQ97X-0005g8-0b for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 12:55: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 1tQ97V-0005uz-T6 for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 12:55:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=lI2IUkl0p85HyOPIkoMOkR1x52BltP674gqsgOEdfCQ=; b=tM0KimuBTELg+y//N/piuQbsBaUATT/I64m2zUGOSQQ43Byo7dkimJWvHuxmHt8Lom5kUrsFwAFwzN6c1rjKsSNT39gec/ozIrElZtyECsDOfhuzR0yT5GQ9i+A4LiLv48kysNN8VKffTNCG3ZQIEkBgpnH95cUT1OPJ1nf8HrtWxBDR10wLeMfZsWoV27d98FBTc84ZtTgJ4ZDyNPuACCbZOipziSF8AqBwmdA+FjNxrCpT27hykNb6oUhYBP7BDeaMgrq37rxMhtMbOX/2FMICo4X4m7Nqjfl9QUNRXcTUtlKWz0DzMV4R6CiW+XrYDBqDcpNvbSt1y3z+ZEiWgg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tQ97V-0005mq-KR for bug-gnu-emacs@gnu.org; Tue, 24 Dec 2024 12:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 24 Dec 2024 17:55:01 +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.173506289822229 (code B ref 74963); Tue, 24 Dec 2024 17:55:01 +0000 Original-Received: (at 74963) by debbugs.gnu.org; 24 Dec 2024 17:54:58 +0000 Original-Received: from localhost ([127.0.0.1]:34137 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQ97R-0005mS-W9 for submit@debbugs.gnu.org; Tue, 24 Dec 2024 12:54:58 -0500 Original-Received: from relay6-d.mail.gandi.net ([217.70.183.198]:38947) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tQ97P-0005m3-5v for 74963@debbugs.gnu.org; Tue, 24 Dec 2024 12:54:56 -0500 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 3C5C8C0003; Tue, 24 Dec 2024 17:54:47 +0000 (UTC) In-Reply-To: <4DFCFBC8-A353-48F2-8257-D6CFB155A030@gmail.com> (Yuan Fu's message of "Mon, 23 Dec 2024 19:02:28 -0800") X-GND-Sasl: juri@linkov.net 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:297696 Archived-At: > I’ll go with the (and named “unless”) route because after thinking > about it more, “(unless)” will be hard to work with because the string > predicate is actually a regexp. Is it possible to mark all node names specified in treesit-thing-settings as named? I just discovered a new problem: 1. With typescript-ts-mode on the following snippet: type NodeInfo = | (BaseNode & { subtypes: BaseNode[]; }) | (BaseNode & { fields: { [name: string]: ChildNode }; children: ChildNode[]; }); You can move point inside "string" and type C-M-f or C-M-b. But point doesn't move. This is because treesit-thing-settings defines a named node "string". But anonymous node has the same name "string": (index_signature [ name: (identifier) : index_type: (predefined_type string) and (treesit-node-at (point)) returns # This mismatched "string" in TypeScript is even more unexpected than "unless" in Ruby. 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.