summaryrefslogtreecommitdiff
path: root/script/core/completion.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-09-29 21:02:24 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-09-29 21:02:24 +0800
commit3f62ee8a93c91473de9a7e1b1612d148f92699a1 (patch)
treed4cf8eedf75180ea0ed23730f67a0b3f55e4d218 /script/core/completion.lua
parent3a3041e820b5c6aa9088e642387ae5f7b99f2a64 (diff)
downloadlua-language-server-3f62ee8a93c91473de9a7e1b1612d148f92699a1.zip
#632
Diffstat (limited to 'script/core/completion.lua')
-rw-r--r--script/core/completion.lua8
1 files changed, 5 insertions, 3 deletions
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