tigersoldier / company-lsp

Company completion backend for lsp-mode
GNU General Public License v3.0
251 stars 26 forks source link

company-lsp overriding yasnippets snippets #119

Open howdoicomputer opened 5 years ago

howdoicomputer commented 5 years ago

Creating this issue off of the back of https://github.com/syl20bnr/spacemacs/issues/12173

Essentially, when company-lsp is enabled then snippets from yasnippets-snippets don't show up in the autocompletion drop down. If I wanted to autocomplete an if err = nil block in Go, then I'd have to disable company-lsp to do so.

Every package is at their latest version.

howdoicomputer commented 5 years ago

Also,

  (setq company-lsp-enable-snippet t)
  (setq lsp-enable-snippet t)

Are set.

floating-cat commented 5 years ago

I have this issue too. From my understand, the default value of company-lsp-enable-snippet is t, so If I set up company-lsp and yasnippet correctly, the company-lsp should show yasnippets completion in my autocompletion dropdown.

glepnir commented 5 years ago

got same issue,but i think the problem has nothing to do with company-lsp-enable-snippet,because this setting is show the snippet which from lsp not yasnippet, so i think the problem is about company-lsp and yasnippet.

jiahut commented 5 years ago

configure as blew , then the company-yasnippet works well with company-lsp


  (setq lsp-auto-configure nil)
  (lsp-register-client
   (make-lsp-client :new-connection (lsp-stdio-connection "gopls")
                    :major-modes '(go-mode)
                    :priority 0
                    :initialization-options 'lsp-clients-go--make-init-options
                    :server-id 'gopls
                    :library-folders-fn (lambda (_workspace)
                                          lsp-clients-go-library-directories)))
  (with-eval-after-load 'lsp-mode
    (require 'lsp-ui)
    (add-hook 'lsp-mode-hook 'lsp-ui-mode)
    (require 'lsp-ui-flycheck)
    (lsp-ui-flycheck-enable t)
    (flycheck-mode 1)
    (require 'company)
    (push '(company-lsp :with company-yasnippet) company-backends))
ghost commented 5 years ago

Same issue. company-backends evals to: (company-lsp (company-lsp :with company-yasnippet)) Here is my config

ghost commented 5 years ago

For people that still have this problem; I somehow managed to make company-yasnippet work with company-lsp and make the snippets sort better. Look around in my config for the possible fix.

sents commented 4 years ago

@neftt I can't find your workaround in the linked repository. Could you maybe copy it as a reply here.

ghost commented 4 years ago

@sents I don't know if it still works since I've changed around a lot in my config. I remember it working on this commit. Add setq company-transformers '(company-sort-prefer-same-case-prefix) for better sorting.