From 5781f2a991da34c47b0b65b3d94b75f96a92c4ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 8 Jul 2019 10:03:41 +0800 Subject: =?UTF-8?q?emmy=E6=94=AF=E6=8C=81=20require=20=E7=9A=84=E7=89=B9?= =?UTF-8?q?=E6=AE=8A=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/completion.lua | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'server/src/core/completion.lua') diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua index 6ab3c565..45e1ab4f 100644 --- a/server/src/core/completion.lua +++ b/server/src/core/completion.lua @@ -599,10 +599,7 @@ local function buildTextEdit(start, finish, str, quo) } end -local function searchInRequire(vm, select, source, callback) - if select ~= 1 then - return - end +local function searchInRequire(vm, source, callback) if not vm.lsp or not vm.lsp.workspace then return end @@ -659,7 +656,9 @@ local function searchEnumAsLib(vm, source, word, callback, pos, args, lib) -- 搜索特殊函数 if lib.special == 'require' then - searchInRequire(vm, select, source, callback) + if select == 1 then + searchInRequire(vm, source, callback) + end end end @@ -704,6 +703,11 @@ local function searchEnumAsEmmyParams(vm, source, word, callback, pos, args, fun end end end) + + local option = param:getOption() + if option and option.special == 'require:1' then + searchInRequire(vm, source, callback) + end end local function getSelect(args, pos) -- cgit v1.2.3