diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-12-30 16:12:46 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-12-30 16:12:46 +0800 |
commit | a48139e5dd7e7a6e9e3bd00a41334a1e66d1a227 (patch) | |
tree | b363a6a733280839bb3d2170e26668143106ee9f /script/workspace | |
parent | f0f9a4ea4509dfb764a5dfebd5e86e679c8f4b03 (diff) | |
download | lua-language-server-a48139e5dd7e7a6e9e3bd00a41334a1e66d1a227.zip |
update
Diffstat (limited to 'script/workspace')
-rw-r--r-- | script/workspace/workspace.lua | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua index 8e26b1df..4d904773 100644 --- a/script/workspace/workspace.lua +++ b/script/workspace/workspace.lua @@ -17,6 +17,8 @@ local loading = require 'workspace.loading' ---@class workspace local m = {} m.type = 'workspace' +---@type scope[] +m.folders = {} function m.initRoot(uri) m.rootUri = uri @@ -33,7 +35,13 @@ function m.create(uri) log.info('Workspace create: ', uri) local path = m.normalize(furi.decode(uri)) fw.watch(path) - scope.createFolder(uri) + local scp = scope.createFolder(uri) + m.folders[#m.folders+1] = scp +end + +function m.getRootUri(uri) + local scp = m.getScope(uri) + return scp.uri end local globInteferFace = { @@ -228,6 +236,7 @@ function m.awaitPreload(scp) scp:set('watchers', watchers) local ld <close> = loading.create(scp) + scp:set('loading', ld) log.info('Preload start:', scp.uri) @@ -443,8 +452,11 @@ function m.isReady(uri) return scp:get('ready') == true end -function m.getLoadProcess() - return m.fileLoaded, m.fileFound +function m.getLoadingProcess(uri) + local scp = m.getScope(uri) + ---@type workspace.loading + local ld = scp:get 'loading' + return ld.read, ld.max end files.watch(function (ev, uri) ---@async |