unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Charalampos Mitrodimas <charmitro@posteo.net>
To: Eval Exec <execvy@gmail.com>
Cc: 75164@debbugs.gnu.org
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	[thread overview]
Message-ID: <m21pxqggj9.fsf@posteo.net> (raw)
In-Reply-To: <CAKfPJDq5i-WaoZ+1-=F1VGxm_2YWTqN45H+7f0Y8+BRFMnM7DQ@mail.gmail.com> (Eval Exec's message of "Sun, 29 Dec 2024 00:25:24 +0800")

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.


                            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





  reply	other threads:[~2024-12-30  0:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-28 16:25 bug#75164: treesit-font-lock-fontify-region is easy to lost color on parse error. suggest to remain fontify on parse error Eval Exec
2024-12-30  0:28 ` Charalampos Mitrodimas [this message]
2024-12-31 21:02   ` Yuan Fu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m21pxqggj9.fsf@posteo.net \
    --to=charmitro@posteo.net \
    --cc=75164@debbugs.gnu.org \
    --cc=execvy@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).