yasuyk/helm-company

Incorrect match replacements

whilp opened this issue · 2 comments

whilp commented

Given this scenario (Python, but I get similar results given similar candidate contexts in other languages):

foo_bar_baz = "ok"
foo_spam_eggs = "ok"

foo^

My cursor is at ^. When I invoke company-complete, I'm presented with the short list of two candidates as expected, and when I select one, the resulting completion is also foo_bar_baz. However, when I invoke helm-company and choose one of the candidates, I get ffoo_bar_baz, where the first character is duplicated.

My related configuration is:

(use-package helm-company :ensure t)
(use-package company
  :ensure t
  :diminish company-mode
  :init (global-company-mode 1)
  :config
  (progn
    (dolist (package '(company-go
                       company-inf-ruby
                       company-tern
                       company-math
                       company-restclient))
      (use-package package
        :ensure t
        :demand t
        :init (add-to-list 'company-backends package)))

    ;; Use Helm to complete suggestions
    (bind-keys :map company-active-map
               ("\C-d" . company-show-doc-buffer)
               ("C-:" . helm-company))
    (bind-keys :map company-mode-map
               ("C-:" . helm-company))
    (setq company-echo-delay 0
          company-tooltip-minimum-width 30
          company-idle-delay nil)))

(Complete configs in:
https://github.com/whilp/dotfiles/blob/master/.emacs.d/lisp/init-dev.el
https://github.com/whilp/dotfiles/blob/master/.emacs.d/lisp/init-helm.el)

It seems as if helm-company-action-insert is failing to calculate the correct length to replace. I haven't found any other cases of this online, and I'm only making slow progress debugging it myself. Any ideas?

I have the same issue.