Skip to content

Commit 7b19ab0

Browse files
committed
library check ignoreDir
1 parent 202bc99 commit 7b19ab0

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

script/workspace/scope.lua

+9
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,15 @@ function mt:getLinkedUri(uri)
7070
return nil
7171
end
7272

73+
---@param uri uri
74+
---@return uri
75+
function mt:getRootUri(uri)
76+
if self:isChildUri(uri) then
77+
return self.uri
78+
end
79+
return self:getLinkedUri(uri)
80+
end
81+
7382
---@param k string
7483
---@param v any
7584
function mt:set(k, v)

script/workspace/workspace.lua

+13-1
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,18 @@ function m.getLibraryMatchers(scp)
162162
end
163163
log.info('Build library matchers:', scp)
164164

165+
local pattern = {}
166+
for path, ignore in pairs(config.get(scp.uri, 'files.exclude')) do
167+
if ignore then
168+
log.info('Ignore by exclude:', path)
169+
pattern[#pattern+1] = path
170+
end
171+
end
172+
for _, path in ipairs(config.get(scp.uri, 'Lua.workspace.ignoreDir')) do
173+
log.info('Ignore directory:', path)
174+
pattern[#pattern+1] = path
175+
end
176+
165177
local librarys = {}
166178
for path in pairs(config.get(scp.uri, 'Lua.workspace.library')) do
167179
path = m.getAbsolutePath(scp.uri, path)
@@ -178,7 +190,7 @@ function m.getLibraryMatchers(scp)
178190
for path in pairs(librarys) do
179191
if fs.exists(fs.path(path)) then
180192
local nPath = fs.absolute(fs.path(path)):string()
181-
local matcher = glob.gitignore(true, {
193+
local matcher = glob.gitignore(pattern, {
182194
root = path,
183195
ignoreCase = platform.OS == 'Windows',
184196
}, globInteferFace)

0 commit comments

Comments
 (0)