diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2024-09-09 11:39:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-09 11:39:31 +0800 |
commit | a126e9c4850726f86d8480aacbb8ec23c1b158ef (patch) | |
tree | 4d10fc7ce75ff7ea13f46a90608574e66fed121c | |
parent | d1320ae5e41086fd9f569c2504a88130447444b8 (diff) | |
parent | 7784a06294c4ced20444ab258ca09833bb6b0f7e (diff) | |
download | lua-language-server-a126e9c4850726f86d8480aacbb8ec23c1b158ef.zip |
Fix correctly display enums for function overload arguments
-rw-r--r-- | changelog.md | 1 | ||||
-rw-r--r-- | script/core/completion/completion.lua | 4 |
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 |