emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master da4793e 02/31: ignored warning support


From: Dmitry Gutov
Subject: [elpa] master da4793e 02/31: ignored warning support
Date: Fri, 21 Jul 2017 09:04:53 -0400 (EDT)

branch: master
commit da4793e331dd2609ae2dcc450817c036d4601d8a
Author: jordonbiondo <address@hidden>
Commit: jordonbiondo <address@hidden>

    ignored warning support
---
 js2-mode.el | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/js2-mode.el b/js2-mode.el
index a07d5c5..2848a2c 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -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 '(repeat string))
+
 (defcustom js2-highlight-level 2
   "Amount of syntax highlighting to perform.
 0 or a negative value means none.
@@ -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-warnings)
       (save-excursion
         (run-hooks 'js2-post-parse-callbacks))
       (js2-highlight-undeclared-vars))
     root))
 
+(defun js2-filter-parsed-warnings ()
+  "Remove `js2-parsed-warnings' elements that match `js2-ignored-warnings'."
+  (when js2-ignored-warnings
+    (setq js2-parsed-warnings
+          (cl-remove-if
+           (lambda (warning)
+             (let ((msg (caar warning)))
+               (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)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]