Doom-emacs: [QUESTION] something wrong with company-tabnine

Created on 19 Aug 2019  路  12Comments  路  Source: hlissner/doom-emacs

@hlissner I try to intergrate company-tabnine into doom-emacs, the company doesn't auto popup as I type, I run M-x company-tabnine, the company popup shows. Please give me a hand, thank you.

config.el:

(defun add-company-tabnine ()
  (add-to-list (make-local-variable 'company-backends) 'company-tabnine))

(def-package! company-tabnine
  :config
  (add-hook! (c-mode
              c++-mode
              emacs-lisp-mode
              python-mode)
    #'add-company-tabnine))

package.el:

(when (featurep! :completion company)
  (package! company-tabnine))

init.el:

(def-package-hook! company
  :post-init
  (setq  company-idle-delay 0
         company-show-numbers t))
:completion company elisp backlog

Most helpful comment

I think this can be closed, TabNine works perfectly now, but you have to add it to +lsp-company-backends (as @hlissner said) if you want to use it when lsp-mode is active.

(setq +lsp-company-backends '(company-tabnine company-capf))

All 12 comments

same problem here.

Is this still an issue?

If so, please try the following:

(defun add-company-tabnine ()
  (add-to-list (make-local-variable 'company-backends) 'company-tabnine))

(use-package! company-tabnine
  :config
  (setq company-idle-delay 0
        company-show-numbers t)
  (add-hook! (c-mode-local-vars
              c++-mode-local-vars
              emacs-lisp-mode-local-vars
              python-mode-local-vars)
    #'add-company-tabnine))

Thanks for the help, but as far as I'm concerned the tabnine style pop up is still not showing up. personally I'm fine just sticking with the language server completion.

maybe @chengyi could testify result from his side.

@hlissner as @alxiong says, after using your code snippet, tabnine still does not show up. Beause the head of company backends is still company-lsp

@chengyi I'm using the following config and am seeing tabnine suggestions.

init.el

(use-package-hook! company
  :post-init
  (setq +lsp-company-backend '(company-lsp :with company-tabnine :separate)
        company-idle-delay 0
        company-show-numbers t))

package.el

(when (featurep! :completion company)
  (package! company-tabnine))

No modifications in config.el.

Avoid use-package-hook! if you don't have to use it.

;;; config.el
(setq +lsp-company-backend '(company-lsp :with company-tabnine :separate))
(after! company
  (setq company-idle-delay 0
        company-show-numbers t))

I still can't really get TabNine and LSP to play nice together. My TabNine specific config is only

(use-package! company-tabnine
  :after company
  :when (featurep! :completion company)
  :config
  (cl-pushnew 'company-tabnine (default-value 'company-backends))
  )
(setq +lsp-company-backend '(company-lsp :with company-tabnine :separate))

but unless I manually call company-tabnine the TabNine results don't appear. company-backends appears to be set to (company-capf company-yasnippet company-tabnine company-css company-web-html) (in a typescript file), but tabnine results never show in the box. Maybe I'm missing a useful shortcut or something to switch the default backend?

Ah, +lsp-company-backend was removed in https://github.com/hlissner/doom-emacs/commit/b3c957065c036ad677b21aafcea5f726c303d653 so no wonder it doesn't work.

Ah, +lsp-company-backend was removed in b3c9570 so no wonder it doesn't work.

Tuning emacs is a hard work

I re-introduced the +lsp-company-backend variable yesterday (in e852ac046), so the original fix should work again.

I think this can be closed, TabNine works perfectly now, but you have to add it to +lsp-company-backends (as @hlissner said) if you want to use it when lsp-mode is active.

(setq +lsp-company-backends '(company-tabnine company-capf))

perfect! close it.

Was this page helpful?
0 / 5 - 0 ratings