emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 2e9777512a0: Add a heuristic for type font-lock in rust-ts-mode (


From: Yuan Fu
Subject: master 2e9777512a0: Add a heuristic for type font-lock in rust-ts-mode (bug#69625)
Date: Sat, 6 Jul 2024 17:09:20 -0400 (EDT)

branch: master
commit 2e9777512a0cd2fb2e60706d6908247496faeeec
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Add a heuristic for type font-lock in rust-ts-mode (bug#69625)
    
    * lisp/progmodes/rust-ts-mode.el:
    (rust-ts-mode--font-lock-settings): Add rule.
---
 lisp/progmodes/rust-ts-mode.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index baf0e1ec013..cdbf381d023 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -267,7 +267,11 @@ to be checked as its standard input."
                    eos)
               @font-lock-type-face))
      ((scoped_identifier path: (identifier) @rust-ts-mode--fontify-scope))
-     ((scoped_type_identifier path: (identifier) 
@rust-ts-mode--fontify-scope)))
+     ((scoped_type_identifier path: (identifier) @rust-ts-mode--fontify-scope))
+     ;; Sometimes the parser can't determine if an identifier is a type,
+     ;; so we use this heuristic. See bug#69625 for the full discussion.
+     ((identifier) @font-lock-type-face
+      (:match ,(rx bos upper) @font-lock-type-face)))
 
    :language 'rust
    :feature 'property



reply via email to

[Prev in Thread] Current Thread [Next in Thread]