GNU bug report logs - #75164
treesit-font-lock-fontify-region is easy to lost color on parse error. suggest to remain fontify on parse error.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Eval Exec <execvy@HIDDEN>; dated Sat, 28 Dec 2024 16:26:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 75164 <at> debbugs.gnu.org:


Received: (at 75164) by debbugs.gnu.org; 31 Dec 2024 21:04:08 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Dec 31 16:04:08 2024
Received: from localhost ([127.0.0.1]:36933 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tSjPL-0000R3-R7
	for submit <at> debbugs.gnu.org; Tue, 31 Dec 2024 16:04:08 -0500
Received: from mail-pj1-f46.google.com ([209.85.216.46]:50617)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <casouri@HIDDEN>) id 1tSjPJ-0000Qs-HZ
 for 75164 <at> debbugs.gnu.org; Tue, 31 Dec 2024 16:04:06 -0500
Received: by mail-pj1-f46.google.com with SMTP id
 98e67ed59e1d1-2ee86a1a92dso11080281a91.1
 for <75164 <at> debbugs.gnu.org>; Tue, 31 Dec 2024 13:04:05 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735678984; x=1736283784; 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=Mk2gXc4+y1ert4fjMg6GmFIMN8mIDN8J7J2iFuG7H74=;
 b=H5amEZt/LhghkGb16tTwgyeXPAElekgXOBasr313XRk9+HaevDlUr4h5Ur90Hjytwj
 vmlf3EY49lU2fd20kJQQexSQ3vzQ7w3mfA9n8PcOaIbvtiPhqZ2uqvZqFjrkAkGlfmuX
 /5FciRkcoFbqEQagT+SDxA3KYqf/fkflsdz9tlWqqMYRdO828K4MAw2vJlnqUW2/pzli
 eq6rGIwfmFMQ4Uu+DmTTBxWjEmvzUERVojsJi9fHjyq2HCY/Efopjh6wVhdJhp7eUWeG
 W4RQ2kFnXOQQLg2XCdUXVHAHK0nQ+OItAjgDZY4IWdmrVeueXLzbYDcf3Wa46c/AUJxC
 WayQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735678984; x=1736283784;
 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=Mk2gXc4+y1ert4fjMg6GmFIMN8mIDN8J7J2iFuG7H74=;
 b=FhNXZgPjnKqhxLtls5RhOrZLs1L2BrTedDA1qfg2FNgGPTa5u4QxJJZHdeVAc9hcvh
 sMA+pL1QPcZaHTgXiAM3MRMlPPf95FkNtN1xUmjiXZFqPX/2+jEiOy9o8ysEK9xNZ3bw
 8FIXOEDuPhZkeHOY+U+igixS4cfEFqbtGEix6HTNTcUxFcVMIvETlLxgawf1TwCNztbk
 wCplUrLEUjD8fNgHleOBV9YSCGzQ4JM3877eiZyEdSfRE8PncnAM5GEJsU6wY824l88y
 j/PR4N05pXIan2dEBATrlNIZpRkdFXuZEPd7x6o71WS8BMstoNApyU6k9Rm94KynRff8
 Y4NA==
X-Forwarded-Encrypted: i=1;
 AJvYcCXRvBQ2VBXVowwGD9sHoaPt5OEZgZaAnyFqlc93OKB6SSUSVlL+U6+mQJaY8cRIgz5SVziwDQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwC5xjf4PUj4QXZf/gJ1zNHLFS6Zh5wzGggrqULld6HCsdUFYsc
 dKrpuGPo4+WVYJwEPs1h2x42HALVMMETewveIVsgd1j2qkwDbXi+
X-Gm-Gg: ASbGnct5KAwLi2X5RyOdVkE/Vrxvu9hzefySAeoRGKlbBid7GJjMbYz8D502yKvDDXt
 RHKwy6eHmSKPQ+4fXPJ80a/1L93E39OwIZSV0GmwzHpsBxOk0d0oKP7sLs4sYQEo+HaN8DGjEcT
 EZJw5okWBVwAzWlt6I9cPyK/ANL/XqX0NvYBI3EQocFo9/BHnvFnmZ1UKD1BqLnxMEQj415AmAu
 gZ3GWRHwf2YebAtErESvEaLNAZW5qcEgRPfcGI6nh7p2royAHHJY1U1/vdGCi4BK1MtJQXw5Zdn
 p02n
X-Google-Smtp-Source: AGHT+IGpS59IDsLZJLDzVKBjuVi+N/JYtWr9TWsXTm6iOctvR9Oo/lisU/wMCY40NELgpfltBYSzHw==
X-Received: by 2002:a17:90b:51cb:b0:2ee:b83f:f876 with SMTP id
 98e67ed59e1d1-2f452ec6d8bmr53483054a91.23.1735678984467; 
 Tue, 31 Dec 2024 13:03:04 -0800 (PST)
Received: from smtpclient.apple ([2601:646:8f81:6120:85eb:71bd:58ac:56a8])
 by smtp.gmail.com with ESMTPSA id
 98e67ed59e1d1-2f4477ec656sm22942287a91.30.2024.12.31.13.03.03
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 31 Dec 2024 13:03:03 -0800 (PST)
Content-Type: text/plain;
	charset=utf-8
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\))
Subject: Re: bug#75164: treesit-font-lock-fontify-region is easy to lost color
 on parse error. suggest to remain fontify on parse error.
From: Yuan Fu <casouri@HIDDEN>
In-Reply-To: <m21pxqggj9.fsf@HIDDEN>
Date: Tue, 31 Dec 2024 13:02:52 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <3E789578-4ECC-4D96-BA59-F0B400EF32DF@HIDDEN>
References: <CAKfPJDq5i-WaoZ+1-=F1VGxm_2YWTqN45H+7f0Y8+BRFMnM7DQ@HIDDEN>
 <m21pxqggj9.fsf@HIDDEN>
To: Charalampos Mitrodimas <charmitro@HIDDEN>
X-Mailer: Apple Mail (2.3776.700.51)
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 75164
Cc: Eval Exec <execvy@HIDDEN>, 75164 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)



> On Dec 29, 2024, at 4:28=E2=80=AFPM, Charalampos Mitrodimas =
<charmitro@HIDDEN> wrote:
>=20
> Hi,
>=20
> Eval Exec <execvy@HIDDEN> writes:
>=20
>> 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
>>=20
>> struct Dog {
>>    name: String,
>>    age: u8,
>> }
>>=20
>>=20
>> struct ManyStruct {
>>    a: u8,
>> }
>>=20
>> fn many_code(){
>>    fn fib(n: u32) -> u32 {
>>        if n =3D=3D 0 {
>>            return 0;
>>        }
>>        if n =3D=3D 1 {
>>            return 1;
>>        }
>>        fib(n - 1) + fib(n - 2)
>>    }
>> }
>>=20
>> fn main() {
>>    // change below `//` to `/` to see the difference
>>    // {
>> }
>> ```
>>=20
>> 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.
>=20
> Thanks for reporting this.
>=20
> 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.

It=E2=80=99s indeed strange to see the whole buffer lost fontification. =
I don=E2=80=99t see it either.

Yuan=




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75164; Package emacs. Full text available.

Message received at 75164 <at> debbugs.gnu.org:


Received: (at 75164) by debbugs.gnu.org; 30 Dec 2024 00:29:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Dec 29 19:29:10 2024
Received: from localhost ([127.0.0.1]:56629 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tS3eg-000666-8F
	for submit <at> debbugs.gnu.org; Sun, 29 Dec 2024 19:29:10 -0500
Received: from mout02.posteo.de ([185.67.36.66]:60743)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <charmitro@HIDDEN>) id 1tS3ed-00065W-L4
 for 75164 <at> debbugs.gnu.org; Sun, 29 Dec 2024 19:29:09 -0500
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id E79A2240101
 for <75164 <at> 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==
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)
From: Charalampos Mitrodimas <charmitro@HIDDEN>
To: Eval Exec <execvy@HIDDEN>
Subject: Re: bug#75164: treesit-font-lock-fontify-region is easy to lost
 color on parse error. suggest to remain fontify on parse error.
In-Reply-To: <CAKfPJDq5i-WaoZ+1-=F1VGxm_2YWTqN45H+7f0Y8+BRFMnM7DQ@HIDDEN>
 (Eval Exec's message of "Sun, 29 Dec 2024 00:25:24 +0800")
References: <CAKfPJDq5i-WaoZ+1-=F1VGxm_2YWTqN45H+7f0Y8+BRFMnM7DQ@HIDDEN>
Date: Mon, 30 Dec 2024 00:28:58 +0000
Message-ID: <m21pxqggj9.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 75164
Cc: 75164 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Hi,

Eval Exec <execvy@HIDDEN> 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#75164; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 28 Dec 2024 16:25:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Dec 28 11:25:48 2024
Received: from localhost ([127.0.0.1]:52419 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1tRZdL-0005NN-KQ
	for submit <at> debbugs.gnu.org; Sat, 28 Dec 2024 11:25:47 -0500
Received: from lists.gnu.org ([209.51.188.17]:46194)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <execvy@HIDDEN>) id 1tRZdI-0005N6-DF
 for submit <at> debbugs.gnu.org; Sat, 28 Dec 2024 11:25:45 -0500
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 <execvy@HIDDEN>) id 1tRZdD-0006xx-Oq
 for bug-gnu-emacs@HIDDEN; Sat, 28 Dec 2024 11:25:39 -0500
Received: from mail-oa1-x42.google.com ([2001:4860:4864:20::42])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <execvy@HIDDEN>) id 1tRZdC-0006bo-7e
 for bug-gnu-emacs@HIDDEN; Sat, 28 Dec 2024 11:25:39 -0500
Received: by mail-oa1-x42.google.com with SMTP id
 586e51a60fabf-29e2a50586dso3837519fac.0
 for <bug-gnu-emacs@HIDDEN>; Sat, 28 Dec 2024 08:25:36 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1735403135; x=1736007935; darn=gnu.org;
 h=to:subject:message-id:date:from:mime-version:from:to:cc:subject
 :date:message-id:reply-to;
 bh=TOSkWF80jrC5ZMBuyf8wxB6GuD8HKlabWDjnDWtCoho=;
 b=VHV7xN+MjRknipR1HxqvsoC+R924qWiSuU2Z897BRu4pfMrUteDez23YhGK9IbMQFn
 44Nc2VjHqiIrXQp8ahIvdcO7fGLnFHadBMSfLz8E0WkeSLvuEaJ6l5/d4tZ/B4TaXTjG
 BKm1O5HvR9Wh5r1jo2164YvFXyD2Eg4uJgF88usRUJDEI3e4j9o6RKQosM8Epe3zBsfD
 akh3Ktwzom329BPjtwliW6+eyXiJxq0McnnYDdS8XNRGpNCy2qTCXBGF7ySzuvaD0xV9
 OkjGdQlGKaxLmYvXQIuiBFA8aWkE/flVq7fKTx+aDff3bHHwK0pdRBpOf1otKDUmEQvk
 Gn+g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1735403135; x=1736007935;
 h=to:subject:message-id:date:from:mime-version:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=TOSkWF80jrC5ZMBuyf8wxB6GuD8HKlabWDjnDWtCoho=;
 b=lTvhOldS9E8g+jK4Fg0X4tWfWNqAZhPAbkQuJfCE5eYCLC1REUBgEaHpchADFMdCOv
 xx/Ou9r5120ZBodOmsQnk+SwPBPdCNyNZtHnZSLihv4M5ufaC5UhHcmrf9JtA83VrSeN
 WsokV2VqeXp9+/dVA+LIiOYz3BZ9EP5dQKF/6gOiRJH/nMFzvxp4axUdt7vu00cTADlh
 eFZnfs6j2PLSKjvCGRpQ/rLNPem3BObuuNq+BFqLIaENTb1EwntNxXlBU5ct5A5vfD6J
 IQO+NvkySesAfF3Jj0TwKBJCESqvi8xPeKrWfLxqi0gvBdKDq2Q7yZGDYsub/X4zT6Cj
 z7qQ==
X-Gm-Message-State: AOJu0YxZvip6cd313PYJbEwz0jtlxcyXTW8mBKMajWt8GT85fwCebEZl
 BGYWK7NiHk/8wsm3p4wfNTcCGGoGdM/RRLi3sQEj9MGdRdMEKjoCExeNe44C+ZrGA8IdahTFBu2
 u38Gl9UNODbmevaq2Wktf5gM9lhVyIe6aEL/RAoGkL38=
X-Gm-Gg: ASbGnctMdWXgWqiBr6F4hUg8TuRWaNTT/2pQ9lPrVMAVqgixWBqkz23+6nUV8IEhaNJ
 lEZREe9lcJPxBMqdGt/jvJOGBRxuHmLGCxGe76w==
X-Google-Smtp-Source: AGHT+IEh8ss9k55U8wsX3/8tEAG2SfcGQR8qQbrwzcZ5b4MtukSioGcc66U84K4DfZsDDeA0vxvsanpHjrpCySeVUQA=
X-Received: by 2002:a05:6870:6489:b0:296:9c08:51a3 with SMTP id
 586e51a60fabf-2a7fb566111mr14422511fac.39.1735403135110; Sat, 28 Dec 2024
 08:25:35 -0800 (PST)
MIME-Version: 1.0
From: Eval Exec <execvy@HIDDEN>
Date: Sun, 29 Dec 2024 00:25:24 +0800
Message-ID: <CAKfPJDq5i-WaoZ+1-=F1VGxm_2YWTqN45H+7f0Y8+BRFMnM7DQ@HIDDEN>
Subject: treesit-font-lock-fontify-region is easy to lost color on parse
 error. suggest to remain fontify on parse error.
To: bug-gnu-emacs@HIDDEN
Content-Type: text/plain; charset="UTF-8"
Received-SPF: pass client-ip=2001:4860:4864:20::42;
 envelope-from=execvy@HIDDEN; helo=mail-oa1-x42.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-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

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.
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




Acknowledgement sent to Eval Exec <execvy@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#75164; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.