|
From: | Dmitry Gutov |
Subject: | bug#13250: 24.3.50; Add a way to show pre-highlighted candidates in completions buffer |
Date: | Sat, 12 Jan 2013 07:45:55 +0400 |
User-agent: | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2 |
On 29.12.2012 9:29, Stefan Monnier wrote:
It would have to be a different function and metadata property, no?Could be.I don't think we can change annotation-function to return the candidate plus annotation, for example.Currently it can only return a string (which is combined with the completion into a cons cell), but we could let it return the cons cell directly. That wouldn't necessarily help with "annotations before" (and it wouldn't make sure that the annotations don't actually change the completions).
I decided not to do this for now, because it doesn't actually help in my case. Or maybe I just haven't encountered a bug that would be caused by the additional fontification (as long as I use 'face, not 'font-lock-face).
And the part below works the same, whether the base highlighting was added in the completion strings directly, or through the annotation function.
Speaking of "annotations before", I don't see how they can be used in the current interface. Showing the classes where the methods are defined would be good, but lining the candidates up vertically is important for visual scan-ability, and the "before strings" can be of different lengths.
So, AFAICT, the proper solution would be to walk the part of the string, look at every piece in it that has a different value of 'face, then where the value is a symbol, wrap it into a list, and then add the new face to the end of the lists. And repeat for the "first difference".Yes. Lars wanted to add a function that does just that, but you can use font-lock-prepend-text-property in the mean time.
Thanks, that was rather easy. I'm attaching a patch that fixes this bug's problem for me (letting the fontifications through), so maybe we should leave improvements to annotation function for later.
completions-hl.diff
Description: Text document
[Prev in Thread] | Current Thread | [Next in Thread] |