summaryrefslogtreecommitdiff
path: root/server/src/core/completion.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-07-08 10:03:41 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-07-08 10:03:41 +0800
commit5781f2a991da34c47b0b65b3d94b75f96a92c4ca (patch)
tree196a04e1c5fdc689edac13fdb123e1ec8144956d /server/src/core/completion.lua
parentaed744d56a684a2b014e6fcc88ecbdde9833c929 (diff)
downloadlua-language-server-5781f2a991da34c47b0b65b3d94b75f96a92c4ca.zip
emmy支持 require 的特殊处理
Diffstat (limited to 'server/src/core/completion.lua')
-rw-r--r--server/src/core/completion.lua14
1 files changed, 9 insertions, 5 deletions
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)