Sort commands before autocomplete

This commit is contained in:
Stuart Quin 2016-08-10 08:28:33 +01:00
parent 6f03cd8bc7
commit 70a1987cf7

View file

@ -34,7 +34,7 @@ class AutoComplete
return @getCompletion(() => @getCommandCompletion(cmd)) return @getCompletion(() => @getCommandCompletion(cmd))
filterByPrefix: (commands, prefix) -> filterByPrefix: (commands, prefix) ->
commands.filter((f) => f.startsWith(prefix)) commands.sort().filter((f) => f.startsWith(prefix))
getCompletion: (completeFunc) -> getCompletion: (completeFunc) ->
if @completions.length == 0 if @completions.length == 0
@ -51,8 +51,7 @@ class AutoComplete
return complete return complete
getCommandCompletion: (command) -> getCommandCompletion: (command) ->
if @completions.length == 0 return @filterByPrefix(@commands, command)
return @filterByPrefix(@commands, command)
getFilePathCompletion: (command, filePath) -> getFilePathCompletion: (command, filePath) ->
filePath = @expandTilde(filePath) filePath = @expandTilde(filePath)