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:
Dmitry Gutov 2023-02-25 03:15:46 +02:00
parent 146bce4932
commit a795c51f60
18 changed files with 177 additions and 141 deletions

View file

@ -3679,10 +3679,20 @@ in C.
@vindex font-lock-function-name-face @vindex font-lock-function-name-face
for the name of a function being defined or declared. for the name of a function being defined or declared.
@item font-lock-function-call-face
@vindex font-lock-function-call-face
for the name of a function being called. This face inherits, by
default, from @code{font-lock-function-name-face}.
@item font-lock-variable-name-face @item font-lock-variable-name-face
@vindex font-lock-variable-name-face @vindex font-lock-variable-name-face
for the name of a variable being defined or declared. for the name of a variable being defined or declared.
@item font-lock-variable-ref-face
@vindex font-lock-variable-ref-face
for the name of a variable being referenced. This face inherits, by
default, from @code{font-lock-variable-name-face}.
@item font-lock-keyword-face @item font-lock-keyword-face
@vindex font-lock-keyword-face @vindex font-lock-keyword-face
for a keyword with special syntactic significance, like @samp{for} and for a keyword with special syntactic significance, like @samp{for} and
@ -3756,11 +3766,16 @@ for numbers.
@vindex font-lock-operator-face @vindex font-lock-operator-face
for operators. for operators.
@item font-lock-property-face @item font-lock-property-name-face
@vindex font-lock-property-face @vindex font-lock-property-name-face
for properties of an object, such as the declaration and use of fields for properties of an object, such as the declaration of fields in a
in a struct. struct. This face inherits, by default, from
This face inherits, by default, from @code{font-lock-variable-name-face}. @code{font-lock-variable-name-face}.
@item font-lock-property-ref-face
@vindex font-lock-property-ref-face
for properties of an object, such as use of fields in a struct. This
face inherits, by default, from @code{font-lock-property-name-face}.
For example, For example,

View file

@ -828,11 +828,12 @@ filter/sentinel error has been handled.
+++ +++
** New faces for font-lock. ** New faces for font-lock.
These faces are primarily meant for use with tree-sitter. They are: These faces are primarily meant for use with tree-sitter. They are:
'font-lock-function-call-face', 'font-lock-variable-ref-face',
'font-lock-bracket-face', 'font-lock-delimiter-face', 'font-lock-bracket-face', 'font-lock-delimiter-face',
'font-lock-escape-face', 'font-lock-misc-punctuation-face', 'font-lock-escape-face', 'font-lock-misc-punctuation-face',
'font-lock-number-face', 'font-lock-operator-face', 'font-lock-number-face', 'font-lock-operator-face',
'font-lock-property-face', and 'font-lock-punctuation-face', 'font-lock-property-name-face', 'font-lock-property-ref-face',
'font-lock-regexp-face'. 'font-lock-punctuation-face', and 'font-lock-regexp-face'.
+++ +++
** New face 'variable-pitch-text'. ** New face 'variable-pitch-text'.

View file

@ -68,13 +68,16 @@ Do not call this mode function yourself. It is meant for internal use."
font-lock-comment-delimiter-face font-lock-comment-face font-lock-comment-delimiter-face font-lock-comment-face
font-lock-constant-face font-lock-delimiter-face font-lock-constant-face font-lock-delimiter-face
font-lock-doc-face font-lock-doc-markup-face font-lock-doc-face font-lock-doc-markup-face
font-lock-escape-face font-lock-function-name-face font-lock-escape-face font-lock-function-call-face
font-lock-function-name-face
font-lock-keyword-face font-lock-negation-char-face font-lock-keyword-face font-lock-negation-char-face
font-lock-number-face font-lock-misc-punctuation-face font-lock-number-face font-lock-misc-punctuation-face
font-lock-operator-face font-lock-preprocessor-face font-lock-operator-face font-lock-preprocessor-face
font-lock-property-face font-lock-punctuation-face font-lock-property-name-face font-lock-property-ref-face
font-lock-punctuation-face
font-lock-regexp-grouping-backslash font-lock-regexp-grouping-construct font-lock-regexp-grouping-backslash font-lock-regexp-grouping-construct
font-lock-string-face font-lock-type-face font-lock-variable-name-face font-lock-string-face font-lock-type-face font-lock-variable-name-face
font-lock-variable-ref-face
font-lock-warning-face button link link-visited fringe font-lock-warning-face button link link-visited fringe
header-line tooltip mode-line mode-line-buffer-id header-line tooltip mode-line mode-line-buffer-id
mode-line-emphasis mode-line-highlight mode-line-inactive mode-line-emphasis mode-line-highlight mode-line-inactive

View file

@ -2026,6 +2026,12 @@ as the constructs of Haddock, Javadoc and similar systems."
"Font Lock mode face used to highlight function names." "Font Lock mode face used to highlight function names."
:group 'font-lock-faces) :group 'font-lock-faces)
(defface font-lock-function-call-face
'((t :inherit font-lock-function-name-face))
"Font Lock mode face used to highlight function calls."
:group 'font-lock-faces
:version "29.1")
(defface font-lock-variable-name-face (defface font-lock-variable-name-face
'((((class grayscale) (background light)) '((((class grayscale) (background light))
:foreground "Gray90" :weight bold :slant italic) :foreground "Gray90" :weight bold :slant italic)
@ -2040,6 +2046,12 @@ as the constructs of Haddock, Javadoc and similar systems."
"Font Lock mode face used to highlight variable names." "Font Lock mode face used to highlight variable names."
:group 'font-lock-faces) :group 'font-lock-faces)
(defface font-lock-variable-ref-face
'((t :inherit font-lock-variable-name-face))
"Font Lock mode face used to highlight variable references."
:group 'font-lock-faces
:version "29.1")
(defface font-lock-type-face (defface font-lock-type-face
'((((class grayscale) (background light)) :foreground "Gray90" :weight bold) '((((class grayscale) (background light)) :foreground "Gray90" :weight bold)
(((class grayscale) (background dark)) :foreground "DimGray" :weight bold) (((class grayscale) (background dark)) :foreground "DimGray" :weight bold)
@ -2115,10 +2127,17 @@ as the constructs of Haddock, Javadoc and similar systems."
:group 'font-lock-faces :group 'font-lock-faces
:version "29.1") :version "29.1")
(defface font-lock-property-face (defface font-lock-property-name-face
'((t :inherit font-lock-variable-name-face)) '((t :inherit font-lock-variable-name-face))
"Font Lock mode face used to highlight properties of an object. "Font Lock mode face used to highlight properties of an object.
For example, the declaration and use of fields in a struct." For example, the declaration of fields in a struct."
:group 'font-lock-faces
:version "29.1")
(defface font-lock-property-ref-face
'((t :inherit font-lock-property-name-face))
"Font Lock mode face used to highlight property references.
For example, property lookup of fields in a struct."
:group 'font-lock-faces :group 'font-lock-faces
:version "29.1") :version "29.1")

View file

@ -506,7 +506,10 @@ MODE is either `c' or `cpp'."
declarator: (_) @c-ts-mode--fontify-declarator) declarator: (_) @c-ts-mode--fontify-declarator)
(parameter_declaration (parameter_declaration
declarator: (_) @c-ts-mode--fontify-declarator)) declarator: (_) @c-ts-mode--fontify-declarator)
(enumerator
name: (identifier) @font-lock-property-name-face))
:language mode :language mode
:feature 'assignment :feature 'assignment
@ -516,7 +519,7 @@ MODE is either `c' or `cpp'."
'((assignment_expression '((assignment_expression
left: (identifier) @font-lock-variable-name-face) left: (identifier) @font-lock-variable-name-face)
(assignment_expression (assignment_expression
left: (field_expression field: (_) @font-lock-property-face)) left: (field_expression field: (_) @font-lock-property-ref-face))
(assignment_expression (assignment_expression
left: (pointer_expression left: (pointer_expression
(identifier) @font-lock-variable-name-face)) (identifier) @font-lock-variable-name-face))
@ -529,8 +532,8 @@ MODE is either `c' or `cpp'."
:feature 'function :feature 'function
'((call_expression '((call_expression
function: function:
[(identifier) @font-lock-function-name-face [(identifier) @font-lock-function-call-face
(field_expression field: (field_identifier) @font-lock-function-name-face)])) (field_expression field: (field_identifier) @font-lock-function-call-face)]))
:language mode :language mode
:feature 'variable :feature 'variable
@ -552,9 +555,7 @@ MODE is either `c' or `cpp'."
:language mode :language mode
:feature 'property :feature 'property
'((field_identifier) @font-lock-property-face '((field_identifier) @font-lock-property-ref-face)
(enumerator
name: (identifier) @font-lock-property-face))
:language mode :language mode
:feature 'bracket :feature 'bracket
@ -614,6 +615,7 @@ For NODE, OVERRIDE, START, END, and ARGS, see
(face (pcase (treesit-node-type (treesit-node-parent (face (pcase (treesit-node-type (treesit-node-parent
(or qualified-root (or qualified-root
identifier))) identifier)))
("field_declaration" 'font-lock-property-name-face)
("function_declarator" 'font-lock-function-name-face) ("function_declarator" 'font-lock-function-name-face)
(_ 'font-lock-variable-name-face)))) (_ 'font-lock-variable-name-face))))
(when identifier (when identifier
@ -630,7 +632,7 @@ OVERRIDE, START, END, and ARGS, see `treesit-font-lock-rules'."
"call_expression")) "call_expression"))
(treesit-fontify-with-override (treesit-fontify-with-override
(treesit-node-start node) (treesit-node-end node) (treesit-node-start node) (treesit-node-end node)
'font-lock-variable-name-face override start end))) 'font-lock-variable-ref-face override start end)))
(defun c-ts-mode--fontify-defun (node override start end &rest _) (defun c-ts-mode--fontify-defun (node override start end &rest _)
"Correctly fontify the DEFUN macro. "Correctly fontify the DEFUN macro.

View file

@ -125,7 +125,7 @@
:language 'cmake :language 'cmake
:feature 'function :feature 'function
'((normal_command (identifier) @font-lock-function-name-face)) '((normal_command (identifier) @font-lock-function-call-face))
:language 'cmake :language 'cmake
:feature 'keyword :feature 'keyword
@ -154,7 +154,7 @@
:language 'cmake :language 'cmake
:feature 'variable :feature 'variable
:override t :override t
'((variable) @font-lock-variable-name-face) '((variable) @font-lock-variable-ref-face)
:language 'cmake :language 'cmake
:feature 'error :feature 'error

View file

@ -708,9 +708,9 @@ compilation and evaluation time conflicts."
(treesit-font-lock-rules (treesit-font-lock-rules
:language 'c-sharp :language 'c-sharp
:feature 'expression :feature 'expression
'((conditional_expression (identifier) @font-lock-variable-name-face) '((conditional_expression (identifier) @font-lock-variable-ref-face)
(postfix_unary_expression (identifier)* @font-lock-variable-name-face) (postfix_unary_expression (identifier)* @font-lock-variable-ref-face)
(initializer_expression (assignment_expression left: (identifier) @font-lock-variable-name-face))) (initializer_expression (assignment_expression left: (identifier) @font-lock-variable-ref-face)))
:language 'c-sharp :language 'c-sharp
:feature 'bracket :feature 'bracket
@ -739,8 +739,8 @@ compilation and evaluation time conflicts."
:language 'c-sharp :language 'c-sharp
:override t :override t
:feature 'property :feature 'property
`((attribute (identifier) @font-lock-property-face (attribute_argument_list)) `((attribute (identifier) @font-lock-property-ref-face (attribute_argument_list))
(attribute (identifier) @font-lock-property-face)) (attribute (identifier) @font-lock-property-ref-face))
:language 'c-sharp :language 'c-sharp
:override t :override t
@ -859,14 +859,14 @@ compilation and evaluation time conflicts."
:feature 'function :feature 'function
'((invocation_expression '((invocation_expression
function: (member_access_expression function: (member_access_expression
name: (identifier) @font-lock-function-name-face)) name: (identifier) @font-lock-function-call-face))
(invocation_expression (invocation_expression
function: (identifier) @font-lock-function-name-face) function: (identifier) @font-lock-function-call-face)
(invocation_expression (invocation_expression
function: (member_access_expression function: (member_access_expression
name: (generic_name (identifier) @font-lock-function-name-face))) name: (generic_name (identifier) @font-lock-function-call-face)))
(invocation_expression (invocation_expression
function: (generic_name (identifier) @font-lock-function-name-face))) function: (generic_name (identifier) @font-lock-function-call-face)))
:language 'c-sharp :language 'c-sharp
:feature 'escape-sequence :feature 'escape-sequence
@ -878,23 +878,23 @@ compilation and evaluation time conflicts."
:override t :override t
'((if_directive '((if_directive
"if" @font-lock-preprocessor-face "if" @font-lock-preprocessor-face
(identifier) @font-lock-variable-name-face) (identifier) @font-lock-variable-ref-face)
(elif_directive (elif_directive
"elif" @font-lock-preprocessor-face "elif" @font-lock-preprocessor-face
(identifier) @font-lock-variable-name-face) (identifier) @font-lock-variable-ref-face)
(else_directive) @font-lock-preprocessor-face (else_directive) @font-lock-preprocessor-face
(endif_directive) @font-lock-preprocessor-face (endif_directive) @font-lock-preprocessor-face
(define_directive (define_directive
"define" @font-lock-preprocessor-face "define" @font-lock-preprocessor-face
(identifier) @font-lock-variable-name-face) (identifier) @font-lock-variable-ref-face)
(nullable_directive) @font-lock-preprocessor-face (nullable_directive) @font-lock-preprocessor-face
(pragma_directive) @font-lock-preprocessor-face (pragma_directive) @font-lock-preprocessor-face
(region_directive) @font-lock-preprocessor-face (region_directive) @font-lock-preprocessor-face
(endregion_directive) @font-lock-preprocessor-face (endregion_directive) @font-lock-preprocessor-face
(region_directive (region_directive
(preproc_message) @font-lock-variable-name-face) (preproc_message) @font-lock-variable-ref-face)
(endregion_directive (endregion_directive
(preproc_message) @font-lock-variable-name-face)))) (preproc_message) @font-lock-variable-ref-face))))
;;;###autoload ;;;###autoload
(add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode)) (add-to-list 'auto-mode-alist '("\\.cs\\'" . csharp-mode))

View file

@ -133,7 +133,7 @@
(method_spec (method_spec
name: (field_identifier) @font-lock-function-name-face) name: (field_identifier) @font-lock-function-name-face)
(field_declaration (field_declaration
name: (field_identifier) @font-lock-property-face) name: (field_identifier) @font-lock-property-name-face)
(parameter_declaration (parameter_declaration
name: (identifier) @font-lock-variable-name-face) name: (identifier) @font-lock-variable-name-face)
(short_var_declaration (short_var_declaration
@ -146,10 +146,10 @@
:language 'go :language 'go
:feature 'function :feature 'function
'((call_expression '((call_expression
function: (identifier) @font-lock-function-name-face) function: (identifier) @font-lock-function-call-face)
(call_expression (call_expression
function: (selector_expression function: (selector_expression
field: (field_identifier) @font-lock-function-name-face))) field: (field_identifier) @font-lock-function-call-face)))
:language 'go :language 'go
:feature 'keyword :feature 'keyword
@ -177,12 +177,12 @@
:language 'go :language 'go
:feature 'property :feature 'property
'((field_identifier) @font-lock-property-face '((selector_expression field: (field_identifier) @font-lock-property-ref-face)
(keyed_element (_ (identifier) @font-lock-property-face))) (keyed_element (_ (identifier) @font-lock-property-ref-face)))
:language 'go :language 'go
:feature 'variable :feature 'variable
'((identifier) @font-lock-variable-name-face) '((identifier) @font-lock-variable-ref-face)
:language 'go :language 'go
:feature 'escape-sequence :feature 'escape-sequence

View file

@ -220,7 +220,7 @@
(method_reference (identifier) @font-lock-type-face) (method_reference (identifier) @font-lock-type-face)
(scoped_identifier (identifier) @font-lock-variable-name-face) (scoped_identifier (identifier) @font-lock-constant-face)
((scoped_identifier name: (identifier) @font-lock-type-face) ((scoped_identifier name: (identifier) @font-lock-type-face)
(:match "^[A-Z]" @font-lock-type-face)) (:match "^[A-Z]" @font-lock-type-face))
@ -244,7 +244,7 @@
name: (identifier) @font-lock-variable-name-face) name: (identifier) @font-lock-variable-name-face)
(element_value_pair (element_value_pair
key: (identifier) @font-lock-property-face) key: (identifier) @font-lock-property-ref-face)
(formal_parameter (formal_parameter
name: (identifier) @font-lock-variable-name-face) name: (identifier) @font-lock-variable-name-face)
@ -255,14 +255,14 @@
:override t :override t
:feature 'expression :feature 'expression
'((method_invocation '((method_invocation
object: (identifier) @font-lock-variable-name-face) object: (identifier) @font-lock-variable-ref-face)
(method_invocation (method_invocation
name: (identifier) @font-lock-function-name-face) name: (identifier) @font-lock-function-call-face)
(argument_list (identifier) @font-lock-variable-name-face) (argument_list (identifier) @font-lock-variable-name-face)
(expression_statement (identifier) @font-lock-variable-name-face)) (expression_statement (identifier) @font-lock-variable-ref-face))
:language 'java :language 'java
:feature 'bracket :feature 'bracket

View file

@ -3544,11 +3544,10 @@ This function is intended for use in `after-change-functions'."
value: [(function) (arrow_function)]) value: [(function) (arrow_function)])
(variable_declarator (variable_declarator
name: (array_pattern name: [(array_pattern (identifier) @font-lock-variable-name-face)
(identifier) (object_pattern
(identifier) (shorthand_property_identifier_pattern) @font-lock-variable-name-face)])
@font-lock-function-name-face)
value: (array (number) (function)))
;; full module imports ;; full module imports
(import_clause (identifier) @font-lock-variable-name-face) (import_clause (identifier) @font-lock-variable-name-face)
;; named imports with aliasing ;; named imports with aliasing
@ -3564,15 +3563,13 @@ This function is intended for use in `after-change-functions'."
:language 'javascript :language 'javascript
:feature 'property :feature 'property
'(((property_identifier) @font-lock-property-face '(((property_identifier) @font-lock-property-ref-face
(:pred js--treesit-property-not-function-p (:pred js--treesit-property-not-function-p
@font-lock-property-face)) @font-lock-property-ref-face))
(pair value: (identifier) @font-lock-variable-name-face) (pair value: (identifier) @font-lock-variable-ref-face)
((shorthand_property_identifier) @font-lock-property-face) ((shorthand_property_identifier) @font-lock-property-ref-face))
((shorthand_property_identifier_pattern) @font-lock-property-face))
:language 'javascript :language 'javascript
:feature 'assignment :feature 'assignment
@ -3582,14 +3579,14 @@ This function is intended for use in `after-change-functions'."
:language 'javascript :language 'javascript
:feature 'function :feature 'function
'((call_expression '((call_expression
function: [(identifier) @font-lock-function-name-face function: [(identifier) @font-lock-function-call-face
(member_expression (member_expression
property: property:
(property_identifier) @font-lock-function-name-face)]) (property_identifier) @font-lock-function-call-face)])
(method_definition (method_definition
name: (property_identifier) @font-lock-function-name-face) name: (property_identifier) @font-lock-function-name-face)
(function_declaration (function_declaration
name: (identifier) @font-lock-function-name-face) name: (identifier) @font-lock-function-call-face)
(function (function
name: (identifier) @font-lock-function-name-face)) name: (identifier) @font-lock-function-name-face))
@ -3597,15 +3594,15 @@ This function is intended for use in `after-change-functions'."
:feature 'jsx :feature 'jsx
'((jsx_opening_element '((jsx_opening_element
[(nested_identifier (identifier)) (identifier)] [(nested_identifier (identifier)) (identifier)]
@font-lock-function-name-face) @font-lock-function-call-face)
(jsx_closing_element (jsx_closing_element
[(nested_identifier (identifier)) (identifier)] [(nested_identifier (identifier)) (identifier)]
@font-lock-function-name-face) @font-lock-function-call-face)
(jsx_self_closing_element (jsx_self_closing_element
[(nested_identifier (identifier)) (identifier)] [(nested_identifier (identifier)) (identifier)]
@font-lock-function-name-face) @font-lock-function-call-face)
(jsx_attribute (jsx_attribute
(property_identifier) (property_identifier)
@ -3684,8 +3681,8 @@ For OVERRIDE, START, END, see `treesit-font-lock-rules'."
(treesit-fontify-with-override (treesit-fontify-with-override
(treesit-node-start node) (treesit-node-end node) (treesit-node-start node) (treesit-node-end node)
(pcase (treesit-node-type node) (pcase (treesit-node-type node)
("identifier" 'font-lock-variable-name-face) ("identifier" 'font-lock-variable-ref-face)
("property_identifier" 'font-lock-property-face)) ("property_identifier" 'font-lock-property-ref-face))
override start end))) override start end)))
(defun js--treesit-defun-name (node) (defun js--treesit-defun-name (node)

View file

@ -101,7 +101,7 @@
:language 'json :language 'json
:feature 'pair :feature 'pair
:override t ; Needed for overriding string face on keys. :override t ; Needed for overriding string face on keys.
'((pair key: (_) @font-lock-variable-name-face)) '((pair key: (_) @font-lock-property-ref-face))
:language 'json :language 'json
:feature 'error :feature 'error
:override t :override t

View file

@ -1106,25 +1106,26 @@ fontified."
:language 'python :language 'python
'((interpolation) @python--treesit-fontify-string-interpolation) '((interpolation) @python--treesit-fontify-string-interpolation)
:feature 'definition
:language 'python
'((function_definition
name: (identifier) @font-lock-function-name-face)
(class_definition
name: (identifier) @font-lock-type-face))
:feature 'function
:language 'python
'((call function: (identifier) @font-lock-function-name-face)
(call function: (attribute
attribute: (identifier) @font-lock-function-name-face)))
:feature 'keyword :feature 'keyword
:language 'python :language 'python
`([,@python--treesit-keywords] @font-lock-keyword-face `([,@python--treesit-keywords] @font-lock-keyword-face
((identifier) @font-lock-keyword-face ((identifier) @font-lock-keyword-face
(:match "^self$" @font-lock-keyword-face))) (:match "^self$" @font-lock-keyword-face)))
:feature 'definition
:language 'python
'((function_definition
name: (identifier) @font-lock-function-name-face)
(class_definition
name: (identifier) @font-lock-type-face)
(parameters (identifier) @font-lock-variable-name-face))
:feature 'function
:language 'python
'((call function: (identifier) @font-lock-function-call-face)
(call function: (attribute
attribute: (identifier) @font-lock-function-call-face)))
:feature 'builtin :feature 'builtin
:language 'python :language 'python
`(((identifier) @font-lock-builtin-face `(((identifier) @font-lock-builtin-face
@ -1146,7 +1147,7 @@ fontified."
@font-lock-variable-name-face) @font-lock-variable-name-face)
(assignment left: (attribute (assignment left: (attribute
attribute: (identifier) attribute: (identifier)
@font-lock-property-face)) @font-lock-property-ref-face))
(pattern_list (identifier) (pattern_list (identifier)
@font-lock-variable-name-face) @font-lock-variable-name-face)
(tuple_pattern (identifier) (tuple_pattern (identifier)
@ -1183,12 +1184,12 @@ fontified."
:feature 'property :feature 'property
:language 'python :language 'python
'((attribute '((attribute
attribute: (identifier) @font-lock-property-face) attribute: (identifier) @font-lock-property-ref-face)
(class_definition (class_definition
body: (block body: (block
(expression_statement (expression_statement
(assignment left: (assignment left:
(identifier) @font-lock-property-face))))) (identifier) @font-lock-property-ref-face)))))
:feature 'operator :feature 'operator
:language 'python :language 'python
@ -1211,10 +1212,10 @@ fontified."
"Check whether NODE is a variable. "Check whether NODE is a variable.
NODE's type should be \"identifier\"." NODE's type should be \"identifier\"."
;; An identifier can be a function/class name, a property, or a ;; An identifier can be a function/class name, a property, or a
;; variables. This function filters out function/class names and ;; variables. This function filters out function/class names,
;; properties. ;; properties and method parameters.
(pcase (treesit-node-type (treesit-node-parent node)) (pcase (treesit-node-type (treesit-node-parent node))
((or "function_definition" "class_definition") nil) ((or "function_definition" "class_definition" "parameters") nil)
("attribute" ("attribute"
(pcase (treesit-node-field-name node) (pcase (treesit-node-field-name node)
("object" t) ("object" t)

View file

@ -292,11 +292,11 @@ values of OVERRIDE"
:language language :language language
:feature 'global :feature 'global
'((global_variable) @font-lock-variable-name-face) '((global_variable) @font-lock-variable-ref-face)
:language language :language language
:feature 'instance :feature 'instance
'((instance_variable) @font-lock-variable-name-face) '((instance_variable) @font-lock-variable-ref-face)
:language language :language language
:feature 'method-definition :feature 'method-definition
@ -350,7 +350,7 @@ values of OVERRIDE"
:language language :language language
:feature 'function :feature 'function
'((call '((call
method: (identifier) @font-lock-function-name-face)) method: (identifier) @font-lock-function-call-face))
:language language :language language
:feature 'assignment :feature 'assignment

View file

@ -157,7 +157,7 @@
'((function_item name: (identifier) @font-lock-function-name-face) '((function_item name: (identifier) @font-lock-function-name-face)
(macro_definition "macro_rules!" @font-lock-constant-face) (macro_definition "macro_rules!" @font-lock-constant-face)
(macro_definition (identifier) @font-lock-preprocessor-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) (parameter pattern: (_) @rust-ts-mode--fontify-pattern)
(closure_parameters (_) @rust-ts-mode--fontify-pattern) (closure_parameters (_) @rust-ts-mode--fontify-pattern)
(let_declaration pattern: (_) @rust-ts-mode--fontify-pattern) (let_declaration pattern: (_) @rust-ts-mode--fontify-pattern)
@ -174,17 +174,17 @@
:feature 'function :feature 'function
'((call_expression '((call_expression
function: function:
[(identifier) @font-lock-function-name-face [(identifier) @font-lock-function-call-face
(field_expression (field_expression
field: (field_identifier) @font-lock-function-name-face) field: (field_identifier) @font-lock-function-call-face)
(scoped_identifier (scoped_identifier
name: (identifier) @font-lock-function-name-face)]) name: (identifier) @font-lock-function-call-face)])
(generic_function (generic_function
function: [(identifier) @font-lock-function-name-face function: [(identifier) @font-lock-function-call-face
(field_expression (field_expression
field: (field_identifier) @font-lock-function-name-face) field: (field_identifier) @font-lock-function-call-face)
(scoped_identifier (scoped_identifier
name: (identifier) @font-lock-function-name-face)]) name: (identifier) @font-lock-function-call-face)])
(macro_invocation macro: (identifier) @font-lock-preprocessor-face)) (macro_invocation macro: (identifier) @font-lock-preprocessor-face))
:language 'rust :language 'rust
@ -239,8 +239,8 @@
:language 'rust :language 'rust
:feature 'property :feature 'property
'((field_identifier) @font-lock-property-face '((field_identifier) @font-lock-property-ref-face
(shorthand_field_initializer (identifier) @font-lock-property-face)) (shorthand_field_initializer (identifier) @font-lock-property-ref-face))
;; Must be under type, otherwise some imports can be highlighted as constants. ;; Must be under type, otherwise some imports can be highlighted as constants.
:language 'rust :language 'rust
@ -251,25 +251,25 @@
:language 'rust :language 'rust
:feature 'variable :feature 'variable
'((arguments (identifier) @font-lock-variable-name-face) '((arguments (identifier) @font-lock-variable-ref-face)
(array_expression (identifier) @font-lock-variable-name-face) (array_expression (identifier) @font-lock-variable-ref-face)
(assignment_expression right: (identifier) @font-lock-variable-name-face) (assignment_expression right: (identifier) @font-lock-variable-ref-face)
(binary_expression left: (identifier) @font-lock-variable-name-face) (binary_expression left: (identifier) @font-lock-variable-ref-face)
(binary_expression right: (identifier) @font-lock-variable-name-face) (binary_expression right: (identifier) @font-lock-variable-ref-face)
(block (identifier) @font-lock-variable-name-face) (block (identifier) @font-lock-variable-ref-face)
(compound_assignment_expr right: (identifier) @font-lock-variable-name-face) (compound_assignment_expr right: (identifier) @font-lock-variable-ref-face)
(field_expression value: (identifier) @font-lock-variable-name-face) (field_expression value: (identifier) @font-lock-variable-ref-face)
(field_initializer value: (identifier) @font-lock-variable-name-face) (field_initializer value: (identifier) @font-lock-variable-ref-face)
(if_expression condition: (identifier) @font-lock-variable-name-face) (if_expression condition: (identifier) @font-lock-variable-ref-face)
(let_condition value: (identifier) @font-lock-variable-name-face) (let_condition value: (identifier) @font-lock-variable-ref-face)
(let_declaration value: (identifier) @font-lock-variable-name-face) (let_declaration value: (identifier) @font-lock-variable-ref-face)
(match_arm value: (identifier) @font-lock-variable-name-face) (match_arm value: (identifier) @font-lock-variable-ref-face)
(match_expression value: (identifier) @font-lock-variable-name-face) (match_expression value: (identifier) @font-lock-variable-ref-face)
(reference_expression value: (identifier) @font-lock-variable-name-face) (reference_expression value: (identifier) @font-lock-variable-ref-face)
(return_expression (identifier) @font-lock-variable-name-face) (return_expression (identifier) @font-lock-variable-ref-face)
(tuple_expression (identifier) @font-lock-variable-name-face) (tuple_expression (identifier) @font-lock-variable-ref-face)
(unary_expression (identifier) @font-lock-variable-name-face) (unary_expression (identifier) @font-lock-variable-ref-face)
(while_expression condition: (identifier) @font-lock-variable-name-face)) (while_expression condition: (identifier) @font-lock-variable-ref-face))
:language 'rust :language 'rust
:feature 'escape-sequence :feature 'escape-sequence

View file

@ -245,16 +245,13 @@ Argument LANGUAGE is either `typescript' or `tsx'."
:language language :language language
:feature 'property :feature 'property
`((property_signature `((property_signature
name: (property_identifier) @font-lock-property-face) name: (property_identifier) @font-lock-property-name-face)
(public_field_definition (public_field_definition
name: (property_identifier) @font-lock-property-face) name: (property_identifier) @font-lock-property-name-face)
(pair key: (property_identifier) @font-lock-variable-name-face) (pair key: (property_identifier) @font-lock-property-ref-face)
((shorthand_property_identifier) @font-lock-property-face) ((shorthand_property_identifier) @font-lock-property-ref-face))
((shorthand_property_identifier_pattern)
@font-lock-property-face))
:language language :language language
:feature 'expression :feature 'expression
@ -268,30 +265,32 @@ Argument LANGUAGE is either `typescript' or `tsx'."
:feature 'function :feature 'function
'((call_expression '((call_expression
function: function:
[(identifier) @font-lock-function-name-face [(identifier) @font-lock-function-call-face
(member_expression (member_expression
property: (property_identifier) @font-lock-function-name-face)])) property: (property_identifier) @font-lock-function-call-face)]))
:language language :language language
:feature 'pattern :feature 'pattern
`((pair_pattern `((pair_pattern
key: (property_identifier) @font-lock-property-face) key: (property_identifier) @font-lock-property-ref-face)
(array_pattern (identifier) @font-lock-variable-name-face)) (array_pattern (identifier) @font-lock-variable-name-face)
((shorthand_property_identifier_pattern) @font-lock-variable-name-face))
:language language :language language
:feature 'jsx :feature 'jsx
`((jsx_opening_element `((jsx_opening_element
[(nested_identifier (identifier)) (identifier)] [(nested_identifier (identifier)) (identifier)]
@font-lock-function-name-face) @font-lock-function-call-face)
(jsx_closing_element (jsx_closing_element
[(nested_identifier (identifier)) (identifier)] [(nested_identifier (identifier)) (identifier)]
@font-lock-function-name-face) @font-lock-function-call-face)
(jsx_self_closing_element (jsx_self_closing_element
[(nested_identifier (identifier)) (identifier)] [(nested_identifier (identifier)) (identifier)]
@font-lock-function-name-face) @font-lock-function-call-face)
(jsx_attribute (property_identifier) @font-lock-constant-face)) (jsx_attribute (property_identifier) @font-lock-constant-face))

View file

@ -1399,9 +1399,8 @@ for determining whether point is within a selector."
:feature 'query :feature 'query
:language 'css :language 'css
'((keyword_query) @font-lock-property-face '((keyword_query) @font-lock-property-ref-face
(feature_name) @font-lock-property-face) (feature_name) @font-lock-property-ref-face)
:feature 'bracket :feature 'bracket
:language 'css :language 'css

View file

@ -92,8 +92,8 @@
:language 'toml :language 'toml
:feature 'pair :feature 'pair
:override t ; Needed for overriding string face on keys. :override t ; Needed for overriding string face on keys.
'((bare_key) @font-lock-property-face '((bare_key) @font-lock-property-ref-face
(quoted_key) @font-lock-property-face (quoted_key) @font-lock-property-ref-face
(table ("[" @font-lock-bracket-face (table ("[" @font-lock-bracket-face
(_) @font-lock-type-face (_) @font-lock-type-face
"]" @font-lock-bracket-face)) "]" @font-lock-bracket-face))

View file

@ -94,22 +94,22 @@
:feature 'property :feature 'property
:override t :override t
'((block_mapping_pair '((block_mapping_pair
key: (flow_node (plain_scalar (string_scalar) @font-lock-property-face))) key: (flow_node (plain_scalar (string_scalar) @font-lock-property-ref-face)))
(block_mapping_pair (block_mapping_pair
key: (flow_node key: (flow_node
[(double_quote_scalar) (single_quote_scalar)] @font-lock-property-face)) [(double_quote_scalar) (single_quote_scalar)] @font-lock-property-ref-face))
(flow_mapping (flow_mapping
(_ key: (flow_node (plain_scalar (string_scalar) @font-lock-property-face)))) (_ key: (flow_node (plain_scalar (string_scalar) @font-lock-property-ref-face))))
(flow_mapping (flow_mapping
(_ key: (_ key:
(flow_node (flow_node
[(double_quote_scalar) (single_quote_scalar)] @font-lock-property-face))) [(double_quote_scalar) (single_quote_scalar)] @font-lock-property-ref-face)))
(flow_sequence (flow_sequence
(_ key: (flow_node (plain_scalar (string_scalar) @font-lock-property-face)))) (_ key: (flow_node (plain_scalar (string_scalar) @font-lock-property-ref-face))))
(flow_sequence (flow_sequence
(_ key: (_ key:
(flow_node (flow_node
[(double_quote_scalar) (single_quote_scalar)] @font-lock-property-face)))) [(double_quote_scalar) (single_quote_scalar)] @font-lock-property-ref-face))))
:language 'yaml :language 'yaml
:feature 'error :feature 'error