Skip to content

Commit c4dd778

Browse files
committed
cleanup
1 parent 3ac7e11 commit c4dd778

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

script/files.lua

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,11 @@ function m.isLibrary(uri)
124124
end
125125

126126
--- 获取库文件的根目录
127-
function m.getLibraryUri(uri)
128-
for _, scp in ipairs(scope.folders) do
129-
local map = scp:get 'libraryMap'
130-
if map and map[uri] ~= nil then
131-
return map[uri]
132-
end
127+
function m.getLibraryUri(suri, uri)
128+
local scp = scope.getScope(suri)
129+
local map = scp:get 'libraryMap'
130+
if map and map[uri] ~= nil then
131+
return map[uri]
133132
end
134133
return nil
135134
end

script/workspace/require-path.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,12 @@ function m.getVisiblePath(suri, path)
4343
local strict = config.get(suri, 'Lua.runtime.pathStrict')
4444
path = workspace.normalize(path)
4545
local uri = furi.encode(path)
46-
local libraryPath = furi.decode(files.getLibraryUri(uri))
46+
local libraryPath = furi.decode(files.getLibraryUri(suri, uri))
4747
local scp = scope.getScope(suri)
4848
local cache = scp:get('visiblePath') or scp:set('visiblePath', {})
4949
if not cache[path] then
5050
local result = {}
5151
cache[path] = result
52-
if libraryPath then
53-
libraryPath = libraryPath:gsub('^[/\\]+', '')
54-
end
5552
for _, searcher in ipairs(searchers) do
5653
local isAbsolute = searcher:match '^[/\\]'
5754
or searcher:match '^%a+%:'

0 commit comments

Comments
 (0)