abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.3k stars 338 forks source link

[Feature request] align annotation in ivy-completion-in-region #2627

Open BooAA opened 4 years ago

BooAA commented 4 years ago

This is both a feature request and maybe a bug report, if this has no relation with ivy or might be error prone/ad-hoc to be added in ivy, feel free to close this issue directly. There are some completion backend providing additional annotation (like frequency, function prototype, data type, etc), which I found ivy cannot handle some of them properly. For instance,

Case 1 : testing with eglot + clangd, the annotation was displayed under each candidate Screenshot from 2020-06-28 16-34-01

If you want to try out yourself, this is how I work in Debian/testing, with Emacs 28

0. Install clangd by sudo apt install clangd 1. In Emacs, setup eglot by

(use-package eglot
  :commands eglot)

2. Open any C/C++ project, and M-x eglot. With the prompt, type clangd to choose it as language server (default should be ccls)

Case 2 : testing with sly, the annotation is appended after each candidate, without space as delimiter to separate them. Screenshot from 2020-06-28 16-38-31

0 Install sly in Emacs by M-x package-install sly 1 Setup sly by

(use-package sly
  :custom ((inferior-lisp-program "sbcl") ;; replace with any CL implementation you like
           (sly-symbol-completion-mode nil)) ;; avoid sly using its own completion UI
  :commands sly)

2 Open any Common Lisp file or project, then M-x sly, type something and C-M-i.

Above is just 2 cases I use daily, there are also many language servers/completion backend providing additional annotation or metadata through Emacs completion-at-point API, so IMHO it might be a good idea for ivy-completion-in-region and ivy-overlay to take care of these information and format them properly.

In contrast, I found company with (setq company-tooltip-align-annotations t) display the result pretty well, so I think company-capf might be a good reference. (feel free to ignore this if it has no relation with how ivy-completion-in-region collect candidates, since I'm neither a Emacs expert nor an elisp programmer)

basil-conto commented 8 months ago

Sorry for the very late response. Do you still see these issues? Or might they have been fixed in the meantime?

basil-conto commented 8 months ago

[ Note that the way annotations/affixations are handled in Ivy was just improved in commit 12803ed607cebc8bf3f389daa85bf51e003b1014. ]