branch: master
commit 64ec0a26673215e36f89e31d7935f99b731fd03d
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>
Allow newline in globals declaration
Fixes #373.
---
js2-mode.el | 2 +-
tests/externs.el | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/js2-mode.el b/js2-mode.el
index 1e7f61b..e6d1c00 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -7283,7 +7283,7 @@ are ignored."
when (and (eq 'block (js2-comment-node-format node))
(save-excursion
(goto-char (js2-node-abs-pos node))
- (looking-at "/\\* *global ")))
+ (looking-at "/\\* *global\\(?: \\|$\\)")))
append (js2-get-jslint-globals-in
(match-end 0)
(js2-node-abs-end node))))
diff --git a/tests/externs.el b/tests/externs.el
index 75b93cd..3540f3c 100644
--- a/tests/externs.el
+++ b/tests/externs.el
@@ -49,6 +49,13 @@
(should (equal (js2-get-jslint-globals)
'("foo" "bar" "baz")))))
+(ert-deftest js2-finds-jslint-globals-with-newline ()
+ (with-temp-buffer
+ (insert "/* global\nfoo, bar")
+ (js2-mode)
+ (should (equal (js2-get-jslint-globals)
+ '("foo" "bar")))))
+
;;;TODO
;; ensure that any symbols bound with the import syntax are added to the
extern list
;; ensure that any symbols bound with the export syntax exist in the file scope