called after the new parse tree is built. This can take some time
in large files.")
-(defface js2-warning-face
+(defface js2-warning
`((((class color) (background light))
(:underline "orange"))
(((class color) (background dark))
"Face for JavaScript warnings."
:group 'js2-mode)
-(defface js2-error-face
+(defface js2-error
`((((class color) (background light))
(:foreground "red"))
(((class color) (background dark))
"Face for JavaScript errors."
:group 'js2-mode)
-(defface js2-jsdoc-tag-face
+(defface js2-jsdoc-tag
'((t :foreground "SlateGray"))
"Face used to highlight @whatever tags in jsdoc comments."
:group 'js2-mode)
-(defface js2-jsdoc-type-face
+(defface js2-jsdoc-type
'((t :foreground "SteelBlue"))
"Face used to highlight {FooBar} types in jsdoc comments."
:group 'js2-mode)
-(defface js2-jsdoc-value-face
+(defface js2-jsdoc-value
'((t :foreground "PeachPuff3"))
"Face used to highlight tag values in jsdoc comments."
:group 'js2-mode)
-(defface js2-function-param-face
+(defface js2-function-param
'((t :foreground "SeaGreen"))
"Face used to highlight function parameters in javascript."
:group 'js2-mode)
-(defface js2-instance-member-face
+(defface js2-instance-member
'((t :foreground "DarkOrchid"))
"Face used to highlight instance variables in javascript.
Not currently used."
:group 'js2-mode)
-(defface js2-private-member-face
+(defface js2-private-member
'((t :foreground "PeachPuff3"))
"Face used to highlight calls to private methods in javascript.
Not currently used."
:group 'js2-mode)
-(defface js2-private-function-call-face
+(defface js2-private-function-call
'((t :foreground "goldenrod"))
"Face used to highlight calls to private functions in javascript.
Not currently used."
:group 'js2-mode)
-(defface js2-jsdoc-html-tag-name-face
+(defface js2-jsdoc-html-tag-name
(if js2-emacs22
'((((class color) (min-colors 88) (background light))
(:foreground "rosybrown"))
"Face used to highlight jsdoc html tag names"
:group 'js2-mode)
-(defface js2-jsdoc-html-tag-delimiter-face
+(defface js2-jsdoc-html-tag-delimiter
(if js2-emacs22
'((((class color) (min-colors 88) (background light))
(:foreground "dark khaki"))
"Face used to highlight brackets in jsdoc html tags."
:group 'js2-mode)
-(defface js2-magic-paren-face
+(defface js2-magic-paren
'((t :underline t))
"Face used to color parens that will be auto-overwritten."
:group 'js2-mode)
:type 'list
:group 'js2-mode)
-(defface js2-external-variable-face
+(defface js2-external-variable
'((t :foreground "orange"))
"Face used to highlight assignments to undeclared variables.
An undeclared variable is any variable not declared with var or let
(defsubst js2-jsdoc-highlight-helper ()
(js2-set-face (match-beginning 1)
(match-end 1)
- 'js2-jsdoc-tag-face)
+ 'js2-jsdoc-tag)
(if (match-beginning 2)
(if (save-excursion
(goto-char (match-beginning 2))
(= (char-after) ?{))
(js2-set-face (1+ (match-beginning 2))
(1- (match-end 2))
- 'js2-jsdoc-type-face)
+ 'js2-jsdoc-type)
(js2-set-face (match-beginning 2)
(match-end 2)
- 'js2-jsdoc-value-face)))
+ 'js2-jsdoc-value)))
(if (match-beginning 3)
(js2-set-face (match-beginning 3)
(match-end 3)
- 'js2-jsdoc-value-face)))
+ 'js2-jsdoc-value)))
(defun js2-highlight-jsdoc (ast)
"Highlight doc comment tags."
(while (re-search-forward js2-jsdoc-html-tag-regexp nil t)
(js2-set-face (match-beginning 1)
(match-end 1)
- 'js2-jsdoc-html-tag-delimiter-face)
+ 'js2-jsdoc-html-tag-delimiter)
(js2-set-face (match-beginning 2)
(match-end 2)
- 'js2-jsdoc-html-tag-name-face)
+ 'js2-jsdoc-html-tag-name)
(js2-set-face (match-beginning 3)
(match-end 3)
- 'js2-jsdoc-html-tag-delimiter-face))))))))
+ 'js2-jsdoc-html-tag-delimiter))))))))
(defun js2-highlight-assign-targets (node left right)
"Highlight function properties and external variables."
(member name js2-default-externs)
(member name js2-additional-externs)
(js2-get-defining-scope scope name))
- (js2-set-face pos end 'js2-external-variable-face 'record)
+ (js2-set-face pos end 'js2-external-variable 'record)
(js2-record-text-property pos end 'help-echo "Undeclared variable")
(js2-record-text-property pos end 'point-entered #'js2-echo-help))))
(setq js2-recorded-assignments nil)))
(when js2-parse-ide-mode
(cond
((minusp tt)
- (js2-record-face 'js2-error-face))
+ (js2-record-face 'js2-error))
((setq face (aref js2-kwd-tokens tt))
(js2-record-face face))
((and (= tt js2-NAME)
;; simple name
(t
(js2-must-match js2-NAME "msg.no.parm")
- (js2-record-face 'js2-function-param-face)
+ (js2-record-face 'js2-function-param)
(setq param (js2-create-name-node))
(js2-define-symbol js2-LP js2-ts-string param)
(push param params)))
"Highlight syntax errors."
(when js2-mode-show-parse-errors
(dolist (e (js2-ast-root-errors js2-mode-ast))
- (js2-mode-show-warn-or-err e 'js2-error-face))))
+ (js2-mode-show-warn-or-err e 'js2-error))))
(defun js2-mode-remove-suppressed-warnings ()
"Take suppressed warnings out of the AST warnings list.
"Highlight strict-mode warnings."
(when js2-mode-show-strict-warnings
(dolist (e (js2-ast-root-warnings js2-mode-ast))
- (js2-mode-show-warn-or-err e 'js2-warning-face))))
+ (js2-mode-show-warn-or-err e 'js2-warning))))
(defun js2-echo-error (old-point new-point)
"Called by point-motion hooks."
(nth 4 parse-state)))))
(defsubst js2-make-magic-delimiter (delim &optional pos)
- "Add `js2-magic' and `js2-magic-paren-face' to DELIM, a string.
+ "Add `js2-magic' and `js2-magic-paren' to DELIM, a string.
Sets value of `js2-magic' text property to line number at POS."
(propertize delim
'js2-magic (line-number-at-pos pos)
- 'face 'js2-magic-paren-face))
+ 'face 'js2-magic-paren))
(defun js2-mode-match-delimiter (open close)
"Insert OPEN (a string) and possibly matching delimiter CLOSE.
(if (get-text-property beg 'js2-magic)
(js2-with-unmodifying-text-property-changes
(put-text-property beg (or end (1+ beg))
- 'face 'js2-magic-paren-face))))))
+ 'face 'js2-magic-paren))))))
(defun js2-mode-mundanify-parens ()
"Clear all magic parens and brackets."