2

Js2-mode is showing error when there are not registered globals. I've try this code:

(defun js2-hook ()
  ;; setting symbols instead of strings also don't work
  (dolist (global '("angular" "$" "jQuery" "console" "_" "window" "setTimeout"))
    (add-to-list 'js2-additional-externs global)))

(add-hook 'js2-mode-hook 'js2-hook)

but this don't work. How can I set globals, setting js2-additional-externs directly don't work also, because describe-variable says that this variable is automatically local when set.

  • 1
    Have you tried setting js2-global-externs? It seems that it's the variable you're looking for. – DoMiNeLa10 Feb 21 '17 at 12:39
  • @DoMiNeLa10 Please add this as an answer. – caisah Feb 21 '17 at 19:30
3

It seems that the variable you want to set is js2-global-externs.

js2-additional-externs is intended for setting globals on per-buffer basis, not for all buffers with js2-mode.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.