Variable: rust-ts-mode--font-lock-settings
rust-ts-mode--font-lock-settings is a variable defined in
rust-ts-mode.el.gz.
Value
((#<treesit-compiled-query> t attribute nil)
(#<treesit-compiled-query> t bracket nil)
(#<treesit-compiled-query> t builtin nil)
(#<treesit-compiled-query> t comment nil)
(#<treesit-compiled-query> t delimiter nil)
(#<treesit-compiled-query> t definition nil)
(#<treesit-compiled-query> t assignment nil)
(#<treesit-compiled-query> t function nil)
(#<treesit-compiled-query> t keyword nil)
(#<treesit-compiled-query> t number nil)
(#<treesit-compiled-query> t operator nil)
(#<treesit-compiled-query> t string nil)
(#<treesit-compiled-query> t type nil)
(#<treesit-compiled-query> t property nil)
(#<treesit-compiled-query> t constant nil)
(#<treesit-compiled-query> t variable nil)
(#<treesit-compiled-query> t escape-sequence t)
(#<treesit-compiled-query> t error t))
Documentation
Tree-sitter font-lock settings for rust-ts-mode.
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/rust-ts-mode.el.gz
(defvar rust-ts-mode--font-lock-settings
(treesit-font-lock-rules
:language 'rust
:feature 'attribute
'((attribute_item) @font-lock-preprocessor-face
(inner_attribute_item) @font-lock-preprocessor-face)
:language 'rust
:feature 'bracket
'((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
:language 'rust
:feature 'builtin
`((macro_invocation
macro: ((identifier) @font-lock-builtin-face
(:match ,(rx-to-string
`(seq bol
(or ,@rust-ts-mode--builtin-macros)
eol))
@font-lock-builtin-face)))
((identifier) @font-lock-type-face
(:match "\\`\\(?:Err\\|Ok\\|None\\|Some\\)\\'" @font-lock-type-face)))
:language 'rust
:feature 'comment
'(([(block_comment) (line_comment)]) @rust-ts-mode--comment-docstring)
:language 'rust
:feature 'delimiter
'((["," "." ";" ":" "::"]) @font-lock-delimiter-face)
:language 'rust
:feature 'definition
'((function_item name: (identifier) @font-lock-function-name-face)
(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)
(let_declaration pattern: (_) @rust-ts-mode--fontify-pattern)
(for_expression pattern: (_) @rust-ts-mode--fontify-pattern)
(let_condition pattern: (_) @rust-ts-mode--fontify-pattern)
(match_arm pattern: (_) @rust-ts-mode--fontify-pattern))
:language 'rust
:feature 'assignment
'((assignment_expression left: (_) @rust-ts-mode--fontify-pattern)
(compound_assignment_expr left: (_) @rust-ts-mode--fontify-pattern))
:language 'rust
:feature 'function
'((call_expression
function:
[(identifier) @font-lock-function-call-face
(field_expression
field: (field_identifier) @font-lock-function-call-face)
(scoped_identifier
name: (identifier) @font-lock-function-call-face)])
(generic_function
function: [(identifier) @font-lock-function-call-face
(field_expression
field: (field_identifier) @font-lock-function-call-face)
(scoped_identifier
name: (identifier) @font-lock-function-call-face)])
(macro_invocation macro: (identifier) @font-lock-preprocessor-face))
:language 'rust
:feature 'keyword
`([,@rust-ts-mode--keywords] @font-lock-keyword-face
;; If these keyword are in a macro body, they're marked as
;; identifiers.
((identifier) @font-lock-keyword-face
(:match ,(rx bos (or "else" "in" "move") eos) @font-lock-keyword-face)))
:language 'rust
:feature 'number
'([(float_literal) (integer_literal)] @font-lock-number-face)
:language 'rust
:feature 'operator
`([,@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
'([(char_literal)
(raw_string_literal)
(string_literal)] @font-lock-string-face)
:language 'rust
:feature 'type
`((scoped_use_list path: (identifier) @font-lock-constant-face)
(scoped_use_list path: (scoped_identifier
name: (identifier) @font-lock-constant-face))
((use_as_clause alias: (identifier) @font-lock-type-face)
(:match "\\`[A-Z]" @font-lock-type-face))
((use_as_clause path: (identifier) @font-lock-type-face)
(:match "\\`[A-Z]" @font-lock-type-face))
((use_list (identifier) @font-lock-type-face)
(:match "\\`[A-Z]" @font-lock-type-face))
(use_wildcard [(identifier) @rust-ts-mode--fontify-scope
(scoped_identifier
name: (identifier) @rust-ts-mode--fontify-scope)])
(enum_variant name: (identifier) @font-lock-type-face)
(match_arm
pattern: (match_pattern (_ type: (identifier) @font-lock-type-face)))
(match_arm
pattern: (match_pattern
(_ type: (scoped_identifier
path: (identifier) @font-lock-type-face))))
(mod_item name: (identifier) @font-lock-constant-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
(or "u8" "u16" "u32" "u64" "u128" "usize"
"i8" "i16" "i32" "i64" "i128" "isize"
"char" "str")
eos)
@font-lock-type-face))
((scoped_identifier path: (identifier) @rust-ts-mode--fontify-scope))
((scoped_type_identifier path: (identifier) @rust-ts-mode--fontify-scope)))
:language 'rust
:feature 'property
'((field_identifier) @font-lock-property-use-face
(shorthand_field_initializer (identifier) @font-lock-property-use-face))
;; Must be under type, otherwise some imports can be highlighted as constants.
:language 'rust
:feature 'constant
`((boolean_literal) @font-lock-constant-face
((identifier) @font-lock-constant-face
(:match "\\`[A-Z][0-9A-Z_]*\\'" @font-lock-constant-face)))
:language 'rust
:feature 'variable
'((arguments (identifier) @font-lock-variable-use-face)
(array_expression (identifier) @font-lock-variable-use-face)
(assignment_expression right: (identifier) @font-lock-variable-use-face)
(binary_expression left: (identifier) @font-lock-variable-use-face)
(binary_expression right: (identifier) @font-lock-variable-use-face)
(block (identifier) @font-lock-variable-use-face)
(compound_assignment_expr right: (identifier) @font-lock-variable-use-face)
(field_expression value: (identifier) @font-lock-variable-use-face)
(field_initializer value: (identifier) @font-lock-variable-use-face)
(if_expression condition: (identifier) @font-lock-variable-use-face)
(let_condition value: (identifier) @font-lock-variable-use-face)
(let_declaration value: (identifier) @font-lock-variable-use-face)
(match_arm value: (identifier) @font-lock-variable-use-face)
(match_expression value: (identifier) @font-lock-variable-use-face)
(reference_expression value: (identifier) @font-lock-variable-use-face)
(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)
(metavariable) @font-lock-variable-use-face)
:language 'rust
:feature 'escape-sequence
:override t
'((escape_sequence) @font-lock-escape-face)
:language 'rust
:feature 'error
:override t
'((ERROR) @font-lock-warning-face))
"Tree-sitter font-lock settings for `rust-ts-mode'.")