summaryrefslogtreecommitdiff
path: root/script
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-01-28 17:40:11 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-01-28 17:40:11 +0800
commit9de4be8cfdc13cca9d672b708fa4699116a9a82a (patch)
treee9f41b4466792d889e5ae3893bf00f919cb91419 /script
parent6bc61fd0667b0f05ed225fe0f108e7ce96279291 (diff)
downloadlua-language-server-9de4be8cfdc13cca9d672b708fa4699116a9a82a.zip
config of progress
Diffstat (limited to 'script')
-rw-r--r--script/config.lua4
-rw-r--r--script/progress.lua18
-rw-r--r--script/provider/provider.lua5
-rw-r--r--script/service/service.lua2
4 files changed, 23 insertions, 6 deletions
diff --git a/script/config.lua b/script/config.lua
index 52b22205..cd9b5d33 100644
--- a/script/config.lua
+++ b/script/config.lua
@@ -157,6 +157,10 @@ local ConfigTemplate = {
intelliSense = {
searchDepth = {0, Integer},
},
+ window = {
+ statusBar = {true, Boolean},
+ progressBar = {true, Boolean},
+ },
telemetry = {
enable = {true, Boolean},
}
diff --git a/script/progress.lua b/script/progress.lua
index 2e01daa2..19f759ee 100644
--- a/script/progress.lua
+++ b/script/progress.lua
@@ -1,6 +1,7 @@
-local proto = require 'proto.proto'
-local util = require 'utility'
-local timer = require "timer"
+local proto = require 'proto.proto'
+local util = require 'utility'
+local timer = require "timer"
+local config = require 'config'
local nextToken = util.counter()
@@ -80,8 +81,11 @@ function mt:_update()
end
if not self._showed
and self._clock + self._delay <= os.clock() then
- self._showed = true
self._updated = os.clock()
+ self._dirty = false
+ if not config.config.window.progressBar then
+ return
+ end
proto.request('window/workDoneProgress/create', {
token = self._token,
})
@@ -95,13 +99,17 @@ function mt:_update()
percentage = self._percentage,
}
})
+ self._showed = true
log.info('Create progress:', self._token, self._title)
- self._dirty = false
return
end
if not self._showed then
return
end
+ if not config.config.window.progressBar then
+ self:remove()
+ return
+ end
if os.clock() - self._updated < 0.05 then
return
end
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index cac91acf..894b8ef2 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -83,6 +83,11 @@ local function updateConfig()
else
semantic.disable()
end
+ if newConfig.window.statusBar then
+ proto.notify('$/status/show')
+ else
+ proto.notify('$/status/hide')
+ end
end
proto.on('initialize', function (params)
diff --git a/script/service/service.lua b/script/service/service.lua
index 67de4818..c006be48 100644
--- a/script/service/service.lua
+++ b/script/service/service.lua
@@ -161,7 +161,7 @@ function m.reportStatus()
files.fileCount,
collectgarbage('count') / 1000
)
- proto.notify('$/status', info)
+ proto.notify('$/status/report', info)
end)()
end