mooz/js2-mode — Issue #20: js2-additional-externs not honored until after change
Author: magnars
Created: 2011-11-07 10:14:18+00:00
State: open

With additional externs in `js2-mode-hook`, the new externs are still marked as undefined until you actually make a change to the document.

The same happens after a `js2-mode-reset`, which will temporarily forget the externs in `js2-additional-externs`.

Right now I worked around it by adding:

(insert " ")
(undo)

after my definition. Which is quite horrible. :-)

Anyone else have this problem, or am I doing something wrong?

Here's my complete code:

(add-hook 'js2-mode-hook
(lambda ()
(when (string-match-p "oppdrag-services" (buffer-file-name))
(setq js2-additional-externs '("FINN" "assert" "refute" "testCase"))
(insert " ")
(undo))))