diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2023-02-06 14:20:02 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2023-02-06 14:20:02 +0800 |
commit | efd6c91c1413118d358bc25c30786ee2f0c084fb (patch) | |
tree | d2a0329656bcebf0d905ce37df887aa2b8299b1a /script/core | |
parent | 95e3888ea49effefadd473d071b429a52975f688 (diff) | |
download | lua-language-server-efd6c91c1413118d358bc25c30786ee2f0c084fb.zip |
just check client ready
Diffstat (limited to 'script/core')
-rw-r--r-- | script/core/command/getConfig.lua | 7 | ||||
-rw-r--r-- | script/core/command/setConfig.lua | 6 |
2 files changed, 8 insertions, 5 deletions
diff --git a/script/core/command/getConfig.lua b/script/core/command/getConfig.lua index dd0b504b..7a35c198 100644 --- a/script/core/command/getConfig.lua +++ b/script/core/command/getConfig.lua @@ -1,10 +1,13 @@ local config = require 'config' -local ws = require 'workspace' +local client = require 'client' +local await = require 'await' ---@async return function (data) local uri = data[1].uri local key = data[1].key - ws.awaitReady(uri) + while not client:isReady() do + await.sleep(0.1) + end return config.get(uri, key) end diff --git a/script/core/command/setConfig.lua b/script/core/command/setConfig.lua index c61aa942..af978ebe 100644 --- a/script/core/command/setConfig.lua +++ b/script/core/command/setConfig.lua @@ -1,11 +1,11 @@ local client = require 'client' -local ws = require 'workspace' +local await = require 'await' ---@async ---@param changes config.change[] return function (changes) - for _, change in ipairs(changes) do - ws.awaitReady(change.uri) + while not client:isReady() do + await.sleep(0.1) end client.setConfig(changes) end |