From 3f62ee8a93c91473de9a7e1b1612d148f92699a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 29 Sep 2021 21:02:24 +0800 Subject: #632 --- script/core/completion.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'script/core/completion.lua') diff --git a/script/core/completion.lua b/script/core/completion.lua index 58b87247..74017ec6 100644 --- a/script/core/completion.lua +++ b/script/core/completion.lua @@ -892,7 +892,7 @@ local function collectRequireNames(mode, myUri, literal, source, smark, position collect[info.expect] = { textEdit = { start = smark and (source.start + #smark) or position, - finish = smark and (source.start - #smark) or position, + finish = smark and (source.finish - #smark) or position, newText = smark and info.expect or util.viewString(info.expect), } } @@ -919,7 +919,7 @@ local function collectRequireNames(mode, myUri, literal, source, smark, position collect[open] = { textEdit = { start = smark and (source.start + #smark) or position, - finish = smark and (source.start - #smark) or position, + finish = smark and (source.finish - #smark) or position, newText = smark and open or util.viewString(open), } } @@ -945,7 +945,7 @@ local function collectRequireNames(mode, myUri, literal, source, smark, position collect[path] = { textEdit = { start = smark and (source.start + #smark) or position, - finish = smark and (source.start - #smark) or position, + finish = smark and (source.finish - #smark) or position, newText = smark and path or util.viewString(path), } } @@ -1759,6 +1759,8 @@ local function tryLuaDocBySource(state, position, source, results) } end end + elseif source.type == 'doc.module' then + collectRequireNames('require', state.uri, source.module or '', source, source.smark, position, results) end return false end -- cgit v1.2.3