[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#75164: treesit-font-lock-fontify-region is easy to lost color on par
From: |
Yuan Fu |
Subject: |
bug#75164: treesit-font-lock-fontify-region is easy to lost color on parse error. suggest to remain fontify on parse error. |
Date: |
Tue, 31 Dec 2024 13:02:52 -0800 |
> On Dec 29, 2024, at 4:28 PM, Charalampos Mitrodimas <charmitro@posteo.net>
> wrote:
>
> Hi,
>
> Eval Exec <execvy@gmail.com> 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.
It’s indeed strange to see the whole buffer lost fontification. I don’t see it
either.
Yuan