Skip to content

Commit

Permalink
ignored warning support
Browse files Browse the repository at this point in the history
  • Loading branch information
jordonbiondo committed Jan 27, 2017
1 parent 03c679e commit f3aa627
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions js2-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,13 @@ variable with predicate PRED."
(make-variable-buffer-local name)
(put name 'safe-local-variable pred))

(defcustom js2-ignored-warnings nil
"A list of warning message types that will not be reported.

Possible values are the keys of `js2-message-table'."
:group 'js2-mode
:type 'list)

(defcustom js2-highlight-level 2
"Amount of syntax highlighting to perform.
0 or a negative value means none.
Expand Down Expand Up @@ -8130,11 +8137,23 @@ Scanner should be initialized."
(setq js2-mode-ast root) ; Make sure this is available for callbacks.
;; Give extensions a chance to muck with things before highlighting starts.
(let ((js2-additional-externs js2-additional-externs))
(js2-filter-parsed-errors)
(save-excursion
(run-hooks 'js2-post-parse-callbacks))
(js2-highlight-undeclared-vars))
root))

(defun js2-filter-parsed-errors ()
"Remove `js2-ignored-warnings' from `js2-parsed-errors'."
(when js2-ignored-warnings
(setq js2-parsed-warnings
(cl-remove-if
(lambda (warning)
(let ((msg (caar warning)))
(and msg (member msg js2-ignored-warnings))))
js2-parsed-warnings)))
js2-parsed-warnings)

(defun js2-parse-function-closure-body (fn-node)
"Parse a JavaScript 1.8 function closure body."
(let ((js2-nesting-of-function (1+ js2-nesting-of-function)))
Expand Down

0 comments on commit f3aa627

Please sign in to comment.