Recently, I have tried setting up a JS development environment and part of that process has been configuring company-mode for autocompletion duties - but I'm having some issues triggering auto completion. First - here's the file I use to configure company mode:
(use-package yasnippet :ensure t :diminish yas-minor-mode :config (setq yas-snippet-dirs (append yas-snippet-dirs '("~/.emacs.d/snippets/"))) (yas-global-mode 1)) (use-package company :ensure t :diminish company-mode :config (add-to-list 'company-backends 'company-elisp) (add-to-list 'company-backends 'company-yasnippet) (add-to-list 'company-backends 'company-dabbrev) (add-to-list 'company-backends 'company-dabbrev-code) (add-to-list 'company-backends 'company-etags) (setq company-auto-complete nil company-tooltip-flip-when-above t company-minimum-prefix-length 2 company-tooltip-limit 10 company-idle-delay 0.5) (global-company-mode 1)) ;; (add-hook 'prog-mode-hook 'company-mode)) (use-package helm-company :ensure t :config (progn (define-key company-mode-map (kbd "C-:") 'helm-company) (define-key company-active-map (kbd "C-:") 'helm-company))) (use-package company-tern :ensure t :init (add-to-list 'company-backends 'company-tern)) (use-package tern :ensure t :defer t :diminish tern-mode :config (progn (add-hook 'js2-mode-hook 'tern-mode))) (provide 'init-autocompletion)
Now, let's say I'm working in a...Coffeescript file - and it has something like this:
foo = addTwo: (a) -> a + 2 addThree: (a) -> a + 3
then later on in that file I start typing:
I would hope that company would kick in and offer addTwo/Three as candidates - but I got nada!
I ran company-diag - and I get this:
Emacs 24.5.1 (x86_64-apple-darwin14.4.0) of 2015-07-13 on MFT-A018.local Company 0.9.0-cvs company-backends: (company-tern company-etags company-dabbrev-code company-yasnippet company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf (company-dabbrev-code company-gtags company-etags company-keywords) company-oddmuse company-files company-dabbrev) Used backend: company-etag
and a whole bunch of completion candidates - none of which are foo.addTwo/Three
can anyone offer any advice on how to get company-mode working?