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: Initial fontification in sh-mode with tree-sittter Date: Mon, 31 Oct 2022 17:25:01 -0700 Message-ID: <9BA853EA-8B7F-41A0-A174-D86DF5CE7788@gmail.com> References: <6C8B0F8E-DF61-4BC3-B0D0-56DBB66BE637@gmail.com> <7AE71CCA-6F18-4DE6-8608-7D9B3E9E52FB@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.1\)) 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="22931"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?utf-8?Q?Jo=C3=A3o_Paulo_Labegalini_de_Carvalho?= , emacs-devel@gnu.org To: =?utf-8?Q?Daniel_Mart=C3=ADn?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Nov 01 01:25:57 2022 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 1opf6K-0005h7-06 for ged-emacs-devel@m.gmane-mx.org; Tue, 01 Nov 2022 01:25:56 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opf5b-0007n9-0J; Mon, 31 Oct 2022 20:25:11 -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 1opf5Z-0007ko-26 for emacs-devel@gnu.org; Mon, 31 Oct 2022 20:25:09 -0400 Original-Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1opf5X-0001xD-2t for emacs-devel@gnu.org; Mon, 31 Oct 2022 20:25:08 -0400 Original-Received: by mail-pl1-x62b.google.com with SMTP id p21so8298972plr.7 for ; Mon, 31 Oct 2022 17:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=5LQl6zMx3KHutArty/ESUY3OhX9noW3nK3aXt3fO31E=; b=i41xRwFKIONSHTYJBtKABrkgYR9ZO1qLasGoH6BfxA21yLxwvU13LGS8tG/0vmXL4S izJnOfdqV9W4vRTmiidxH7uzSVTUsMVwdHyK8nIYWYQbQDd4hwQvp/5IotWt3aUQRnC9 oDKfCV9vz8crQaY153CjlvsPf7IABeP0H3UartnhzacSHVCz4fxFo5a06+Sjvb5hoh06 mL7AE2MPuyu+uIu7In4/D3BEGfvmfBmLjJTv+E6OjIsfGwHJ6P8g5PBeS42mdBMNAnXD eG9sTr3vKaBOBYxTG2CvJm85Q9xaKe7Vf16gwKHWsoYAhcvJtxcJfosZfJ1D7yfw2meD lXAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=5LQl6zMx3KHutArty/ESUY3OhX9noW3nK3aXt3fO31E=; b=r+xhAWr5v8jXoeE3OizWDsmtBqznmaIZal4+3cIBGq1nlfLOZV3f7NfR0pWqQm9M1K q5yhrweYISazK0wwtiAZ9alXOE0U8ByOXGbaRpqHiJzgg8lZEIDxiN3aJkV0aQJJ3rhc jtc3t756tq3K0tCxzICcFT8JzTIY8BxP3PADaBnJQCCmfhnGjnDaVtHNk80JeLGX2dpU axJ1Jz+TZgV3K6DOjUbKBpV2O+Bkx+e3H1EwmWY5hSRXqjYkFhPZQ1vMlXGl0iNQJm6O r3OUKufY0RgrHAiXOy7KEGnr8SYHipTAtnfGxhS4gmTJt2zYa5xA/14St0OUF7LZT87d jgPw== X-Gm-Message-State: ACrzQf2N3GAG7aDKr7b++1GBe2IPK1BDcw5fYCEIk+/RvvMaIHF0316M MTelshA/o5nm0tDOynfoO+w= X-Google-Smtp-Source: AMsMyM4c3iNvluND9JUz1J6flBFG74/z36iwA8qVL79wbYjm68H2jsdIhTzlLqDolO42e4HnbKIeLQ== X-Received: by 2002:a17:902:d18c:b0:187:1b86:daba with SMTP id m12-20020a170902d18c00b001871b86dabamr9469195plb.84.1667262303432; Mon, 31 Oct 2022 17:25:03 -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 k12-20020a170902c40c00b00186881e1feasm5008668plk.112.2022.10.31.17.25.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Oct 2022 17:25:02 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.3696.120.41.1.1) Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=casouri@gmail.com; helo=mail-pl1-x62b.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: , Original-Sender: "Emacs-devel" Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:298898 Archived-At: > On Oct 31, 2022, at 5:09 PM, Daniel Mart=C3=ADn = wrote: >=20 > Yuan Fu writes: >=20 >>=20 >> I think I=E2=80=99ve fixed this problem. It is mainly due to how the >> fortifications rule is written. When the starting quotes are = inserted, >> normal syntactic font-lock will mark everything behind it in >> string-face, but for tree-sitter, since the source is incomplete, the >> quotes are in an error node in the parse tree and there is no string >> node, so tree-sitter rules can=E2=80=99t capture any string node, so = no string >> face is applied. And when the ending quotes are inserted, the only >> region jit-lock wants tree-sitter to fontify is that three quote, so >> again the whole string is not captured. I changed the font-lock rule >> to match the ending quote rather than the whole string, and now = it=E2=80=99s >> working fine. >>=20 >> Now it is actually better than before: If you insert an open quote, >> the rest of the buffer will not be marked in string face, instead, = and >> when you insert the ending quote, the string is fontified correctly. >>=20 >=20 > I can still reproduce the problem, with same reproduction steps that I > mentioned before. >=20 > Curiously, as soon as I press C-l, the text gets fontified with the > string face. I think that=E2=80=99s just jit-lock & redisplay doing funny stuff. If = you set treesit--font-lock-verbose to t, it should log that appropriate = faces are applied when you insert the quote. Yuan=