Add tern + tern-auto-complete for js-mode

This commit is contained in:
Henrik Lissner 2014-07-22 23:24:25 -04:00
parent 8c9c7f3bde
commit 3b0bf80187

38
modules/env-js-mode.el Normal file
View file

@ -0,0 +1,38 @@
(require-packages '(tern tern-auto-complete))
(add-hook 'js-mode-hook
(lambda ()
(evil-define-key 'insert ac-mode-map (kbd "C-SPC") 'tern-ac-complete)
(tern-mode t)
(tern-ac-setup)
))
;; Let flycheck handle parse errors
;; (setq-default js2-show-parse-errors nil)
;; (setq-default js2-strict-missing-semi-warning nil)
;; (setq-default js2-strict-trailing-comma-warning t) ;; jshint does not warn about this now for some reason
;; (defun js2-parse-jshintrc ()
;; "This looks recursively up for a .jshintrc and extracts the
;; globals from it to add them to js2-additional-externs."
;; (let* ((jshintrc (expand-file-name ".jshintrc" (locate-dominating-file default-directory ".jshintrc")))
;; (json (and jshintrc (json-read-file jshintrc)))
;; (globals (and json (cdr (assq 'globals json)))))
;; (when globals
;; (setq js2-additional-externs
;; (append
;; (mapcar (lambda (pair) (symbol-name (car pair))) globals)
;; js2-additional-externs
;; )
;; )
;; (js2-reparse t)
;; )
;; )
;; )
;; (add-hook 'js2-init-hook 'js2-parse-jshintrc)
;;
(provide 'env-js-mode)