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.devel Subject: Re: Treesit Regression In ec4d29c4494f32acf0ff7c5632a1d951d957f084 Date: Sun, 10 Sep 2023 00:12:16 -0700 Message-ID: <945F818F-AA9B-402B-BCC7-53286EAD2C05@gmail.com> References: <87r0n7dt34.fsf@dfreeman.email> <68CFCC60-F71F-41E3-AF2A-E78E00EB3FD2@gmail.com> <8734zm4qin.fsf@dfreeman.email> <107166BF-6EC2-4D13-9BA4-A6C0DE1CA565@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6\)) 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="14426"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel To: Danny Freeman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Sep 10 09:13:36 2023 Return-path: Envelope-to: ged-emacs-devel@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 1qfEdU-0003bV-Iz for ged-emacs-devel@m.gmane-mx.org; Sun, 10 Sep 2023 09:13:36 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qfEcW-0002bJ-Q1; Sun, 10 Sep 2023 03:12:36 -0400 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 1qfEcT-0002ar-E1 for emacs-devel@gnu.org; Sun, 10 Sep 2023 03:12:34 -0400 Original-Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qfEcQ-0004Hd-AN for emacs-devel@gnu.org; Sun, 10 Sep 2023 03:12:32 -0400 Original-Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1c1ff5b741cso31207495ad.2 for ; Sun, 10 Sep 2023 00:12:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1694329948; x=1694934748; darn=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=gjFDR1gTU+mKOrhiMNZIm6TI+Q0ROQ/6MwIUUu364ic=; b=dI5J1UpLCMnH5SyvKQQN/DbA0ww6oGKH5c3/9g2gfcIwdt/qjPQg4JdNNx5rCPtnZa 0hhma7ItJxcZzlktGiU2xGairZUTilvKdpNvO/VL+mWCkdCzXGucWSpco1Nt8a8+KWpi cESCzQuAxnN1Cv4jE1xPg0HCjr7biUm3Qw/xkeGfmtI89NNJQXwuxXAF673BqMiHSl9p LpBAzI1jfe5ZotmWcjHQq8cOpObYBmYYwKYbL+hqAsIlUtdOQBscTA+zyBWCV5cB5WOy +Hya7WeVtU4p5rPBW/vV1ab5qAUNkA+3H4sNfA1tg3k7ahhxBHMCycLYTmhU7msAzs0i nBSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694329948; x=1694934748; 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=gjFDR1gTU+mKOrhiMNZIm6TI+Q0ROQ/6MwIUUu364ic=; b=aA6n5AQWrSsUarcLKY52jiE//La5KGNHUBG4zE0Jnu65BQxZF85DgB0sgRykA/OiK6 Kf7MRCM4Y3QosxTuwXc1ViRtKr34SrGZ8ErgT0+fe4Jc8fD65klqYO0cmk98TJ46yTjw /9N+jGo/F7ImTpT+1511IztOsQj40QWfMj2D1gjomaHBVoR+y/kSpbB0Bi4bWNp5vzMV nDx7VVKmzil6v8Rq728LyT/xAK+P8LkaATCaM5KHJnZWk2vhwjTBjw8gCS6JFgjrR32M EubB7WZY12HJLFw3gx6bZur1880Z0OP5ycvtHUSAB5wgiC0NfynOp8DjBmqYrmH5zJVM LOfg== X-Gm-Message-State: AOJu0Yxdu2UydDySZzouk2tjQdTO6lI3lAtD7jwnsZGeFn1hr4FDa7sI r74CSO07as1PA1xSnQnh0ysJ9HIPY3g= X-Google-Smtp-Source: AGHT+IG6aerrcY860GMO8MNOSh5PXVDKZsteuNmTCKuRDiXdN1yQn/+nxUJGvP8B7YnWsF/JJzP/9g== X-Received: by 2002:a17:902:ce92:b0:1bb:e71f:793c with SMTP id f18-20020a170902ce9200b001bbe71f793cmr8565192plg.44.1694329948204; Sun, 10 Sep 2023 00:12:28 -0700 (PDT) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id x12-20020a1709029a4c00b001bd41b70b65sm4134261plv.49.2023.09.10.00.12.27 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Sep 2023 00:12:27 -0700 (PDT) In-Reply-To: <107166BF-6EC2-4D13-9BA4-A6C0DE1CA565@gmail.com> X-Mailer: Apple Mail (2.3731.700.6) Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=casouri@gmail.com; helo=mail-pl1-x636.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:310436 Archived-At: > On Sep 9, 2023, at 10:26 PM, Yuan Fu wrote: >=20 >=20 >=20 >> On Sep 9, 2023, at 9:00 PM, Danny Freeman = wrote: >>=20 >>=20 >> Yuan Fu writes: >>>=20 >>> Hmmm, I can=E2=80=99t reproduce this. I=E2=80=99m getting >>>=20 >>> Matched rule: ((parent-is "source") parent-bol 0) >>> Matched rule: (clojure-ts--match-expression-in-body parent 2) >>>=20 >>> The commit you pointed to does change treesit-node-parent, so it = does match with parent-is matcher not working. >>>=20 >>> Might be because I recently upgraded to a newer tree-sitter library. = If you compile with the newest tree-sitter build (from their repo), do = you still see this problem? >>=20 >> Before I was just using whatever tree-sitter version my distro = packages. >> Apparently v0.20.8 (built from the git tag of the same name) >>=20 >> I tried compiling with this version >> = https://github.com/tree-sitter/tree-sitter/commit/524bf7e2c664d4a5dbd0c20d= 4d10f1e58f99e8ce >>=20 >> which at the time of writing is the latest, and still experience the >> same problem. I also made sure to re-compile my grammars. >>=20 >> I may have done something wrong though when building. I'm >> going to try to build using a more traditional process rather than = with >> nix and see if that helps. >>=20 >> Thank you, >> --=20 >> Danny Freeman >=20 > I take that back. It is indeed caused by that commit. I just had a = wrong Emacs build when testing. In that commit, = ts_tree_cursor_goto_first_child_for_byte seem to be the problem. >=20 > Yuan What I found is that, for some reason, = ts_tree_cursor_goto_first_child_for_byte doesn=E2=80=99t always work as = expected in clojure [1]. In your example, if I evaluate = (treesit-node-parent (treesit-node-at (point))) with point at the = beginning of =E2=80=9Cdefn=E2=80=9D, =E2=80=9Cfoo=E2=80=9D, =E2=80=9C[]=E2= =80=9D, and =E2=80=9C1=E2=80=9D, only =E2=80=9Cdefn=E2=80=9D correctly = evaluates to the parent node. I tried this in other modes like = c-ts-mode, but things seems to work fine in all the few cases I tried. So now the question is, is there anything tree-sitter-clojure does = differently? Not saying it does, but that seems like a starting point. [1] Instead of returning the first child node of NODE that extends = beyond POS, ts_tree_cursor_goto_first_child_for_byte (NODE, POS) returns = false (meaning not found). Yuan=