From 8abe15deac954ee0c1c0a155c2490289dfd37b04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Wed, 30 Jun 2021 21:09:18 +0800 Subject: reports initialization progress --- script/provider/provider.lua | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'script/provider/provider.lua') 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 _ = 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 _ = progress.create(lang.script.WINDOW_PROCESSING_COMPLETION, 0.5) --log.info(util.dump(params)) local core = require 'core.completion' -- cgit v1.2.3