You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Learn from PowerShell/Nushell, don't sort of the generated completions. For built-in completion lists such as filepath, when generating a list, ensure that it is already sorted.
If it is difficult to implement the above requirement due to compatibility or architecture, at least add a sort field to the candidate object.
I also came across this issue today, my use case is that I want to show the most recently updated files at first when listing (e.g. ls <tab>), although I could achieve this by ls -tr but it would be more convenient if listing mode could support this by default.
Background
All mainstream shells allow users to control the order of completions.
Shells that have the option to control order
complete -F _mycmd_completer -o nosort mycmd
/-o nosort
complete -x -k -c mycmd -a "(_mycmd_completer)"
/-k
_describe "" displays values -Q -S '' -o nosort
/-o nosort
Shells that preserve the order of the generated completions
It is necessary to follow this convention in Elvish.
Problem
Elvish doesn't provide an option to control the order of completions, but it automatically sorts completions. That's the problem.
Related issues: #525 #580 #915
Suggestion
Learn from PowerShell/Nushell, don't sort of the generated completions. For built-in completion lists such as filepath, when generating a list, ensure that it is already sorted.
If it is difficult to implement the above requirement due to compatibility or architecture, at least add a
sort
field to the candidate object.The text was updated successfully, but these errors were encountered: