diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-06-30 21:09:18 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-06-30 21:09:18 +0800 |
commit | 8abe15deac954ee0c1c0a155c2490289dfd37b04 (patch) | |
tree | f90d0a626dec00333866537d5ca6dc4d2a2ce5b1 /script/provider/provider.lua | |
parent | b7caff0e2668dcad90d4e91c61736202000bc243 (diff) | |
download | lua-language-server-8abe15deac954ee0c1c0a155c2490289dfd37b04.zip |
reports initialization progress
Diffstat (limited to 'script/provider/provider.lua')
-rw-r--r-- | script/provider/provider.lua | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 5b1200cc..0249ffca 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -293,7 +293,15 @@ end) proto.on('textDocument/hover', function (params) await.close 'hover' await.setID 'hover' - workspace.awaitReady() + if not workspace.isReady() then + local count, max = workspace.getLoadProcess() + return { + contents = { + value = lang.script('HOVER_WS_LOADING', count, max), + kind = 'markdown', + } + } + end local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_HOVER, 0.5) local core = require 'core.hover' local doc = params.textDocument @@ -439,7 +447,20 @@ end) proto.on('textDocument/completion', function (params) await.close 'completion' await.setID 'completion' - workspace.awaitReady() + if not workspace.isReady() then + local count, max = workspace.getLoadProcess() + return { + { + label = lang.script('HOVER_WS_LOADING', count, max),textEdit = { + range = { + start = params.position, + ['end'] = params.position, + }, + newText = '', + }, + } + } + end local _ <close> = progress.create(lang.script.WINDOW_PROCESSING_COMPLETION, 0.5) --log.info(util.dump(params)) local core = require 'core.completion' |