Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for issue #2805 by using company-finish on counsel-company. #2835

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions counsel.el
Original file line number Diff line number Diff line change
Expand Up @@ -369,25 +369,15 @@ Update the minibuffer with the amount of lines collected every
(company-mode 1)
(unless company-candidates
(company-complete))
(let ((len (cond ((let (l)
(and company-common
(string= company-common
(buffer-substring
(- (point) (setq l (length company-common)))
(point)))
l)))
(company-prefix
(length company-prefix)))))
(when len
(setq ivy-completion-beg (- (point) len))
(setq ivy-completion-end (point))
(ivy-read "Candidate: " company-candidates
:action #'ivy-completion-in-region-action
:caller 'counsel-company))))
(company--continue)
(when company-candidates
(ivy-read "Candidate: " company-candidates
:action 'company-finish
:caller 'counsel-company)))

(ivy-configure 'counsel-company
:display-transformer-fn #'counsel--company-display-transformer
:unwind-fn #'company-abort)
:unwind-fn (lambda() (unless ivy-exit (company-abort))))

(defun counsel--company-display-transformer (s)
(concat s (let ((annot (company-call-backend 'annotation s)))
Expand Down