Add manual semantic completion function for company to ycmd layer
This commit is contained in:
parent
2ce1e367c0
commit
f3dbeec5dc
|
@ -89,13 +89,13 @@ with almost any build system.
|
|||
* Functions
|
||||
|
||||
If ~company-ycmd~ is used, then a function
|
||||
~spacemacs/company-ycmd-manual-semantic-complete~ is defined. This function is
|
||||
~ycmd/manual-semantic-company-completer~ is defined. This function is
|
||||
useful if you want to get semantic completions only when you press a
|
||||
keybinding; in larger projects ycmd may not be performant for as-you-type
|
||||
auto-completion to work well. You can bind it like so:
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(global-set-key (kbd "<C-tab>") 'spacemacs/company-ycmd-manual-semantic-complete)
|
||||
(global-set-key (kbd "<C-tab>") 'ycmd/manual-semantic-company-completer)
|
||||
#+END_SRC
|
||||
|
||||
This function will automatically cancel out of any active completers, and offer
|
||||
|
|
|
@ -1,7 +1,20 @@
|
|||
(when (configuration-layer/package-usedp 'company-ycmd)
|
||||
(defun spacemacs/company-ycmd-manual-semantic-complete ()
|
||||
(interactive)
|
||||
(company-cancel)
|
||||
(let ((ycmd-force-semantic-completion (not (company-ycmd--in-include))))
|
||||
(setq company-backend 'company-ycmd)
|
||||
(company-manual-begin))))
|
||||
;;; funcs.el --- Ycmd Layer functions File for Spacemacs
|
||||
;;
|
||||
;; Copyright (c) 2012-2017 Sylvain Benner & Contributors
|
||||
;;
|
||||
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
||||
;; URL: https://github.com/syl20bnr/spacemacs
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
(defun ycmd/manual-semantic-company-completer ()
|
||||
"A useful function that can be bound, if users prefer to trigger company
|
||||
completion manually"
|
||||
|
||||
(interactive)
|
||||
(company-cancel)
|
||||
(let ((ycmd-force-semantic-completion (not (company-ycmd--in-include))))
|
||||
(setq company-backend 'company-ycmd)
|
||||
(company-manual-begin)))
|
||||
|
|
Loading…
Reference in a new issue