summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-04-06 14:39:08 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-04-06 14:39:08 +0800
commita0caef2adf7ad48c83d5300b486e0937d6890799 (patch)
treef5c7fff4d35eba286efbf9ead00b3de1e9c87ca8
parent65d80d31d4b679bb95eed8f002be7cf82ca18c94 (diff)
downloadlua-language-server-a0caef2adf7ad48c83d5300b486e0937d6890799.zip
fix #485
-rw-r--r--changelog.md1
-rw-r--r--script/core/completion.lua1
-rw-r--r--test/completion/init.lua7
3 files changed, 9 insertions, 0 deletions
diff --git a/changelog.md b/changelog.md
index 005cf51a..d70e8a19 100644
--- a/changelog.md
+++ b/changelog.md
@@ -3,6 +3,7 @@
## 1.20.3
`FIX` [#479](https://github.com/sumneko/lua-language-server/issues/479)
`FIX` [#483](https://github.com/sumneko/lua-language-server/issues/483)
+`FIX` [#485](https://github.com/sumneko/lua-language-server/issues/485)
## 1.20.2
`2021-4-2`
diff --git a/script/core/completion.lua b/script/core/completion.lua
index f710b953..b01699a6 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -1397,6 +1397,7 @@ local function tryCallArg(ast, text, offset, results)
end
local function tryTable(ast, text, offset, results)
+ offset = lookBackward.skipSpace(text, offset)
local source = findNearestSource(ast, offset)
if not source then
return
diff --git a/test/completion/init.lua b/test/completion/init.lua
index fb042fe9..c648d379 100644
--- a/test/completion/init.lua
+++ b/test/completion/init.lua
@@ -2506,3 +2506,10 @@ TEST [[
elseif $ then
]]
(nil)
+
+TEST [[
+---@type iolib
+local t = {
+ $
+]]
+(EXISTS)