diff options
author | NeOzay <colpaert.benoit@gmail.com> | 2024-07-28 18:30:02 +0200 |
---|---|---|
committer | NeOzay <colpaert.benoit@gmail.com> | 2024-07-28 18:30:02 +0200 |
commit | df9db56b148f8ab242d35f7d4e2b91cd2ba02668 (patch) | |
tree | cb624ab7bb295cec047e2742350c05783074e3fd | |
parent | 9035afd4b4fb548c2d88c0a4e3ec566cb0c2cc11 (diff) | |
download | lua-language-server-df9db56b148f8ab242d35f7d4e2b91cd2ba02668.zip |
compute table keys once
-rw-r--r-- | script/core/diagnostics/missing-fields.lua | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/script/core/diagnostics/missing-fields.lua b/script/core/diagnostics/missing-fields.lua index d332b091..5ce650ec 100644 --- a/script/core/diagnostics/missing-fields.lua +++ b/script/core/diagnostics/missing-fields.lua @@ -35,7 +35,8 @@ return function (uri, callback) return end end - + + local myKeys local warnings = {} for className, samedefs in pairs(sortedDefs) do local missedKeys = {} @@ -43,12 +44,14 @@ return function (uri, callback) if not def.fields or #def.fields == 0 then goto continue end - - local myKeys = {} - for _, field in ipairs(src) do - local key = vm.getKeyName(field) or field.tindex - if key then - myKeys[key] = true + + if not myKeys then + myKeys = {} + for _, field in ipairs(src) do + local key = vm.getKeyName(field) or field.tindex + if key then + myKeys[key] = true + end end end |