]> git.eshelyaron.com Git - emacs.git/commitdiff
js-ts-mode: Fix font-lock rules conflict
authorDmitry Gutov <dmitry@gutov.dev>
Tue, 12 Dec 2023 22:00:38 +0000 (00:00 +0200)
committerDmitry Gutov <dmitry@gutov.dev>
Tue, 12 Dec 2023 22:00:38 +0000 (00:00 +0200)
* lisp/progmodes/js.el (js--treesit-font-lock-settings): Move
'property' to after 'jsx'.  Stop using predicate (bug#67684).
(js--treesit-property-not-function-p): Delete.

lisp/progmodes/js.el

index aaf5779699b20273c602fb9d96bf3e959645c8fd..c8d507c784b811d175fbbe4ddbbf31d8746259d0 100644 (file)
@@ -3580,16 +3580,6 @@ Check if a node type is available, then return the right indent rules."
      ;; full namespace import (* as alias)
      (import_clause (namespace_import (identifier) @font-lock-variable-name-face)))
 
-   :language 'javascript
-   :feature 'property
-   '(((property_identifier) @font-lock-property-use-face
-      (:pred js--treesit-property-not-function-p
-             @font-lock-property-use-face))
-
-     (pair value: (identifier) @font-lock-variable-use-face)
-
-     ((shorthand_property_identifier) @font-lock-property-use-face))
-
    :language 'javascript
    :feature 'assignment
    '((assignment_expression
@@ -3610,6 +3600,12 @@ Check if a node type is available, then return the right indent rules."
      (jsx_self_closing_element name: (_) @font-lock-function-call-face)
      (jsx_attribute (property_identifier) @font-lock-constant-face))
 
+   :language 'javascript
+   :feature 'property
+   '(((property_identifier) @font-lock-property-use-face)
+     (pair value: (identifier) @font-lock-variable-use-face)
+     ((shorthand_property_identifier) @font-lock-property-use-face))
+
    :language 'javascript
    :feature 'number
    '((number) @font-lock-number-face
@@ -3661,14 +3657,6 @@ OVERRIDE is the override flag described in
       (setq font-beg (treesit-node-end child)
             child (treesit-node-next-sibling child)))))
 
-(defun js--treesit-property-not-function-p (node)
-  "Check that NODE, a property_identifier, is not used as a function."
-  (not (equal (treesit-node-type
-               (treesit-node-parent ; Maybe call_expression.
-                (treesit-node-parent ; Maybe member_expression.
-                 node)))
-              "call_expression")))
-
 (defvar js--treesit-lhs-identifier-query
   (when (treesit-available-p)
     (treesit-query-compile 'javascript '((identifier) @id