From 70a1987cf7fc25abc355173eac87bd25f3e8cf41 Mon Sep 17 00:00:00 2001 From: Stuart Quin Date: Wed, 10 Aug 2016 08:28:33 +0100 Subject: [PATCH] Sort commands before autocomplete --- lib/autocomplete.coffee | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/autocomplete.coffee b/lib/autocomplete.coffee index 7f8608f..8dcb910 100644 --- a/lib/autocomplete.coffee +++ b/lib/autocomplete.coffee @@ -34,7 +34,7 @@ class AutoComplete return @getCompletion(() => @getCommandCompletion(cmd)) filterByPrefix: (commands, prefix) -> - commands.filter((f) => f.startsWith(prefix)) + commands.sort().filter((f) => f.startsWith(prefix)) getCompletion: (completeFunc) -> if @completions.length == 0 @@ -51,8 +51,7 @@ class AutoComplete return complete getCommandCompletion: (command) -> - if @completions.length == 0 - return @filterByPrefix(@commands, command) + return @filterByPrefix(@commands, command) getFilePathCompletion: (command, filePath) -> filePath = @expandTilde(filePath)