reddit / emacs

Company doesn't show yasnippet and load very slow!

Likhon-BaRoy · 2022-12-26 09:10
Facing strange problem with *auto-completion* `company-mode`. It doesn't showing any `yasnippet` ^(snippets) with company suggestion. And taking much longer time to load than before! [Before my company suggestion was like this :](https://preview.redd.it/u0lr8qftk78a1.png?width=1280&format=png&auto=webp&s=2e4f62ea0efbc8c8605f601d2a1966b82308cb84) [And after changed to this!?](https://preview.redd.it/1yzg0dfyk78a1.png?width=1280&format=png&auto=webp&s=4d9d1161838a87a3eacd471b15804f73298342c1) configuration of my `company-mode` is in `auto-completion.el` in `my-lisp` directory.[https://github.com/Likhon-baRoy/emacs](https://github.com/Likhon-baRoy/emacs) (setq company-backends '((company-files company-keywords company-capf company-cmake company-yasnippet company-c-headers company-irony company-dabbrev-code company-semantic company-gtags company-etags company-rtags company-elisp) (company-abbrev company-dabbrev))) (use-package yasnippet :custom (yas-snippet-dirs '("~/.emacs.d/etc/yasnippet/snippets")) :commands yas-reload-all :hook ((prog-mode minibuffer-inactive-mode org-mode) . yas-minor-mode) :config ;; enalbe nested snippet expansion (setq yas-triggers-in-field t) (yas-global-mode)) ​
[deleted] · 2022-12-26 10:44
[deleted]
Likhon-BaRoy · 2022-12-26 11:09
I really don't know what exactly causing the problem and I can't paste my full file here!
rishianand · 2022-12-27 10:25
When you're using the completion, what is the value of company-backends? ``` C-h v RET company-backends ```
Likhon-BaRoy · 2022-12-27 10:39
Value `(company-bbdb company-semantic company-cmake company-capf company-clang company-files (company-dabbrev-code company-gtags company-etags company-keywords) company-oddmuse company-dabbrev)` Original Value `(company-bbdb company-semantic company-cmake company-capf company-clang company-files (company-dabbrev-code company-gtags company-etags company-keywords) company-oddmuse company-dabbrev)`
rishianand · 2022-12-27 10:56
As you can see, company-yasnippet is not in the list. I think I had run into this problem at one point. Though, I have not used company in quite some time, and my explanation and solution could be outdated, or wrong. But the issue was that, iirc, company-backends is a buffer-local variable, and is set when the buffer is loaded. So it reverts to its original value. I had added a function to the prog-mode-hook, to set a buffer local value. (add-hook 'prog-mode-hook (lambda () (setq-local company-backends '(company-capf :with company-files :with company-yasnippet))))
Likhon-BaRoy · 2022-12-27 11:27
it causes another problem, only load snippets none other!