elvish icon indicating copy to clipboard operation
elvish copied to clipboard

Add sorter API for completion candidates

Open xiaq opened this issue 5 years ago • 3 comments

Add an API for sorting completion candidates.

This can be a function that gets all candidates as inputs, and outputs an equal number of numbers, strings or lists. The outputs must be of the same type and are used for sorting the corresponding inputs.

The sorter is run separately for each different candidate type (#914).

xiaq avatar Feb 16 '20 17:02 xiaq

This is also related to #651.

xiaq avatar Feb 16 '20 17:02 xiaq

I'm sure I'm misunderstanding something, because I don't think it's practical to have a function that receives all candidates and returns numeric values for all of them. This would mean that the function needs to establish a total "order value" over the whole list, essentially sorting the list in the process! The scalability of a sorting algorithm comes from the fact that you only need to be able to determine the order among two elements at a time.

zzamboni avatar Feb 16 '20 20:02 zzamboni

It could also produce strings and lists.

xiaq avatar Feb 16 '20 22:02 xiaq