summaryrefslogtreecommitdiff
path: root/script/workspace
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2020-12-02 10:58:57 +0800
committer最萌小汐 <sumneko@hotmail.com>2020-12-02 10:58:57 +0800
commit5833c2aef04bd4704c86104275411ef330981f85 (patch)
tree336b2a754f5d80481c735a164f046dbbdfbf397f /script/workspace
parentcd936908fa743c8699d8a72d7b4ee32a3afbc4a8 (diff)
downloadlua-language-server-5833c2aef04bd4704c86104275411ef330981f85.zip
add test of progress
Diffstat (limited to 'script/workspace')
-rw-r--r--script/workspace/workspace.lua40
1 files changed, 36 insertions, 4 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 13208b75..a6425a8b 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -198,6 +198,41 @@ local function loadFileFactory(root, progress, isLibrary)
end
end
+local function testProgress()
+ local client = require 'provider.client'
+ proto.notify('$/progress', {
+ token = client.info.workDoneToken,
+ value = {
+ kind = 'begin',
+ title = '测试标题',
+ cancellable = false,
+ message = '测试描述',
+ percentage = 0,
+ }
+ })
+ for i = 1, 100 do
+ await.sleep(0.1)
+ log.info('sleep', i)
+ proto.notify('$/progress', {
+ token = client.info.workDoneToken,
+ value = {
+ kind = 'report',
+ cancellable = false,
+ message = '测试描述',
+ percentage = i,
+ }
+ })
+ end
+ await.sleep(0.1)
+ proto.notify('$/progress', {
+ token = client.info.workDoneToken,
+ value = {
+ kind = 'end',
+ message = '测试描述',
+ }
+ })
+end
+
--- 预读工作区内所有文件
function m.awaitPreload()
await.close 'preload'
@@ -232,10 +267,7 @@ function m.awaitPreload()
await.sleep(0.1)
end
- --for i = 1, 100 do
- -- await.sleep(0.1)
- -- log.info('sleep', i)
- --end
+ --testProgress()
log.info('Preload finish.')