summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--script/workspace/workspace.lua13
-rw-r--r--test.lua4
-rw-r--r--test/tclient/tests/multi-workspace.lua11
3 files changed, 15 insertions, 13 deletions
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index e064b424..5277f38e 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -250,9 +250,8 @@ end
---@async
---@param scp scope
function m.awaitPreload(scp)
- local displayedUri = scp.uri or '<fallback>'
- await.close('preload:' .. displayedUri)
- await.setID('preload:' .. displayedUri)
+ await.close('preload:' .. scp:getName())
+ await.setID('preload:' .. scp:getName())
await.sleep(0.1)
local watchers = scp:get 'watchers'
@@ -267,13 +266,13 @@ function m.awaitPreload(scp)
local ld <close> = loading.create(scp)
scp:set('loading', ld)
- log.info('Preload start:', displayedUri)
+ log.info('Preload start:', scp:getName())
local native = m.getNativeMatcher(scp)
local librarys = m.getLibraryMatchers(scp)
if scp.uri then
- log.info('Scan files at:', displayedUri)
+ log.info('Scan files at:', scp:getName())
---@async
native:scan(furi.decode(scp.uri), function (path)
ld:loadFile(furi.encode(path))
@@ -289,9 +288,9 @@ function m.awaitPreload(scp)
watchers[#watchers+1] = fw.watch(furi.decode(libMatcher.uri))
end
- log.info(('Found %d files at:'):format(ld.max), displayedUri)
+ log.info(('Found %d files at:'):format(ld.max), scp:getName())
ld:loadAll()
- log.info('Preload finish at:', displayedUri)
+ log.info('Preload finish at:', scp:getName())
end
--- 查找符合指定file path的所有uri
diff --git a/test.lua b/test.lua
index 327cb7d6..42b0d129 100644
--- a/test.lua
+++ b/test.lua
@@ -82,7 +82,9 @@ local function main()
---@async
lclient():start(function (client)
client:registerFakers()
- client:initialize()
+ client:initialize {
+ rootUri = '',
+ }
ws.awaitReady()
diff --git a/test/tclient/tests/multi-workspace.lua b/test/tclient/tests/multi-workspace.lua
index 99b7f122..02ebacbd 100644
--- a/test/tclient/tests/multi-workspace.lua
+++ b/test/tclient/tests/multi-workspace.lua
@@ -4,6 +4,7 @@ local util = require 'utility'
local furi = require 'file-uri'
local ws = require 'workspace'
local files = require 'files'
+local scope = require 'workspace.scope'
local rootPath = LOGPATH .. '/multi-workspace'
local rootUri = furi.encode(rootPath)
@@ -66,11 +67,11 @@ lclient():start(function (client)
assert(files.getState(rootUri .. '/lb1/test.lua') ~= nil)
assert(files.getState(rootUri .. '/lb2/test.lua') ~= nil)
- assert(ws.getScope(rootUri .. '/ws1/test.lua').uri == rootUri .. '/ws1')
- assert(ws.getScope(rootUri .. '/ws2/test.lua').uri == rootUri .. '/ws2')
- assert(ws.getScope(rootUri .. '/share/test.lua').uri == rootUri .. '/ws1')
- assert(ws.getScope(rootUri .. '/lb1/test.lua').uri == rootUri .. '/ws1')
- assert(ws.getScope(rootUri .. '/lb2/test.lua').uri == rootUri .. '/ws2')
+ assert(scope.getScope(rootUri .. '/ws1/test.lua').uri == rootUri .. '/ws1')
+ assert(scope.getScope(rootUri .. '/ws2/test.lua').uri == rootUri .. '/ws2')
+ assert(scope.getScope(rootUri .. '/share/test.lua').uri == rootUri .. '/ws1')
+ assert(scope.getScope(rootUri .. '/lb1/test.lua').uri == rootUri .. '/ws1')
+ assert(scope.getScope(rootUri .. '/lb2/test.lua').uri == rootUri .. '/ws2')
assert(files.isLibrary(rootUri .. '/ws1/test.lua') == false)
assert(files.isLibrary(rootUri .. '/ws2/test.lua') == false)