From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu 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: Tue, 31 Dec 2024 13:02:52 -0800 Message-ID: <3E789578-4ECC-4D96-BA59-F0B400EF32DF@gmail.com> References: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3776.700.51\)) 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="7856"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eval Exec , 75164@debbugs.gnu.org To: Charalampos Mitrodimas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 31 22:05:27 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 1tSjQc-0001uH-OA for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 31 Dec 2024 22:05:26 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tSjQP-0000bA-ME; Tue, 31 Dec 2024 16:05:15 -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 1tSjQF-0000W8-8R for bug-gnu-emacs@gnu.org; Tue, 31 Dec 2024 16:05:06 -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 1tSjQE-0001sj-NN for bug-gnu-emacs@gnu.org; Tue, 31 Dec 2024 16:05:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:Date:In-Reply-To:From:Mime-Version:To:Subject; bh=Mk2gXc4+y1ert4fjMg6GmFIMN8mIDN8J7J2iFuG7H74=; b=FvdMSXYX60A4uVIS+iaE+ocF1N3YuQmHYGwzbDioGkNprd8tK48VD8v3LfcDPBQ/pCkj70ZbTDwWpgHJa/d2q2P9pAiPbLAeHBV3yeT2P2x2dMMuXX6BA6YmH2DiPER6GSL0N1gOQ6dfpjyTc5wi6msevm+eBhhabzbPyU0Pn8rY6fPMrc1dOqQkipVW23pCeqAdXFRus/NHOaf5rZJKq5cankWE8Z2rtxmOUUQkSiUWO9QUviid/B8DZ2biYifh1Ftf9BPVrsSoeqcWy1rrqCyJ1GcTRyajd5y16IqHSQTzscZUwbN5uzQrEVHgJbrQ/u5dQjxNs1FmQSTqxrTD/A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tSjQE-0000SV-Br for bug-gnu-emacs@gnu.org; Tue, 31 Dec 2024 16:05:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 31 Dec 2024 21:05:02 +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.17356790481681 (code B ref 75164); Tue, 31 Dec 2024 21:05:02 +0000 Original-Received: (at 75164) by debbugs.gnu.org; 31 Dec 2024 21:04:08 +0000 Original-Received: from localhost ([127.0.0.1]:36933 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tSjPL-0000R3-R7 for submit@debbugs.gnu.org; Tue, 31 Dec 2024 16:04:08 -0500 Original-Received: from mail-pj1-f46.google.com ([209.85.216.46]:50617) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tSjPJ-0000Qs-HZ for 75164@debbugs.gnu.org; Tue, 31 Dec 2024 16:04:06 -0500 Original-Received: by mail-pj1-f46.google.com with SMTP id 98e67ed59e1d1-2ee86a1a92dso11080281a91.1 for <75164@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) Original-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) In-Reply-To: X-Mailer: Apple Mail (2.3776.700.51) 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:298054 Archived-At: > On Dec 29, 2024, at 4:28=E2=80=AFPM, Charalampos Mitrodimas = wrote: >=20 > Hi, >=20 > Eval Exec 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=