-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Is it possible to show annotations in icomplete-vertical? #16
Comments
As far as I know there is currently no support for annotations in icomplete. It probably isn't hard to add though. I think I would try propertizing the completion candidates to display the annotations. That way they would be visible, but not affect completion. As far as I know, the annotations built-in to Emacs are all very short, only 1-3 characters. Even (horizontal) icomplete should probably show those. I'm guessing consult uses longer annotations, those should probably only be shown in icomplete-vertical. Maybe in the future Emacs should even have separate metadata functions for short and long annotations. The completions buffer and icomplete could show the short ones, and things like icomplete-vertical or the new detailed view in the completions buffer could show the longer annotations. |
To an extent, but not always. For example, Emacs 28 has started showing command aliases and key bindings during In addition to annotations, there exist now also "affixations", which can get quite large; see abo-abo/swiper#2732 for an example. Finally, HTH. |
@oantolin @basil-conto Thank you!
It would be nice if there would be some standard for this. Note that selectrum already defines a few annotation properties which could be replaced with more standard ones.
Yes that would be a possibility. But I hope more that it is possible to somehow unify/simplify things in the Emacs completion system. The affixation function unifies some things but also adds complexity. |
That is what I meant by "the new detailed view": I had forgotten the actual name of the format. |
I've added initial support to display annotations in commit 272e525. I have a few questions about possible refinements:
|
I just discussed this with @clemera in radian-software/selectrum#250 and we decided there to not add a face if there is already a face present in the string returned by the annotation-function. Otherwise add a face, selectrum uses its own face derived from completions-annotations. But you could also use completions-annotations directly I guess. |
I used to add the face using |
I think it is okay to use My approach is this:
|
Thanks @protesilaos! I'll stick with |
Please help me understand this "merge" better (I believe I use it elsewhere but need to be sure). The text-to-be-annotated has some properties and those get combined with Is that the gist of it? If so, you would need to check whether that "merging" can lead to problems (maybe with size and spacing, in the case of distinct font families). If not, then it sounds good for now. |
That is also what I understand merging face attributes does. (You mention the "text-to-be-annotated", but it is more accurate to say we are discussing the "text-of-the-annotation".) You can merge in either order. What you described, which is We definitely don't want |
The choice @clemera took in selectrum is to not merge if there are faces already present in the annotation string. Our interpretation of this is somehow that the annotation function takes control over the face if faces are in the string. This is much better for example for the marginalia-annotate-faces function, which would get messed up if you merge. It makes sense though to add the completions-annotations face if no face is present in the annotation string, as a default annotation face. |
Yep, I just came to the same conclusion after trying it both ways: don't merge, only apply face if none present. I'll push commits to that effect both here and to embark in a minute. Done! 94684cc |
Cool! It is great if the two completion systems are consistent here! |
@oantolin I tested this with marginalia-mode. Works great! I guess we can close this! |
I am working on https://github.com/minad/consult and would like to make it compatible with icomplete-vertical. Consult overwrites some annotation functions. The provided annotation however are only shown in the Completions buffer, but not in the icomplete minibuffer. Is there are possibility to make this work? Is there support for annotations in icomplete?
The text was updated successfully, but these errors were encountered: