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#66183: elixir-ts-mode test failure Date: Tue, 26 Sep 2023 11:00:23 -0700 Message-ID: References: <87fs33wiki.fsf@pub.pink> <874jjg51mc.fsf@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="38303"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 66183@debbugs.gnu.org, jm@pub.pink To: Wilhelm Kirschbaum Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Sep 26 20:01:16 2023 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 1qlCN2-0009os-Bq for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Sep 2023 20:01:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qlCMe-000579-Pm; Tue, 26 Sep 2023 14:00:52 -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 1qlCMa-00056r-Vy for bug-gnu-emacs@gnu.org; Tue, 26 Sep 2023 14:00:49 -0400 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 1qlCMa-0004BA-NC for bug-gnu-emacs@gnu.org; Tue, 26 Sep 2023 14:00:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qlCMn-0006aK-Px for bug-gnu-emacs@gnu.org; Tue, 26 Sep 2023 14:01:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Sep 2023 18:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66183 X-GNU-PR-Package: emacs X-Debbugs-Original-Cc: 66183@debbugs.gnu.org, Bug Report Emacs , john muhl Original-Received: via spool by 66183-submit@debbugs.gnu.org id=B66183.169575125725289 (code B ref 66183); Tue, 26 Sep 2023 18:01:01 +0000 Original-Received: (at 66183) by debbugs.gnu.org; 26 Sep 2023 18:00:57 +0000 Original-Received: from localhost ([127.0.0.1]:49703 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qlCMi-0006Zp-Fu for submit@debbugs.gnu.org; Tue, 26 Sep 2023 14:00:56 -0400 Original-Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]:50337) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qlCMh-0006Zb-0o for 66183@debbugs.gnu.org; Tue, 26 Sep 2023 14:00:55 -0400 Original-Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-1bf55a81eeaso66758325ad.0 for <66183@debbugs.gnu.org>; Tue, 26 Sep 2023 11:00:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695751236; x=1696356036; 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=39CMf8PeIOxZo61MZZ+zYwpanUz61k/ASiUZt1Ninto=; b=bsqpUI5y5dfp3d2aDjkL7xvjCZyFFxdWHl56iFqMXlMmZT9DA0JbRmwk/nzIdi7XIM PIKnerN6Iled1KsTV8Dp5vnUjMlHkzTTF4ZtH3Hy51lYQ3EQNYNiPO/Q2lAQGwsXh+XF mn7kz9fGQ3lTz6gL+p1jI4MiK2xgb1TyNogpI5NYGhhFTYYyVWf9AQzR3CXlxctk0iZM SglrtHYo/8q/ukzRfp7wlLmMTlwR40jrCfN2inTjM4DyfHl+lpBygNZqMQZQk/gDoVhl ATkOdiFhmvRovRgRZDXYlxg9HoabLs0mSaDHI6xDFZkKfGtLo0TrGL//TAgcXFbUtyo7 KKVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695751236; x=1696356036; 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=39CMf8PeIOxZo61MZZ+zYwpanUz61k/ASiUZt1Ninto=; b=arpO/rokUh7Sce+gJK71CPFHgyHahJEEWfdoQuWsJWwPiJgriHrNcty0Z5TycuKS/1 iKk6dLOu7XLX6ZrKF34+7aAozoTfQtuF1t3KFX9VTHdGO1mU3orBOyhAZQ+24KtX/QkL vmx0dO0YzHP6u+nK/Yb6Zry4qmiHgDQA3SHrnTGYgnDFyYxHcPX+FjTcvJ7+aBSJpN3H 87aZylaxvLm31D+2zAsgk86kLOqqoQ6pTCZrxSYLVABuR6KiccmtKaQ37hVjx/Qc02MW IarpDlQnaobZy8OHKWmzj0kJB4GxTc4zJN7IALUxZGcQAf7U8TJ7x97wKqndQJdad9hT +xqQ== X-Gm-Message-State: AOJu0YzbAmVK3xWncOkg8mhj+bPJo9GsJpBhYvSL/c0bnm+ra/yg192j n8L3zelv79c+jINzM6+hFKE= X-Google-Smtp-Source: AGHT+IHD5N0i4ff+djM/Su1ZUAjtJN7e4LjCg5Vo+xu+CAWjNrLEGF1NgOPqGVEe82Kh8GO0YxLolg== X-Received: by 2002:a17:903:1cb:b0:1c7:22ae:4081 with SMTP id e11-20020a17090301cb00b001c722ae4081mr409064plh.27.1695751235785; Tue, 26 Sep 2023 11:00:35 -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 l13-20020a170902f68d00b001b54d064a4bsm11307057plg.259.2023.09.26.11.00.34 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Sep 2023 11:00:35 -0700 (PDT) In-Reply-To: <874jjg51mc.fsf@gmail.com> X-Mailer: Apple Mail (2.3731.700.6) 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:271388 Archived-At: > On Sep 26, 2023, at 9:30 AM, Wilhelm Kirschbaum = wrote: >=20 >=20 > Yuan Fu writes: >=20 >>> On Sep 24, 2023, at 9:53 AM, john muhl via Bug reports for GNU >>> Emacs, the Swiss army knife of text editors >>> wrote: >>> The change in 5cba5ee8905 caused an elixir test to start failing. = The >>> white space at the start of the test is now in a heex range so = pressing >>> tab there matches a heex rule instead of the elixir one. Moving the >>> dummy range to the end fixes the test. >>=20 >> Thank you. I=E2=80=99ll make sure to remember also running elixir = tests when I make a change. >>=20 >> I looked around and found elixir-mode=E2=80=99s language-at-point = function >> works in a way that isn=E2=80=99t what tree-sitter functions >> expect. Tree-sitter functions expect the major mode to derive = language >> at point by querying the host language and do some pattern matching, >> rather than using language parser=E2=80=99s range. I took a quick = look at >> elixir=E2=80=99s grammar and came up with this version for a POC. You = probably >=20 > Sorry about that. I had absolutely no idea how it was expected to = work. It=E2=80=99s absolutely my fault :-) Several people have had confusion = about it, because the docstring wasn=E2=80=99t clear enough. I=E2=80=99ve = updated the docstring so hopefully this confusion won=E2=80=99t occur in = the future. >=20 >> need to adjust it but the idea is there. >>=20 >> With the new language-at-point definition, treesit-language-at can >> return the correct language, and the test passes again. >>=20 >> Yuan >>=20 >> [2. text/x-patch; example.diff]... >=20 > This seems to work if you set named on: treesit-node-prev-sibling, > otherwise it just tries to match the \"\"\" against H or F. >=20 > (let* ((node (treesit-node-at point 'elixir))) > (if (and (equal (treesit-node-type node) "quoted_content") > (string-match-p > (rx bos (or "H" "F") eos) > - (treesit-node-text (treesit-node-prev-sibling = node)))) > + (treesit-node-text (treesit-node-prev-sibling node = t)))) > 'heex > 'elixir))) >=20 > I will spend some time in the next couple of hours to catch up to all > the changes. Ah, right. I=E2=80=99ll leave the specifics to you. As long as the = language is derived from the node at point rather than parser range, it = will be fine. Also, there=E2=80=99s no rush. Yuan