From 7ab564aad9fe823ff90614b106853f05be001fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Fri, 29 Mar 2019 09:56:16 +0800 Subject: =?UTF-8?q?require=E7=9A=84=E8=87=AA=E5=8A=A8=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=E6=96=87=E4=BB=B6=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/core/completion.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'server/src/core') diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua index 16b2ad4c..adbac085 100644 --- a/server/src/core/completion.lua +++ b/server/src/core/completion.lua @@ -341,12 +341,13 @@ local function searchInRequire(vm, select, source, callback) if source.type ~= 'string' then return end - local list = vm.lsp.workspace:matchPath(vm.uri, source[1]) + local list, map = vm.lsp.workspace:matchPath(vm.uri, source[1]) if not list then return end for _, str in ipairs(list) do callback(str, nil, CompletionItemKind.File, { + documentation = map[str], textEdit = { -- TODO 坑爹自动完成的字符串里面不能包含符号 -- 这里长字符串会出问题,不过暂时先这样吧 @@ -361,7 +362,7 @@ end local function searchCallArg(vm, source, word, callback, pos) local results = {} for _, src in ipairs(vm.sources) do - if src.type == 'call' + if src.type == 'call' and src.start <= pos and src.finish >= pos then -- cgit v1.2.3