[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 5c51bc934eb 1/2: Add font-locking for Rust macros (bug#70464)
From: |
Yuan Fu |
Subject: |
master 5c51bc934eb 1/2: Add font-locking for Rust macros (bug#70464) |
Date: |
Mon, 22 Apr 2024 00:58:41 -0400 (EDT) |
branch: master
commit 5c51bc934ebb88dd9dd8b228e99c39518c92c54b
Author: Noah Peart <noah.v.peart@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>
Add font-locking for Rust macros (bug#70464)
* lisp/progmodes/rust-ts-mode.el
(rust-ts-mode--font-lock-settings): Add font-locking for Rust
macro metavariables, fragment specifiers and repitition patterns.
---
lisp/progmodes/rust-ts-mode.el | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index 92978db64af..25f1df4a9f9 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -179,6 +179,8 @@ to be checked as its standard input."
(function_signature_item name: (identifier) @font-lock-function-name-face)
(macro_definition "macro_rules!" @font-lock-constant-face)
(macro_definition (identifier) @font-lock-preprocessor-face)
+ (token_binding_pattern
+ name: (metavariable) @font-lock-variable-name-face)
(field_declaration name: (field_identifier) @font-lock-property-name-face)
(parameter pattern: (_) @rust-ts-mode--fontify-pattern)
(closure_parameters (_) @rust-ts-mode--fontify-pattern)
@@ -219,7 +221,9 @@ to be checked as its standard input."
:language 'rust
:feature 'operator
- `([,@rust-ts-mode--operators] @font-lock-operator-face)
+ `([,@rust-ts-mode--operators] @font-lock-operator-face
+ (token_repetition_pattern ["$" "*" "+"] @font-lock-operator-face)
+ (token_repetition ["$" "*" "+"] @font-lock-operator-face))
:language 'rust
:feature 'string
@@ -249,8 +253,7 @@ to be checked as its standard input."
(_ type: (scoped_identifier
path: (identifier) @font-lock-type-face))))
(mod_item name: (identifier) @font-lock-constant-face)
- (primitive_type) @font-lock-type-face
- (type_identifier) @font-lock-type-face
+ [(fragment_specifier) (primitive_type) (type_identifier)]
@font-lock-type-face
((scoped_identifier name: (identifier) @rust-ts-mode--fontify-tail))
((scoped_identifier path: (identifier) @font-lock-type-face)
(:match ,(rx bos
@@ -260,8 +263,7 @@ 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))
- (type_identifier) @font-lock-type-face)
+ ((scoped_type_identifier path: (identifier)
@rust-ts-mode--fontify-scope)))
:language 'rust
:feature 'property
@@ -295,7 +297,8 @@ to be checked as its standard input."
(return_expression (identifier) @font-lock-variable-use-face)
(tuple_expression (identifier) @font-lock-variable-use-face)
(unary_expression (identifier) @font-lock-variable-use-face)
- (while_expression condition: (identifier) @font-lock-variable-use-face))
+ (while_expression condition: (identifier) @font-lock-variable-use-face)
+ (metavariable) @font-lock-variable-use-face)
:language 'rust
:feature 'escape-sequence