On 17.08.2021 10:20, João Távora wrote:
> It is composable, in fact it's inside some "compose-flex-sort-fn` helper
> function to take into account the table's sorting.
>
> if you mean the problem of code duplication, however, then I also agree.
> See the FIXMEs explaining the situation.
>
> If you mean something else, please clarify.
It does "compose" things, but it makes all the decisions, so it's
impossible to control from the outside.
I guess you could add a variable or two there, but the way it works is by design.
One of the things I'd like to do is to sort taking into account both
flex sorting and the previous occurrences of the completions in the
buffer (by adding the scores together, or somehow else combining them).
That sounds interesting, maybe it's a good idea for a new completion style, which may share some code, maybe a lot of code, with flex.
I see there are other possible uses described in bug#45260. Perhaps this
discussion could move there.
Put me in Cc, if you want.
But what I imagined is some middle layer above the completion styles
which would do the sorting. The above discussion is based on the
existing practice, however, where the tables provide the sorting logic
(and not, say, sorting scores which can be combined somewhere else).
Sounds interesting.
João