summaryrefslogtreecommitdiff
path: root/server/src
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-07 09:29:54 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-07 09:29:54 +0800
commit01b0740d251a7fd62a64c1443ba969c95c55c3ab (patch)
treebfaede85e3a31dd9f5ed82d493bee26ae8d07166 /server/src
parentf440d6c1a75b4d6fefcc40cf35cca74e8ec52271 (diff)
downloadlua-language-server-01b0740d251a7fd62a64c1443ba969c95c55c3ab.zip
require的自动完成可以显示全名了
Diffstat (limited to 'server/src')
-rw-r--r--server/src/core/completion.lua12
1 files changed, 7 insertions, 5 deletions
diff --git a/server/src/core/completion.lua b/server/src/core/completion.lua
index 07b46402..8fe3888e 100644
--- a/server/src/core/completion.lua
+++ b/server/src/core/completion.lua
@@ -257,11 +257,13 @@ local function searchInArg(vm, inCall, inString, callback)
end
for _, v in ipairs(results) do
if v ~= inString[1] then
- local sep = inString[1]:find('[^%w_][%w_]-$')
- if sep then
- v = v:sub(sep+1)
- end
- callback(v, CompletionItemKind.File)
+ callback(v, CompletionItemKind.File, {
+ textEdit = {
+ start = inString.start+1,
+ finish = inString.finish-1,
+ newText = ('%q'):format(v):sub(2, -2),
+ }
+ })
end
end
end