summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-08 16:55:44 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-08 16:55:44 +0800
commitae8ce1e4d975d6aefc947a008ed8a82eec1312d3 (patch)
tree607249c561690e82f2dd0db01121472e957aa452 /script
parent96946f4022a45519fa4e512c652d322cf8232a73 (diff)
downloadlua-language-server-ae8ce1e4d975d6aefc947a008ed8a82eec1312d3.zip
cleanup
Diffstat (limited to 'script')
-rw-r--r--script/await.lua1
-rw-r--r--script/core/completion.lua4
-rw-r--r--script/filewatch.lua1
-rw-r--r--script/glob/gitignore.lua1
-rw-r--r--script/proto/proto.lua1
-rw-r--r--script/provider/provider.lua1
-rw-r--r--script/vm/getDocs.lua3
7 files changed, 12 insertions, 0 deletions
diff --git a/script/await.lua b/script/await.lua
index cea5667b..d8b9ef38 100644
--- a/script/await.lua
+++ b/script/await.lua
@@ -39,6 +39,7 @@ function m.checkResult(co, ...)
end
--- 创建一个任务
+---@param callback async fun()
function m.call(callback, ...)
local co = coroutine.create(callback)
local closers = {}
diff --git a/script/core/completion.lua b/script/core/completion.lua
index b7de7578..e67ca168 100644
--- a/script/core/completion.lua
+++ b/script/core/completion.lua
@@ -31,6 +31,8 @@ local DiagnosticModes = {
local stackID = 0
local stacks = {}
+
+---@param callback async fun()
local function stack(callback)
stackID = stackID + 1
stacks[stackID] = callback
@@ -41,6 +43,7 @@ local function clearStack()
stacks = {}
end
+---@async
local function resolveStack(id)
local callback = stacks[id]
if not callback then
@@ -2118,6 +2121,7 @@ local function completion(uri, position, triggerCharacter)
return results
end
+---@async
local function resolve(id)
local item = resolveStack(id)
local cache = workspace.getCache 'completion'
diff --git a/script/filewatch.lua b/script/filewatch.lua
index 17a0548b..28f7376f 100644
--- a/script/filewatch.lua
+++ b/script/filewatch.lua
@@ -27,6 +27,7 @@ function m.watch(path)
end
end
+---@param callback async fun()
function m.event(callback)
m._eventList[#m._eventList+1] = callback
end
diff --git a/script/glob/gitignore.lua b/script/glob/gitignore.lua
index 73e20cbf..3f7c564f 100644
--- a/script/glob/gitignore.lua
+++ b/script/glob/gitignore.lua
@@ -163,6 +163,7 @@ function mt:getRelativePath(path)
return path
end
+---@param callback async fun()
function mt:scan(path, callback)
local files = {}
if type(callback) ~= 'function' then
diff --git a/script/proto/proto.lua b/script/proto/proto.lua
index d54c902f..66f7d810 100644
--- a/script/proto/proto.lua
+++ b/script/proto/proto.lua
@@ -22,6 +22,7 @@ function m.getMethodName(proto)
end
end
+---@param callback async fun()
function m.on(method, callback)
m.ability[method] = callback
end
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 36752d88..e7c493b4 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -489,6 +489,7 @@ proto.on('textDocument/completion', function (params) ---@async
}
end)
+---@async
proto.on('completionItem/resolve', function (item)
local core = require 'core.completion'
if not item.data then
diff --git a/script/vm/getDocs.lua b/script/vm/getDocs.lua
index 748d17c2..ff6e6ba3 100644
--- a/script/vm/getDocs.lua
+++ b/script/vm/getDocs.lua
@@ -257,6 +257,9 @@ function vm.isNoDiscard(value, deep)
end
local function isCalledInFunction(param)
+ if not param.ref then
+ return false
+ end
local func = guide.getParentFunction(param)
for _, ref in ipairs(param.ref) do
if ref.type == 'getlocal' then