summaryrefslogtreecommitdiff
path: root/test/tclient
diff options
context:
space:
mode:
authorsumneko <sumneko@hotmail.com>2022-01-22 05:48:53 +0800
committersumneko <sumneko@hotmail.com>2022-01-22 05:48:53 +0800
commit37d33caad5eca02ffa3ac0608ccfe13468bdd22e (patch)
treea481bde0654d8dcbdd8c54c000296e52f7ba29fb /test/tclient
parent877306a927b098e25853f38ea792dd5ee663bbfd (diff)
downloadlua-language-server-37d33caad5eca02ffa3ac0608ccfe13468bdd22e.zip
use async loadFile
Diffstat (limited to 'test/tclient')
-rw-r--r--test/tclient/lclient.lua19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/tclient/lclient.lua b/test/tclient/lclient.lua
index fa94481f..166add42 100644
--- a/test/tclient/lclient.lua
+++ b/test/tclient/lclient.lua
@@ -3,6 +3,7 @@ local util = require 'utility'
local proto = require 'proto'
local await = require 'await'
local timer = require 'timer'
+local pub = require 'pub'
require 'provider'
@@ -36,6 +37,23 @@ function mt:_flushServer()
files.reset()
end
+function mt:_localLoadFile()
+ local awaitTask = pub.awaitTask
+ ---@async
+ ---@param name string
+ ---@param params any
+ pub.awaitTask = function (name, params)
+ if name == 'loadFile' then
+ local path = params
+ return util.loadFile(path)
+ end
+ return awaitTask(name, params)
+ end
+ self:gc(function ()
+ pub.awaitTask = awaitTask
+ end)
+end
+
---@async
function mt:initialize(params)
self:awaitRequest('initialize', params or {})
@@ -60,6 +78,7 @@ end
function mt:start(callback)
self:_fakeProto()
self:_flushServer()
+ self:_localLoadFile()
local finished = false