summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-01-28 16:33:25 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-01-28 16:33:25 +0800
commit17441837e8e9e2f400794fde0f6473ba10ea288f (patch)
tree5fc80190fc30ea7935fc3bfce730fde738a08a5f
parentbdc9f6d325362b8f834cb1d5e9be1911226d1961 (diff)
downloadlua-language-server-17441837e8e9e2f400794fde0f6473ba10ea288f.zip
status
-rw-r--r--script/files.lua5
-rw-r--r--script/service/service.lua21
2 files changed, 21 insertions, 5 deletions
diff --git a/script/files.lua b/script/files.lua
index 61ebb564..710d73bf 100644
--- a/script/files.lua
+++ b/script/files.lua
@@ -790,11 +790,6 @@ function m.init()
-- collectgarbage()
-- end
--end)
- --local prog = progress.create('已缓存文件')
-
- --timer.loop(0.1, function ()
- -- prog:setMessage(('%s/%s'):format(m.astCount, m.fileCount))
- --end)()
end
return m
diff --git a/script/service/service.lua b/script/service/service.lua
index 1fcfa340..67de4818 100644
--- a/script/service/service.lua
+++ b/script/service/service.lua
@@ -5,6 +5,7 @@ local timer = require 'timer'
local proto = require 'proto'
local vm = require 'vm'
local util = require 'utility'
+local files = require 'files'
local m = {}
m.type = 'service'
@@ -137,14 +138,33 @@ function m.startTimer()
while true do
pub.step()
if await.step() then
+ m.working = true
goto CONTINUE
end
+ m.working = false
thread.sleep(0.001)
::CONTINUE::
timer.update()
end
end
+function m.reportStatus()
+ timer.loop(0.1, function ()
+ local info = {}
+ if m.working then
+ info.text = '$(loading~spin)Lua'
+ else
+ info.text = 'Lua'
+ end
+ info.tooltip = ('已缓存文件:%d/%d\n内存占用:%.fM'):format(
+ files.astCount,
+ files.fileCount,
+ collectgarbage('count') / 1000
+ )
+ proto.notify('$/status', info)
+ end)()
+end
+
function m.testVersion()
local stack = debug.setcstacklimit(200)
debug.setcstacklimit(stack + 1)
@@ -162,6 +182,7 @@ function m.start()
pub.recruitBraves(4)
proto.listen()
m.report()
+ m.reportStatus()
m.testVersion()
require 'provider'