minad / corfu

:desert_island: corfu.el - COmpletion in Region FUnction
GNU General Public License v3.0
1.06k stars 42 forks source link

Ensuring spacing between candidates and their annotations #382

Closed LemonBreezes closed 8 months ago

LemonBreezes commented 8 months ago

Hi. So I PR'd a fix to Yasnippet Capf (https://github.com/elken/yasnippet-capf/pull/16) addressing the lack of spacing between candidates and their annotations image I did so by concatenating two spaces to the annotations: image which is similar to what Company Yasnippet does when company-tooltip-align-annotations is nil: image @elken is suggesting that Corfu should do this instead so I'm wondering what you think about that and specifically whether you would add that.

I'm thinking that it's not a good idea for Corfu to add spacing since other capfs like Company Yasnippet and Pcmpl Args already manage that: image image So I wanted you to hear what you think.

minad commented 8 months ago

Hi, by definition the :annotation-function or :affixation-function should already return a string with a leading space.

elken commented 8 months ago

Hi, by definition the :annotation-function or :affixation-function should already return a string with a leading space.

Is this documented anywhere? There's no such claim in the manual

minad commented 8 months ago

Is this documented anywhere? There's no such claim in the manual

Emacs is not specified well if you look at the fine details. Nevertheless it is a de factor definition. :annotation-function is defined by the default completion UI and the UI does not add any space. Neither does Vertico or any other UI.

elken commented 8 months ago

Emacs cruft once again...

minad commented 8 months ago

Not really. It seems actually reasonable to not add a space. Think for example about affixation-functions which want to add icons just right in front of the candidates.

elken commented 8 months ago

You'd still want the gap between the the candidate and the annotation, but this is moot anyway

minad commented 8 months ago

No, not in every case, like for example icons.

minad commented 8 months ago

I also imagine that in some special cases one would want something like candidate(1), where (1) is supplied by the annotation function. Anyway, even if the you disagree with the choice to not add a space, it would be unnecessary work to change this now. I mean we are not talking about a fundamental design flaw. It is just a fine detail.