summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
authorNeOzay <colpaert.benoit@gmail.com>2024-09-06 17:32:36 +0200
committerNeOzay <colpaert.benoit@gmail.com>2024-09-06 17:32:36 +0200
commit76b3927c1c4574a64d3e56368753e429a912de75 (patch)
tree47d6ca3382e3945c07156514cd7141c4e5276d6b /script
parentc9d819305b6f88b53de294d54c820681518430c8 (diff)
downloadlua-language-server-76b3927c1c4574a64d3e56368753e429a912de75.zip
fix autocompletion
Diffstat (limited to 'script')
-rw-r--r--script/core/completion/completion.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/script/core/completion/completion.lua b/script/core/completion/completion.lua
index 866d6590..43b5d5ce 100644
--- a/script/core/completion/completion.lua
+++ b/script/core/completion/completion.lua
@@ -78,7 +78,9 @@ local function findNearestSource(state, position)
---@type parser.object
local source
guide.eachSourceContain(state.ast, position, function (src)
- source = src
+ if not source or source.start <= src.start then
+ source = src
+ end
end)
return source
end