From 6daad9f42b8c3003a538a0667e5242536aa95eac Mon Sep 17 00:00:00 2001 From: sumneko Date: Wed, 24 Apr 2019 19:59:37 +0800 Subject: =?UTF-8?q?=E4=BF=9D=E8=AF=81=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/completion.lua | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'server/src/core') 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) -- cgit v1.2.3