summaryrefslogtreecommitdiff
path: root/server-beta
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-09-23 10:00:21 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-09-23 10:00:21 +0800
commitce6c767448b82dc26faf06e2956f5327aebd8f5e (patch)
tree488544ea06e33f16a06d8a91da329e3b4a8702ee /server-beta
parent6a12587f892138899ff230396e561e44f5dc7096 (diff)
downloadlua-language-server-ce6c767448b82dc26faf06e2956f5327aebd8f5e.zip
好像把同步与异步理解反了
Diffstat (limited to 'server-beta')
-rw-r--r--server-beta/src/files.lua4
-rw-r--r--server-beta/src/pub/pub.lua14
2 files changed, 9 insertions, 9 deletions
diff --git a/server-beta/src/files.lua b/server-beta/src/files.lua
index 6cd59799..0096e055 100644
--- a/server-beta/src/files.lua
+++ b/server-beta/src/files.lua
@@ -36,7 +36,7 @@ function m.setText(uri, text)
if file.compiling then
pub.removeTask(file.compiling)
end
- file.compiling = pub.asyncTask('compile', text, function (ast)
+ file.compiling = pub.syncTask('compile', text, function (ast)
file.ast = ast
file.compiling = nil
local onCompiledList = file.onCompiledList
@@ -76,7 +76,7 @@ function m.getText(uri)
return file.text
end
---- 获取文件语法树(同步)
+--- 获取文件语法树(异步)
function m.getAst(uri)
if platform.OS == 'Windows' then
uri = uri:lower()
diff --git a/server-beta/src/pub/pub.lua b/server-beta/src/pub/pub.lua
index 68c25ba7..8fc6f2b2 100644
--- a/server-beta/src/pub/pub.lua
+++ b/server-beta/src/pub/pub.lua
@@ -70,8 +70,8 @@ function m.pushTask(brave, info)
end)
end
---- 给勇者推送任务(异步)
-function m.pushAsyncTask(brave, info)
+--- 给勇者推送任务(同步)
+function m.pushSyncTask(brave, info)
if info.removed then
return
end
@@ -104,7 +104,7 @@ function m.popReport(brave, name, params)
abil(params, brave)
end
---- 发布任务(同步)
+--- 发布任务(异步)
---@parma name string
---@param params any
function m.task(name, params)
@@ -124,12 +124,12 @@ function m.task(name, params)
m.taskQueue[#m.taskQueue+1] = info
end
---- 发布异步任务,如果任务进入了队列,会返回执行器
+--- 发布同步任务,如果任务进入了队列,会返回执行器
---|通过 jumpQueue 可以插队
---@parma name string
---@param params any
---@param callback function
-function m.asyncTask(name, params, callback)
+function m.syncTask(name, params, callback)
local info = {
id = counter(),
name = name,
@@ -138,7 +138,7 @@ function m.asyncTask(name, params, callback)
}
for _, brave in ipairs(m.braves) do
if m.isIdle(brave) then
- m.pushAsyncTask(brave, info)
+ m.pushSyncTask(brave, info)
return nil
end
end
@@ -183,7 +183,7 @@ function m.checkWaitingTask(brave)
end
local info = table.remove(m.taskQueue, 1)
if info.callback then
- m.pushAsyncTask(brave, info)
+ m.pushSyncTask(brave, info)
else
m.pushTask(brave, info)
end