[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 8a1498c01f 2/2: Fix fontification of function-valued variables
From: |
Theodor Thornhill |
Subject: |
emacs-29 8a1498c01f 2/2: Fix fontification of function-valued variables (bug#61053) |
Date: |
Wed, 25 Jan 2023 07:05:06 -0500 (EST) |
branch: emacs-29
commit 8a1498c01f76391f61c8bd9861a31fec42e1073a
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: Theodor Thornhill <theo@thornhill.no>
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.
---
lisp/progmodes/typescript-ts-mode.el | 20 +++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)
diff --git a/lisp/progmodes/typescript-ts-mode.el
b/lisp/progmodes/typescript-ts-mode.el
index 3403096880..25cc327d05 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -132,26 +132,21 @@ Argument LANGUAGE is either `typescript' or `tsx'."
Argument LANGUAGE is either `typescript' or `tsx'."
(treesit-font-lock-rules
:language language
- :override t
:feature 'comment
`((comment) @font-lock-comment-face)
:language language
- :override t
:feature 'constant
`(((identifier) @font-lock-constant-face
(:match "^[A-Z_][A-Z_\\d]*$" @font-lock-constant-face))
-
[(true) (false) (null)] @font-lock-constant-face)
:language language
- :override t
:feature 'keyword
`([,@typescript-ts-mode--keywords] @font-lock-keyword-face
[(this) (super)] @font-lock-keyword-face)
:language language
- :override t
:feature 'string
`((regex pattern: (regex_pattern)) @font-lock-regexp-face
(string) @font-lock-string-face
@@ -159,7 +154,7 @@ Argument LANGUAGE is either `typescript' or `tsx'."
(template_substitution ["${" "}"] @font-lock-misc-punctuation-face))
:language language
- :override t
+ :override t ;; for functions assigned to variables
:feature 'declaration
`((function
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)
(optional_parameter (identifier) @font-lock-variable-name-face)
+ (variable_declarator
+ name: (identifier) @font-lock-function-name-face
+ value: [(function) (arrow_function)])
+
(variable_declarator
name: (identifier) @font-lock-variable-name-face)
@@ -188,10 +187,6 @@ Argument LANGUAGE is either `typescript' or `tsx'."
(arrow_function
parameter: (identifier) @font-lock-variable-name-face)
- (variable_declarator
- name: (identifier) @font-lock-function-name-face
- value: [(function) (arrow_function)])
-
(variable_declarator
name: (array_pattern
(identifier)
@@ -205,7 +200,6 @@ Argument LANGUAGE is either `typescript' or `tsx'."
(import_clause (named_imports (import_specifier (identifier))
@font-lock-variable-name-face)))
:language language
- :override t
:feature 'identifier
`((nested_type_identifier
module: (identifier) @font-lock-type-face)
@@ -234,7 +228,6 @@ Argument LANGUAGE is either `typescript' or `tsx'."
(_ (_ (_ (identifier) @font-lock-variable-name-face)))]))
:language language
- :override t
:feature 'property
`((property_signature
name: (property_identifier) @font-lock-property-face)
@@ -249,7 +242,6 @@ Argument LANGUAGE is either `typescript' or `tsx'."
@font-lock-property-face))
:language language
- :override t
:feature 'expression
'((assignment_expression
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)]))
:language language
- :override t
:feature 'pattern
`((pair_pattern
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))
:language language
- :override t
:feature 'jsx
`((jsx_opening_element
[(nested_identifier (identifier)) (identifier)]