From ee07ad02720ea8e36f08e1f7981d2b41cb7e9f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Tue, 10 Dec 2019 14:25:40 +0800 Subject: =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E5=8C=96=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- script-beta/core/completion.lua | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'script-beta/core') diff --git a/script-beta/core/completion.lua b/script-beta/core/completion.lua index 8e7dfdf9..2dae0b90 100644 --- a/script-beta/core/completion.lua +++ b/script-beta/core/completion.lua @@ -74,11 +74,12 @@ end local function checkLocal(ast, word, offset, results) local locals = guide.getVisibleLocals(ast.ast, offset) - for name in pairs(locals) do + for name, source in pairs(locals) do if matchKey(word, name) then results[#results+1] = { - label = name, - kind = ckind.Variable, + label = name, + kind = ckind.Variable, + detail = getLabel(source), } end end @@ -146,12 +147,14 @@ end local function checkLibrary(ast, text, word, offset, results) for name, lib in pairs(library.global) do if matchKey(word, name) then - buildFunction(results, lib, false, { - label = name, - kind = ckind.Function, - documentation = lib.description, - detail = getLabel(lib), - }) + if lib.type == 'function' then + buildFunction(results, lib, false, { + label = name, + kind = ckind.Function, + documentation = lib.description, + detail = getLabel(lib), + }) + end end end end -- cgit v1.2.3