diff options
author | Kevin Hahn <hahn.kev@gmail.com> | 2022-08-01 23:32:13 +0700 |
---|---|---|
committer | Kevin Hahn <hahn.kev@gmail.com> | 2022-08-02 10:07:22 +0700 |
commit | b3589ccaaa3729ff8d2c05142a4a1bb2c847522f (patch) | |
tree | b80dc1311fbbe40685f6edda20f5037db0f3e202 /script/vm | |
parent | eecbfae0e6d846f20bc836b5ee8a706501b2db40 (diff) | |
download | lua-language-server-b3589ccaaa3729ff8d2c05142a4a1bb2c847522f.zip |
allow table fields assigned to local functions to show as functions in autocomplete
Diffstat (limited to 'script/vm')
-rw-r--r-- | script/vm/vm.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/script/vm/vm.lua b/script/vm/vm.lua index 8117d311..b9eccfa3 100644 --- a/script/vm/vm.lua +++ b/script/vm/vm.lua @@ -64,6 +64,20 @@ function m.getObjectValue(source) return nil end +---@param source parser.object +---@return parser.object? +function m.getObjectFunctionValue(source) + local value = m.getObjectValue(source) + if value == nil then return end + if value.type == 'function' or value.type == 'doc.type.function' then + return value + end + if value.type == 'getlocal' then + return m.getObjectFunctionValue(value.node) + end + return nil +end + m.cacheTracker = setmetatable({}, weakMT) function m.flushCache() |