Fix fontification of function-valued variables (bug#61053)
* lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode--font-lock-settings): Remove overrides and reorder the variable_declarator rule.
This commit is contained in:
parent
cfe26f3189
commit
8a1498c01f
1 changed files with 5 additions and 15 deletions
|
@ -132,26 +132,21 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
||||||
Argument LANGUAGE is either `typescript' or `tsx'."
|
Argument LANGUAGE is either `typescript' or `tsx'."
|
||||||
(treesit-font-lock-rules
|
(treesit-font-lock-rules
|
||||||
:language language
|
:language language
|
||||||
:override t
|
|
||||||
:feature 'comment
|
:feature 'comment
|
||||||
`((comment) @font-lock-comment-face)
|
`((comment) @font-lock-comment-face)
|
||||||
|
|
||||||
:language language
|
:language language
|
||||||
:override t
|
|
||||||
:feature 'constant
|
:feature 'constant
|
||||||
`(((identifier) @font-lock-constant-face
|
`(((identifier) @font-lock-constant-face
|
||||||
(:match "^[A-Z_][A-Z_\\d]*$" @font-lock-constant-face))
|
(:match "^[A-Z_][A-Z_\\d]*$" @font-lock-constant-face))
|
||||||
|
|
||||||
[(true) (false) (null)] @font-lock-constant-face)
|
[(true) (false) (null)] @font-lock-constant-face)
|
||||||
|
|
||||||
:language language
|
:language language
|
||||||
:override t
|
|
||||||
:feature 'keyword
|
:feature 'keyword
|
||||||
`([,@typescript-ts-mode--keywords] @font-lock-keyword-face
|
`([,@typescript-ts-mode--keywords] @font-lock-keyword-face
|
||||||
[(this) (super)] @font-lock-keyword-face)
|
[(this) (super)] @font-lock-keyword-face)
|
||||||
|
|
||||||
:language language
|
:language language
|
||||||
:override t
|
|
||||||
:feature 'string
|
:feature 'string
|
||||||
`((regex pattern: (regex_pattern)) @font-lock-regexp-face
|
`((regex pattern: (regex_pattern)) @font-lock-regexp-face
|
||||||
(string) @font-lock-string-face
|
(string) @font-lock-string-face
|
||||||
|
@ -159,7 +154,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
||||||
(template_substitution ["${" "}"] @font-lock-misc-punctuation-face))
|
(template_substitution ["${" "}"] @font-lock-misc-punctuation-face))
|
||||||
|
|
||||||
:language language
|
:language language
|
||||||
:override t
|
:override t ;; for functions assigned to variables
|
||||||
:feature 'declaration
|
:feature 'declaration
|
||||||
`((function
|
`((function
|
||||||
name: (identifier) @font-lock-function-name-face)
|
name: (identifier) @font-lock-function-name-face)
|
||||||
|
@ -174,6 +169,10 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
||||||
(required_parameter (identifier) @font-lock-variable-name-face)
|
(required_parameter (identifier) @font-lock-variable-name-face)
|
||||||
(optional_parameter (identifier) @font-lock-variable-name-face)
|
(optional_parameter (identifier) @font-lock-variable-name-face)
|
||||||
|
|
||||||
|
(variable_declarator
|
||||||
|
name: (identifier) @font-lock-function-name-face
|
||||||
|
value: [(function) (arrow_function)])
|
||||||
|
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
name: (identifier) @font-lock-variable-name-face)
|
name: (identifier) @font-lock-variable-name-face)
|
||||||
|
|
||||||
|
@ -188,10 +187,6 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
||||||
(arrow_function
|
(arrow_function
|
||||||
parameter: (identifier) @font-lock-variable-name-face)
|
parameter: (identifier) @font-lock-variable-name-face)
|
||||||
|
|
||||||
(variable_declarator
|
|
||||||
name: (identifier) @font-lock-function-name-face
|
|
||||||
value: [(function) (arrow_function)])
|
|
||||||
|
|
||||||
(variable_declarator
|
(variable_declarator
|
||||||
name: (array_pattern
|
name: (array_pattern
|
||||||
(identifier)
|
(identifier)
|
||||||
|
@ -205,7 +200,6 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
||||||
(import_clause (named_imports (import_specifier (identifier)) @font-lock-variable-name-face)))
|
(import_clause (named_imports (import_specifier (identifier)) @font-lock-variable-name-face)))
|
||||||
|
|
||||||
:language language
|
:language language
|
||||||
:override t
|
|
||||||
:feature 'identifier
|
:feature 'identifier
|
||||||
`((nested_type_identifier
|
`((nested_type_identifier
|
||||||
module: (identifier) @font-lock-type-face)
|
module: (identifier) @font-lock-type-face)
|
||||||
|
@ -234,7 +228,6 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
||||||
(_ (_ (_ (identifier) @font-lock-variable-name-face)))]))
|
(_ (_ (_ (identifier) @font-lock-variable-name-face)))]))
|
||||||
|
|
||||||
:language language
|
:language language
|
||||||
:override t
|
|
||||||
:feature 'property
|
:feature 'property
|
||||||
`((property_signature
|
`((property_signature
|
||||||
name: (property_identifier) @font-lock-property-face)
|
name: (property_identifier) @font-lock-property-face)
|
||||||
|
@ -249,7 +242,6 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
||||||
@font-lock-property-face))
|
@font-lock-property-face))
|
||||||
|
|
||||||
:language language
|
:language language
|
||||||
:override t
|
|
||||||
:feature 'expression
|
:feature 'expression
|
||||||
'((assignment_expression
|
'((assignment_expression
|
||||||
left: [(identifier) @font-lock-function-name-face
|
left: [(identifier) @font-lock-function-name-face
|
||||||
|
@ -266,7 +258,6 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
||||||
property: (property_identifier) @font-lock-function-name-face)]))
|
property: (property_identifier) @font-lock-function-name-face)]))
|
||||||
|
|
||||||
:language language
|
:language language
|
||||||
:override t
|
|
||||||
:feature 'pattern
|
:feature 'pattern
|
||||||
`((pair_pattern
|
`((pair_pattern
|
||||||
key: (property_identifier) @font-lock-property-face)
|
key: (property_identifier) @font-lock-property-face)
|
||||||
|
@ -274,7 +265,6 @@ Argument LANGUAGE is either `typescript' or `tsx'."
|
||||||
(array_pattern (identifier) @font-lock-variable-name-face))
|
(array_pattern (identifier) @font-lock-variable-name-face))
|
||||||
|
|
||||||
:language language
|
:language language
|
||||||
:override t
|
|
||||||
:feature 'jsx
|
:feature 'jsx
|
||||||
`((jsx_opening_element
|
`((jsx_opening_element
|
||||||
[(nested_identifier (identifier)) (identifier)]
|
[(nested_identifier (identifier)) (identifier)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue