]> code.delx.au - gnu-emacs-elpa/commitdiff
Also highlight function names after new operator
authorDmitry Gutov <dgutov@yandex.ru>
Tue, 14 Jan 2014 01:52:27 +0000 (03:52 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Tue, 14 Jan 2014 01:52:27 +0000 (03:52 +0200)
+ Only highlight name tokens, disregarding function objects accessed
via array-get, etc.

#128

js2-mode.el

index bf0b62d46f6aed5a38c2b703bd03d775c94dbe27..131b9914b460f45422a6a4a090297e3a27e1dec0 100644 (file)
@@ -8865,6 +8865,7 @@ Returns the list in reverse order.  Consumes the right-paren token."
             pn (make-js2-new-node :pos pos
                                   :target target
                                   :len (- end pos)))
+      (js2-highlight-function-call (js2-current-token))
       (js2-node-add-children pn target)
       (when (js2-match-token js2-LP)
         ;; Add the arguments to pn, if any are supplied.
@@ -8956,8 +8957,12 @@ Last token parsed must be `js2-RB'."
                            (js2-elem-get-node-element pn))
     pn))
 
+(defun js2-highlight-function-call (token)
+  (when (eq (js2-token-type token) js2-NAME)
+    (js2-record-face 'js2-function-call token)))
+
 (defun js2-parse-function-call (pn)
-  (js2-record-face 'js2-function-call)
+  (js2-highlight-function-call (js2-current-token))
   (js2-get-token)
   (let (args
         (pos (js2-node-pos pn)))