From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Charalampos Mitrodimas Newsgroups: gmane.emacs.bugs Subject: bug#75164: treesit-font-lock-fontify-region is easy to lost color on parse error. suggest to remain fontify on parse error. Date: Mon, 30 Dec 2024 00:28:58 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40650"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 75164@debbugs.gnu.org To: Eval Exec Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 30 01:30:35 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 1tS3g2-000APq-Fj for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Dec 2024 01:30:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tS3fl-0005Jd-5M; Sun, 29 Dec 2024 19:30:18 -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 1tS3fY-0005FO-6Z for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 19:30: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 1tS3fX-00067n-Tt for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 19:30:03 -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=TbF2anHjPOUOtoP9/pR/duP6ZCYyo2b3YsLhvPjzmm4=; b=ZjHgVeYQsRhUNMPhWjE+0rozUhrSAMuaCfq5Ruyy0HpCzMaHn+E0uxFTgLSLY/AFtBVgG9Tb0tZYgiTINTKUw2zqFi/JmLuRX0R9Uqiie7KXg3oN0JMGaB0UkIJTZXSyJhRLmF+bzJNfSzaCIhfpLelouarqwj7K+FILO5l1nUA7IQlXmTLJj/+7mfQ0k928U82+3E1fMK0Vd1OZ4UtZO4QDn4uhyGRs2U/za2/XSLcXjm9OwSxO7VrAhuIOX9yQJU39KWzSF5cqsiIk7s8WH+YZ8/rQZjKB7oVhkj+2ktVDZPXVsBnmlyhU0of2xoaeSso2TdpXLToi05BxWNWhLg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tS3fX-000682-Ii for bug-gnu-emacs@gnu.org; Sun, 29 Dec 2024 19:30:03 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Charalampos Mitrodimas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Dec 2024 00:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 75164 X-GNU-PR-Package: emacs Original-Received: via spool by 75164-submit@debbugs.gnu.org id=B75164.173551855023446 (code B ref 75164); Mon, 30 Dec 2024 00:30:03 +0000 Original-Received: (at 75164) by debbugs.gnu.org; 30 Dec 2024 00:29:10 +0000 Original-Received: from localhost ([127.0.0.1]:56629 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tS3eg-000666-8F for submit@debbugs.gnu.org; Sun, 29 Dec 2024 19:29:10 -0500 Original-Received: from mout02.posteo.de ([185.67.36.66]:60743) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tS3ed-00065W-L4 for 75164@debbugs.gnu.org; Sun, 29 Dec 2024 19:29:09 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id E79A2240101 for <75164@debbugs.gnu.org>; Mon, 30 Dec 2024 01:29:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1735518540; bh=l9jkMSHHMiHmwxkLgJYRzS73dSqthPeKiMe3a56Wp7o=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type: From; b=MTmsAwzV+pjlUuE+MD2I1HSOGKLy92QZlKhPgItOMpP9dgxB5UeZm6WY/2kAIEh0l Fsc5qnM+VUed4EninosQ4GTjlYjlwSgNx+5hW5xH1aspA/L9KYjjs4itRgjAMLpg3E sang7s+GDMNtgWvwKWQe8EFtzqprpND4Cb7Y0zI82pPsrxqkwZh9QiRIPbtFJSVxG8 3oTBmUjZPdunXCLkDcFiJ8qjiK1rr1LO8fbhD+GJ15iQ8bfbDyMPe1NfVw5SjWHgIc HiQSAFTFB03gX3i9eRu1KUlLaHljE4ev0SuO2KrwkULnzD+d6BmzgodOV4fr/QKEOF 8IdC6s7slWelQ== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4YLxmX0H0cz6tsg; Mon, 30 Dec 2024 01:28:59 +0100 (CET) In-Reply-To: (Eval Exec's message of "Sun, 29 Dec 2024 00:25:24 +0800") 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:297978 Archived-At: Hi, Eval Exec writes: > Hello. > When I enable rust-ts-mode on a rust file, I found treesitter is easy > to make emacs buffer to lost color. > For example, on the following rust code: > ```rust > > struct Dog { > name: String, > age: u8, > } > > > struct ManyStruct { > a: u8, > } > > fn many_code(){ > fn fib(n: u32) -> u32 { > if n == 0 { > return 0; > } > if n == 1 { > return 1; > } > fib(n - 1) + fib(n - 2) > } > } > > fn main() { > // change below `//` to `/` to see the difference > // { > } > ``` > > the rust code is right, and the emacs buffer color is right on every > struct/functions. > But, if I change `// {` to `/ {`, then the rust code is wrong, this > buffer will lost all colors. Thanks for reporting this. I attempted to reproduce this, using your example, when I change `// {` to `/{` only "main" from `fn main()` loses color. The rest of the syntax highlighting remains intact in my setup. C. Mitrodimas > You can see the change on bellow images: > > https://imgur.com/a/4Tnv0GJ > > I suggest emacs can remain colors even if the code is wrong. > > My emacs version info: GNU Emacs 31.0.50