From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Leake Newsgroups: gmane.emacs.devel Subject: Re: [SPAM UNSURE] Re: Initial fontification in sh-mode with tree-sittter Date: Wed, 02 Nov 2022 13:37:55 -0700 Message-ID: <86wn8dytwc.fsf@stephe-leake.org> References: <6C8B0F8E-DF61-4BC3-B0D0-56DBB66BE637@gmail.com> <7AE71CCA-6F18-4DE6-8608-7D9B3E9E52FB@gmail.com> Mime-Version: 1.0 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="10245"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Daniel =?utf-8?Q?Mart=C3=ADn?= , =?utf-8?Q?Jo?= =?utf-8?Q?=C3=A3o?= Paulo Labegalini de Carvalho , emacs-devel@gnu.org To: Yuan Fu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Nov 02 21:38:46 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 1oqKVZ-0002RM-KV for ged-emacs-devel@m.gmane-mx.org; Wed, 02 Nov 2022 21:38:45 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqKV4-0000Qx-1f; Wed, 02 Nov 2022 16:38:14 -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 1oqKV2-0000Qo-Qg for emacs-devel@gnu.org; Wed, 02 Nov 2022 16:38:13 -0400 Original-Received: from gproxy4-pub.mail.unifiedlayer.com ([69.89.23.142]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oqKV1-00039i-1w for emacs-devel@gnu.org; Wed, 02 Nov 2022 16:38:12 -0400 Original-Received: from cmgw14.mail.unifiedlayer.com (unknown [10.0.90.129]) by progateway6.mail.pro1.eigbox.com (Postfix) with ESMTP id A9FC2100453B8 for ; Wed, 2 Nov 2022 20:37:58 +0000 (UTC) Original-Received: from host2007.hostmonster.com ([67.20.76.71]) by cmsmtp with ESMTP id qKUnoD0yYBFF9qKUnoXzte; Wed, 02 Nov 2022 20:37:58 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=PYI6Ogtd c=1 sm=1 tr=0 ts=6362d526 a=dWLzHQi6WpdymmZIwiVdBw==:117 a=Fln8i1WyhtedwaIJAdHvmw==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=IkcTkHD0fZMA:10:nop_charset_1 a=9xFQ1JgjjksA:10:nop_rcvd_month_year a=vvvmwbhNdt4A:10:endurance_base64_authed_username_1 a=pGLkceISAAAA:8 a=iP7G-MkaezNQbyh5uhMA:9 a=QEXdDO2ut3YA:10:nop_charset_2 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=stephe-leake.org; s=default; h=Content-Transfer-Encoding:Content-Type: MIME-Version:Message-ID:Date:References:In-Reply-To:Subject:Cc:To:From:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zWA8uh3DIdepGqZt9N45kW9ym2hFa70+qtSvh+/fPuc=; b=jzlIeXLPRyq3Ve3eplopbuzCsx 5tlaeaD6kNHyJ9WGKfimcRiHTyZioAm056X9Nz/iV8O4dRC5otW+f3KmjJ2fn/VSmcdJq7e13hqgL oEkMH+nZNJMtdgP8Gj35NOH+J6Hwc3SUmQK3ANU3gec3IiC/8W1xZyMj4PRz2B2VkTQTWTvo9Mi6k ANeqTebUNxV9cOKeV7gvLqQr4gMPBTsLwq/4rUVQitpqtVQ5X8/uXuXOTjBgKq5W1E6mZYAuOAD8G JzatWGnl/y1M3LkxSPmIjh/0IDVjFzLEer0+XSQtTpPb2l5XmqjDFUTLEwow++DIny8PEP1PZZOny sRBxz4tg==; Original-Received: from 135-180-197-170.fiber.dynamic.sonic.net ([135.180.197.170]:49522 helo=DESKTOP-G20DCG1) by host2007.hostmonster.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1oqKUn-000jOS-9N; Wed, 02 Nov 2022 14:37:57 -0600 In-Reply-To: <7AE71CCA-6F18-4DE6-8608-7D9B3E9E52FB@gmail.com> (Yuan Fu's message of "Mon, 31 Oct 2022 14:56:02 -0700") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - host2007.hostmonster.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - stephe-leake.org X-BWhitelist: no X-Source-IP: 135.180.197.170 X-Source-L: No X-Exim-ID: 1oqKUn-000jOS-9N X-Source-Sender: 135-180-197-170.fiber.dynamic.sonic.net (DESKTOP-G20DCG1) [135.180.197.170]:49522 X-Source-Auth: stephen_leake@stephe-leake.org X-Email-Count: 7 X-Source-Cap: c3RlcGhlbGU7c3RlcGhlbGU7aG9zdDIwMDcuaG9zdG1vbnN0ZXIuY29t X-Local-Domain: yes Received-SPF: pass client-ip=69.89.23.142; envelope-from=stephen_leake@stephe-leake.org; helo=gproxy4-pub.mail.unifiedlayer.com X-Spam_score_int: 16 X-Spam_score: 1.6 X-Spam_bar: + X-Spam_report: (1.6 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no 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@gnu.org Xref: news.gmane.io gmane.emacs.devel:299041 Archived-At: Yuan Fu writes: > 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 s= tring > 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.=20 I'd say this is a bug in tree-sitter itself (probably in edit-tree). I'm still fixing similar bugs in the wisi incremental parser. > I changed the font-lock rule to match the ending quote rather than the > whole string, and now it=E2=80=99s working fine. A reasonable workaround, but perhaps submit a bug report to tree-sitter github? > 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. People's notion of "better" will differ here. I'd say it is at best acceptable. Best would be to highlight that initial single quote in some error face (bright red). The user could be intending that as the end quote, so declaring everything after it to be a string is just wrong. --=20 -- Stephe