summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--changelog.md1
-rw-r--r--script/core/completion/completion.lua4
2 files changed, 4 insertions, 1 deletions
diff --git a/changelog.md b/changelog.md
index 4d5061af..cd566573 100644
--- a/changelog.md
+++ b/changelog.md
@@ -8,6 +8,7 @@
* `FIX` Fix `VM.OnCompileFunctionParam` function in plugins
* `FIX` Lua 5.1: fix incorrect warning when using setfenv with an int as first parameter
* `FIX` Improve type narrow by checking exact match on literal type params
+* `FIX` Correctly list enums for function overload arguments [#2840](https://github.com/LuaLS/lua-language-server/pull/2840)
* `FIX` Incorrect function params' type infer when there is only `@overload` [#2509](https://github.com/LuaLS/lua-language-server/issues/2509) [#2708](https://github.com/LuaLS/lua-language-server/issues/2708) [#2709](https://github.com/LuaLS/lua-language-server/issues/2709)
## 3.10.5
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