summaryrefslogtreecommitdiff
path: root/lisp/progmodes/rust-ts-mode.el
diff options
context:
space:
mode:
authorDmitry Gutov <dgutov@yandex.ru>2023-02-25 03:15:46 +0200
committerDmitry Gutov <dgutov@yandex.ru>2023-02-25 03:35:08 +0200
commita795c51f6053272de61bc1721305e3c15ff424ee (patch)
tree4dcc2aea937392b95296c4b943059f1d5c454800 /lisp/progmodes/rust-ts-mode.el
parent146bce49321da3b65d0a0e0326bb54cf1e79551c (diff)
downloademacs-a795c51f6053272de61bc1721305e3c15ff424ee.tar.gz
emacs-a795c51f6053272de61bc1721305e3c15ff424ee.tar.bz2
emacs-a795c51f6053272de61bc1721305e3c15ff424ee.zip
Add more/finer faces for tree-sitter
* doc/lispref/modes.texi (Faces for Font Lock): Update the list of faces (bug#61655). * etc/NEWS: Update the list of new faces. * lisp/cus-theme.el (custom-theme--listed-faces): Update. * lisp/font-lock.el (font-lock-function-call-face) (font-lock-variable-ref-face, font-lock-property-ref-face): New faces. (font-lock-property-name-face): Rename from 'font-lock-property-face'. * lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings): Use new faces. More 'enumerator' query to 'definition' feature. (c-ts-mode--fontify-declarator, c-ts-mode--fontify-variable): Use new faces. * lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/csharp-mode.el (csharp-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/go-ts-mode.el (go-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/java-ts-mode.el (java-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/js.el (js--treesit-fontify-assignment-lhs) (js--treesit-font-lock-settings): Use new faces. Highlight variable definitions inside array and object destructuring patterns. * lisp/progmodes/python.el (python--treesit-variable-p): Exclude identifiers in parameters. (python--treesit-settings): Use new faces. Highlight function parameters. Move 'keyword' up to still highlight 'self' as keyword. * lisp/progmodes/ruby-ts-mode.el (ruby-ts--font-lock-settings): Use new faces. * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings): Use new faces. * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--font-lock-settings): Use new faces. * lisp/textmodes/css-mode.el (css--treesit-settings): Use font-lock-property-ref-face. * lisp/textmodes/toml-ts-mode.el (toml-ts-mode--font-lock-settings): Use font-lock-property-ref-face. * lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode--font-lock-settings): Same.
Diffstat (limited to 'lisp/progmodes/rust-ts-mode.el')
-rw-r--r--lisp/progmodes/rust-ts-mode.el56
1 files changed, 28 insertions, 28 deletions
diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el
index ee73ebf7a9f..a46d442a0e5 100644
--- a/lisp/progmodes/rust-ts-mode.el
+++ b/lisp/progmodes/rust-ts-mode.el
@@ -157,7 +157,7 @@
'((function_item name: (identifier) @font-lock-function-name-face)
(macro_definition "macro_rules!" @font-lock-constant-face)
(macro_definition (identifier) @font-lock-preprocessor-face)
- (field_declaration name: (field_identifier) @font-lock-property-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)
(let_declaration pattern: (_) @rust-ts-mode--fontify-pattern)
@@ -174,17 +174,17 @@
:feature 'function
'((call_expression
function:
- [(identifier) @font-lock-function-name-face
+ [(identifier) @font-lock-function-call-face
(field_expression
- field: (field_identifier) @font-lock-function-name-face)
+ field: (field_identifier) @font-lock-function-call-face)
(scoped_identifier
- name: (identifier) @font-lock-function-name-face)])
+ name: (identifier) @font-lock-function-call-face)])
(generic_function
- function: [(identifier) @font-lock-function-name-face
+ function: [(identifier) @font-lock-function-call-face
(field_expression
- field: (field_identifier) @font-lock-function-name-face)
+ field: (field_identifier) @font-lock-function-call-face)
(scoped_identifier
- name: (identifier) @font-lock-function-name-face)])
+ name: (identifier) @font-lock-function-call-face)])
(macro_invocation macro: (identifier) @font-lock-preprocessor-face))
:language 'rust
@@ -239,8 +239,8 @@
:language 'rust
:feature 'property
- '((field_identifier) @font-lock-property-face
- (shorthand_field_initializer (identifier) @font-lock-property-face))
+ '((field_identifier) @font-lock-property-ref-face
+ (shorthand_field_initializer (identifier) @font-lock-property-ref-face))
;; Must be under type, otherwise some imports can be highlighted as constants.
:language 'rust
@@ -251,25 +251,25 @@
:language 'rust
:feature 'variable
- '((arguments (identifier) @font-lock-variable-name-face)
- (array_expression (identifier) @font-lock-variable-name-face)
- (assignment_expression right: (identifier) @font-lock-variable-name-face)
- (binary_expression left: (identifier) @font-lock-variable-name-face)
- (binary_expression right: (identifier) @font-lock-variable-name-face)
- (block (identifier) @font-lock-variable-name-face)
- (compound_assignment_expr right: (identifier) @font-lock-variable-name-face)
- (field_expression value: (identifier) @font-lock-variable-name-face)
- (field_initializer value: (identifier) @font-lock-variable-name-face)
- (if_expression condition: (identifier) @font-lock-variable-name-face)
- (let_condition value: (identifier) @font-lock-variable-name-face)
- (let_declaration value: (identifier) @font-lock-variable-name-face)
- (match_arm value: (identifier) @font-lock-variable-name-face)
- (match_expression value: (identifier) @font-lock-variable-name-face)
- (reference_expression value: (identifier) @font-lock-variable-name-face)
- (return_expression (identifier) @font-lock-variable-name-face)
- (tuple_expression (identifier) @font-lock-variable-name-face)
- (unary_expression (identifier) @font-lock-variable-name-face)
- (while_expression condition: (identifier) @font-lock-variable-name-face))
+ '((arguments (identifier) @font-lock-variable-ref-face)
+ (array_expression (identifier) @font-lock-variable-ref-face)
+ (assignment_expression right: (identifier) @font-lock-variable-ref-face)
+ (binary_expression left: (identifier) @font-lock-variable-ref-face)
+ (binary_expression right: (identifier) @font-lock-variable-ref-face)
+ (block (identifier) @font-lock-variable-ref-face)
+ (compound_assignment_expr right: (identifier) @font-lock-variable-ref-face)
+ (field_expression value: (identifier) @font-lock-variable-ref-face)
+ (field_initializer value: (identifier) @font-lock-variable-ref-face)
+ (if_expression condition: (identifier) @font-lock-variable-ref-face)
+ (let_condition value: (identifier) @font-lock-variable-ref-face)
+ (let_declaration value: (identifier) @font-lock-variable-ref-face)
+ (match_arm value: (identifier) @font-lock-variable-ref-face)
+ (match_expression value: (identifier) @font-lock-variable-ref-face)
+ (reference_expression value: (identifier) @font-lock-variable-ref-face)
+ (return_expression (identifier) @font-lock-variable-ref-face)
+ (tuple_expression (identifier) @font-lock-variable-ref-face)
+ (unary_expression (identifier) @font-lock-variable-ref-face)
+ (while_expression condition: (identifier) @font-lock-variable-ref-face))
:language 'rust
:feature 'escape-sequence