summaryrefslogtreecommitdiff
path: root/script/vm
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-02 16:45:47 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-02 16:45:47 +0800
commita1fc6ac2f84804d3dbbde2ce5df02907f496ce7f (patch)
tree7faa006ae45ed200b63a09782eba366608141b8c /script/vm
parentd7e96432ccd7f736c0f269ccca68cf4b840927db (diff)
downloadlua-language-server-a1fc6ac2f84804d3dbbde2ce5df02907f496ce7f.zip
#687
Diffstat (limited to 'script/vm')
-rw-r--r--script/vm/getDocs.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua
index 2fb2bda9..260d2281 100644
--- a/script/vm/getDocs.lua
+++ b/script/vm/getDocs.lua
@@ -163,6 +163,23 @@ local function isDeprecated(value)
return false
end
+local function isAsync(value)
+ if not value.bindDocs then
+ return false
+ end
+ if value._async ~= nil then
+ return value._async
+ end
+ for _, doc in ipairs(value.bindDocs) do
+ if doc.type == 'doc.async' then
+ value._async = true
+ return true
+ end
+ end
+ value._async = false
+ return false
+end
+
function vm.isDeprecated(value, deep)
if deep then
local defs = vm.getDefs(value)
@@ -180,6 +197,23 @@ function vm.isDeprecated(value, deep)
end
end
+function vm.isAsync(value, deep)
+ if deep then
+ local defs = vm.getDefs(value)
+ if #defs == 0 then
+ return false
+ end
+ for _, def in ipairs(defs) do
+ if not isAsync(def) then
+ return false
+ end
+ end
+ return true
+ else
+ return isAsync(value)
+ end
+end
+
local function makeDiagRange(uri, doc, results)
local names
if doc.names then