summaryrefslogtreecommitdiff
path: root/script/progress.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-12-30 17:51:22 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-12-30 17:51:22 +0800
commitb1c20a1f24cc7e17d446b2ac4e4118c36173dc20 (patch)
treea55942645f0cbc5db38aad471ac92e2d5b4c7c8c /script/progress.lua
parenta555b92349e2ab07b9111a296618a69caa068032 (diff)
downloadlua-language-server-b1c20a1f24cc7e17d446b2ac4e4118c36173dc20.zip
update
Diffstat (limited to 'script/progress.lua')
-rw-r--r--script/progress.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/script/progress.lua b/script/progress.lua
index d1595cf8..d5c174ce 100644
--- a/script/progress.lua
+++ b/script/progress.lua
@@ -10,6 +10,7 @@ local m = {}
m.map = {}
---@class progress
+---@field _scp scope
local mt = {}
mt.__index = mt
mt._token = nil
@@ -83,7 +84,7 @@ function mt:_update()
and self._clock + self._delay <= os.clock() then
self._updated = os.clock()
self._dirty = false
- if not config.get(nil, 'Lua.window.progressBar') then
+ if not config.get(self._scp.uri, 'Lua.window.progressBar') then
return
end
proto.request('window/workDoneProgress/create', {
@@ -106,7 +107,7 @@ function mt:_update()
if not self._showed then
return
end
- if not config.get(nil, 'Lua.window.progressBar') then
+ if not config.get(self._scp.uri, 'Lua.window.progressBar') then
self:remove()
return
end
@@ -143,14 +144,16 @@ function m.update()
end
---创建一个进度条
+---@param scp scope
---@param title string # 标题
---@param delay number # 至少经过这么久之后才会显示出来
-function m.create(title, delay)
+function m.create(scp, title, delay)
local prog = setmetatable({
_token = nextToken(),
_title = title,
_clock = os.clock(),
_delay = delay,
+ _scp = scp,
}, mt)
m.map[prog._token] = prog