summaryrefslogtreecommitdiff
path: root/script/proto
diff options
context:
space:
mode:
Diffstat (limited to 'script/proto')
-rw-r--r--script/proto/define.lua2
-rw-r--r--script/proto/proto.lua4
2 files changed, 5 insertions, 1 deletions
diff --git a/script/proto/define.lua b/script/proto/define.lua
index 713857af..2409f972 100644
--- a/script/proto/define.lua
+++ b/script/proto/define.lua
@@ -44,6 +44,7 @@ m.DiagnosticDefaultSeverity = {
['no-implicit-any'] = 'Information',
['deprecated'] = 'Warning',
['different-requires'] = 'Warning',
+ ['await-in-sync'] = 'Warning',
['type-check'] = 'Warning',
['duplicate-doc-class'] = 'Warning',
@@ -98,6 +99,7 @@ m.DiagnosticDefaultNeededFileStatus = {
['no-implicit-any'] = 'None',
['deprecated'] = 'Opened',
['different-requires'] = 'Any',
+ ['await-in-sync'] = 'None',
['type-check'] = 'None',
['duplicate-doc-class'] = 'Any',
diff --git a/script/proto/proto.lua b/script/proto/proto.lua
index e380f54f..d54c902f 100644
--- a/script/proto/proto.lua
+++ b/script/proto/proto.lua
@@ -68,6 +68,7 @@ function m.notify(name, params)
io.write(buf)
end
+---@async
function m.awaitRequest(name, params)
local id = reqCounter()
local buf = jsonrpc.encode {
@@ -120,7 +121,7 @@ function m.doMethod(proto)
if proto.id then
m.holdon[proto.id] = proto
end
- await.call(function ()
+ await.call(function () ---@async
--log.debug('Start method:', method)
if proto.id then
await.setID('proto:' .. proto.id)
@@ -146,6 +147,7 @@ function m.doMethod(proto)
end
end
ok, res = xpcall(abil, log.error, proto.params)
+ await.delay()
end)
end