company-lsp icon indicating copy to clipboard operation
company-lsp copied to clipboard

Insertion not deleting text entered to get candidates

Open seanhagen opened this issue 5 years ago • 3 comments

Just updated emacs to these versions:

  company-lsp           20190505.615
  company               20190430.1852

And some weird behavior is happening now -- the letters I type before selecting a completion candidate are not replaced by the selected candidate.

I'll post my configs below, but here are the steps to reproduce:

Step 1

Start typing something that brings up a list of completion candidates step1

Step 2

Type the first few characters of one of the candidates step2

Step 3

Select a candidate step3 See the extra Co at the end of the line? That's what was typed in before selecting the candidate. Seems like company isn't replacing what was typed, just inserting.

Config

This is happening with the gopls server.

This is using company, company-lsp, and lsp ( don't know if this is because of lsp or something else, but I figured I'd post that config too:

(use-package lsp-mode
  :ensure t
  :commands lsp
  :defer t
  :config
  (setq lsp-eldoc-enable-hover t
        lsp-eldoc-enable-signature-help t
        lsp-eldoc-prefer-signature-help t
        lsp-response-timeout 5)
  :init
  (setq lsp-prefer-flymake :none))

(use-package lsp-ui
  :ensure t
  :defer t
  :commands lsp-ui-mode
  :config
  (setq lsp-ui-doc-enable nil
        lsp-ui-peek-enable nil
        lsp-ui-sideline-enable nil
        lsp-ui-peek-always-show nil))

(use-package company-lsp
  :ensure t
  :defer t
  :commands company-lsp)

(use-package company
  :demand
  :diminish company-mode
  :init
  (global-company-mode 1)
  :config
  (global-company-mode 1)
  (setq company-idle-delay 0.1
        company-tooltip-limit 20
        company-minimum-prefix-length 2
        company-echo-delay 0
        company-begin-commands '(self-insert-command)
        company-tooltip-flip-when-above t
        company-backends (delete 'company-dabbrev company-backends))
  :bind ("C-<tab>" . company-complete))

And from where stuff changed by customize-group gets saved:

 '(company-backends
   (quote
    (company-go company-irony-c-headers company-c-headers company-arduino company-tern company-irony-c-headers company-c-headers company-arduino company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-cmake company-capf company-files
                (company-dabbrev-code company-gtags company-etags company-keywords)
                company-oddmuse)))
 '(company-go-gocode-command "/home/sean/Code/Go/bin/gocode")
 '(company-go-show-annotation t)
 '(company-idle-delay 0.7)
 '(company-lsp-enable-recompletion t)
 '(company-quickhelp-delay 0.2)

 '(lsp-clients-go-library-directories (quote ("/usr" "/usr/local/go")))
 '(lsp-clients-go-server "/home/sean/Code/Go/bin/gopls")
 '(lsp-go-executable-path "/home/sean/Code/Go/bin")
 '(lsp-prefer-flymake :none)
 '(lsp-response-timeout 5)
 '(lsp-ui-doc-enable nil)
 '(lsp-ui-doc-use-childframe nil)
 '(lsp-ui-doc-use-webkit nil)
 '(lsp-ui-imenu-enable nil)
 '(lsp-ui-peek-enable nil)
 '(lsp-ui-sideline-delay 1)
 '(lsp-ui-sideline-enable nil)

This may be the same issue as #107?

seanhagen avatar May 16 '19 18:05 seanhagen

Actually, found this exact problem on the gopls issue tracker: https://github.com/golang/go/issues/32078

seanhagen avatar May 16 '19 18:05 seanhagen

install yasnippet. If you use the latest lsp-mode it will yield a warning if you have the snippets enabled but no yasnippet installed.

yyoncho avatar May 16 '19 18:05 yyoncho

Maybe whatever code that checks lsp-enable-snippets should also check whether yasnippet is installed?

dgutov avatar May 17 '19 00:05 dgutov