summaryrefslogtreecommitdiff
path: root/script/workspace
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-06-30 21:09:18 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-06-30 21:09:18 +0800
commit8abe15deac954ee0c1c0a155c2490289dfd37b04 (patch)
treef90d0a626dec00333866537d5ca6dc4d2a2ce5b1 /script/workspace
parentb7caff0e2668dcad90d4e91c61736202000bc243 (diff)
downloadlua-language-server-8abe15deac954ee0c1c0a155c2490289dfd37b04.zip
reports initialization progress
Diffstat (limited to 'script/workspace')
-rw-r--r--script/workspace/workspace.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 5350369e..5ffcac5c 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -9,8 +9,6 @@ local await = require 'await'
local proto = require 'proto.proto'
local lang = require 'language'
local library = require 'library'
-local sp = require 'bee.subprocess'
-local timer = require 'timer'
local progress = require 'progress'
local define = require "proto.define"
@@ -19,6 +17,8 @@ m.type = 'workspace'
m.nativeVersion = -1
m.libraryVersion = -1
m.nativeMatcher = nil
+m.fileLoaded = 0
+m.fileFound = 0
m.waitingReady = {}
m.requireCache = {}
m.cache = {}
@@ -282,6 +282,8 @@ function m.awaitPreload()
diagnostic.pause()
m.libraryMatchers = nil
m.nativeMatcher = nil
+ m.fileLoaded = 0
+ m.fileFound = 0
m.cache = {}
local progressBar <close> = progress.create(lang.script.WORKSPACE_LOADING)
local progressData = {
@@ -291,6 +293,8 @@ function m.awaitPreload()
update = function (self)
progressBar:setMessage(('%d/%d'):format(self.read, self.max))
progressBar:setPercentage(self.read / self.max * 100)
+ m.fileLoaded = self.read
+ m.fileFound = self.max
end
}
log.info('Preload start.')
@@ -501,6 +505,10 @@ function m.isReady()
return m.ready == true
end
+function m.getLoadProcess()
+ return m.fileLoaded, m.fileFound
+end
+
files.watch(function (ev, uri)
if ev == 'close'
and m.isIgnored(uri)