branch: master
commit 3d9272d70deaa972bc78fb768f1f391e95ffd9ae
Author: Nikita Leshenko <[email protected]>
Commit: Nikita Leshenko <[email protected]>
company-tng: Fully replace default frontend list
The previous configuration wasn't good enough because it didn't handle the
case
where there was only one completion: The tooltip disappeared and a preview
was
shown, but hitting TAB would insert the candidate alongside with the
preview,
duplicating the text.
The new frontend set:
1. Doesn't include the preview frontend. I think that preview is not needed
when
TNG is active because TNG already does the same thing (previews selected
candidates in-buffer)
2. uses company-pseudo-tooltip-frontend instead of
company-pseudo-tooltip-unless-just-one-frontend. Vim's/ycm's default
behavior is
to show the tooltip even if there is one candidate and the user can just
hit TAB
to select it. I think that it makes sense because one candidate and many
candidates are presented in the same way and TAB work consistently between
them.
---
company-tng.el | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/company-tng.el b/company-tng.el
index f4801ba..fd5646f 100644
--- a/company-tng.el
+++ b/company-tng.el
@@ -104,7 +104,9 @@ confirm the selection and finish the completion."
;;;###autoload
(defun company-tng-configure-default ()
"Applies the default configuration to enable company-tng."
- (add-to-list 'company-frontends 'company-tng-frontend)
+ (setq company-frontends '(company-tng-frontend
+ company-pseudo-tooltip-frontend
+ company-echo-metadata-frontend))
(let ((keymap company-active-map))
(define-key keymap [return] nil)
(define-key keymap (kbd "RET") nil)