diff options
author | Tom Lau <tomandfatboy@gmail.com> | 2024-07-01 09:40:16 +0800 |
---|---|---|
committer | Tom Lau <tomandfatboy@gmail.com> | 2024-07-01 09:40:16 +0800 |
commit | cad34b796b14c1e9d9ae062339d7e9d4cd18cc22 (patch) | |
tree | 9e8e9f9b741b54ec9e5ab5c84deeecfca82bd673 /script/core/diagnostics | |
parent | fea3b6d81ace6a23bf990602731ba31902c26375 (diff) | |
download | lua-language-server-cad34b796b14c1e9d9ae062339d7e9d4cd18cc22.zip |
perf: Optimize undefined-field check early break logic
The current early break only wants to check if there are any definition.
There is no need to fetch the full definitions list.
We can early break as soon as we found the 1st one.
Diffstat (limited to 'script/core/diagnostics')
-rw-r--r-- | script/core/diagnostics/undefined-field.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/script/core/diagnostics/undefined-field.lua b/script/core/diagnostics/undefined-field.lua index 4fd55966..ab5d4d54 100644 --- a/script/core/diagnostics/undefined-field.lua +++ b/script/core/diagnostics/undefined-field.lua @@ -21,7 +21,7 @@ return function (uri, callback) local function checkUndefinedField(src) await.delay() - if #vm.getDefs(src) > 0 then + if vm.hasDef(src) then return end local node = src.node |