mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
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.
This commit is contained in:
parent
146bce4932
commit
a795c51f60
18 changed files with 177 additions and 141 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue