]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix fontification of method-invocations in js-ts-mode (bug#59904)
authorJostein Kjønigsen <jostein@kjonigsen.net>
Thu, 8 Dec 2022 14:45:00 +0000 (15:45 +0100)
committerYuan Fu <casouri@gmail.com>
Sat, 10 Dec 2022 00:46:00 +0000 (16:46 -0800)
* lisp/progmodes/js.el (js--treesit-font-lock-settings): Move rules
for property in front of function names, so function names override
property.

lisp/progmodes/js.el

index 45dfef372cd8691b08d094e5333f841d6bf07fcf..f7318c481a2b66cfc5c9e7a332b154a8e6655133 100644 (file)
@@ -3543,6 +3543,20 @@ This function is intended for use in `after-change-functions'."
      (arrow_function
       parameter: (identifier) @font-lock-variable-name-face))
 
+   :language 'javascript
+   :override t
+   :feature 'property
+   ;; This needs to be before function-name feature, because methods
+   ;; can be both property and function-name, and we want them in
+   ;; function-name face.
+   `((property_identifier) @font-lock-property-face
+
+     (pair value: (identifier) @font-lock-variable-name-face)
+
+     ((shorthand_property_identifier) @font-lock-property-face)
+
+     ((shorthand_property_identifier_pattern) @font-lock-property-face))
+
    :language 'javascript
    :override t
    :feature 'expression
@@ -3611,18 +3625,7 @@ This function is intended for use in `after-change-functions'."
    :language 'javascript
    :feature 'escape-sequence
    :override t
-   '((escape_sequence) @font-lock-escape-face)
-
-   :language 'javascript
-   :override t
-   :feature 'property
-   `((property_identifier) @font-lock-property-face
-
-     (pair value: (identifier) @font-lock-variable-name-face)
-
-     ((shorthand_property_identifier) @font-lock-property-face)
-
-     ((shorthand_property_identifier_pattern) @font-lock-property-face)))
+   '((escape_sequence) @font-lock-escape-face))
   "Tree-sitter font-lock settings.")
 
 (defun js--fontify-template-string (node override start end &rest _)