summaryrefslogtreecommitdiff
path: root/server/src/core
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2019-04-24 19:59:37 +0800
committersumneko <sumneko@hotmail.com>2019-04-24 19:59:37 +0800
commit6daad9f42b8c3003a538a0667e5242536aa95eac (patch)
treededacbeffcd592fdaf565b82643dd86208463fed /server/src/core
parentdb2de7238fb92269b7ad6aca8a35f82e01eaa126 (diff)
downloadlua-language-server-6daad9f42b8c3003a538a0667e5242536aa95eac.zip
保证顺序
Diffstat (limited to 'server/src/core')
-rw-r--r--server/src/core/completion.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua
index 3d8a47e0..f3e811a1 100644
--- a/server/src/core/completion.lua
+++ b/server/src/core/completion.lua
@@ -399,11 +399,18 @@ local function searchEmmyKeyword(vm, source, word, callback)
end
local function searchEmmyClass(vm, source, word, callback)
+ local classes = {}
vm.emmyMgr:eachClass(function (class)
if matchKey(word, class:getName()) then
- callback(class:getName(), class:getSource(), CompletionItemKind.Class)
+ classes[#classes+1] = class
end
end)
+ table.sort(classes, function (a, b)
+ return a:getName() < b:getName()
+ end)
+ for _, class in ipairs(classes) do
+ callback(class:getName(), class:getSource(), CompletionItemKind.Class)
+ end
end
local function searchSource(vm, source, word, callback)