Add yasnippet support for all company backends
This commit is contained in:
parent
7086849a22
commit
6e2af03011
1 changed files with 13 additions and 2 deletions
|
@ -11,6 +11,15 @@
|
||||||
(defvar company-mode/completion-cancel-keywords '("do" "then" "begin" "case")
|
(defvar company-mode/completion-cancel-keywords '("do" "then" "begin" "case")
|
||||||
"Keywords on which to cancel completion so that you can use RET to complet without blocking common line endings.")
|
"Keywords on which to cancel completion so that you can use RET to complet without blocking common line endings.")
|
||||||
|
|
||||||
|
(defvar company-mode/enable-yas t
|
||||||
|
"Enable yasnippet for all backends.")
|
||||||
|
|
||||||
|
(defun company-mode/backend-with-yas (backend)
|
||||||
|
(if (or (not company-mode/enable-yas) (and (listp backend) (member 'company-yasnippet backend)))
|
||||||
|
backend
|
||||||
|
(append (if (consp backend) backend (list backend))
|
||||||
|
'(:with company-yasnippet))))
|
||||||
|
|
||||||
(defun company-mode/init-company ()
|
(defun company-mode/init-company ()
|
||||||
(use-package company
|
(use-package company
|
||||||
:config
|
:config
|
||||||
|
@ -44,10 +53,12 @@ so that you don't have 'do' completed to 'downcase' in Ruby"
|
||||||
'(company-tooltip-common ((t (:inherit company-tooltip :weight bold :underline nil))))
|
'(company-tooltip-common ((t (:inherit company-tooltip :weight bold :underline nil))))
|
||||||
'(company-tooltip-common-selection ((t (:inherit company-tooltip-selection :weight bold :underline nil)))))
|
'(company-tooltip-common-selection ((t (:inherit company-tooltip-selection :weight bold :underline nil)))))
|
||||||
|
|
||||||
|
(setq company-backends (mapcar #'company-mode/backend-with-yas company-backends))
|
||||||
|
|
||||||
(spacemacs//diminish company-mode " Ⓒ"))))
|
(spacemacs//diminish company-mode " Ⓒ"))))
|
||||||
|
|
||||||
(defun company-mode/init-company-tern ()
|
(defun company-mode/init-company-tern ()
|
||||||
(use-package company-tern
|
(use-package company-tern
|
||||||
:defer t
|
:defer t
|
||||||
:config
|
:init
|
||||||
(add-to-list 'company-backends 'company-tern)))
|
(add-to-list 'company-backends (company-mode/backend-with-yas 'company-tern))))
|
||||||
|
|
Reference in a new issue