summaryrefslogtreecommitdiff
path: root/script/workspace
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2022-01-26 22:06:00 +0800
committer最萌小汐 <sumneko@hotmail.com>2022-01-26 22:06:00 +0800
commit7b19ab02273c60982c45cd3cac768e9e788ad64d (patch)
tree3152712df1fbb83e0150d6ea5036da56e43ed419 /script/workspace
parent202bc99994db7cf79d04dd56afd1e03743e9b908 (diff)
downloadlua-language-server-7b19ab02273c60982c45cd3cac768e9e788ad64d.zip
library check ignoreDir
Diffstat (limited to 'script/workspace')
-rw-r--r--script/workspace/scope.lua9
-rw-r--r--script/workspace/workspace.lua14
2 files changed, 22 insertions, 1 deletions
diff --git a/script/workspace/scope.lua b/script/workspace/scope.lua
index 304e875e..ab9c3fb9 100644
--- a/script/workspace/scope.lua
+++ b/script/workspace/scope.lua
@@ -70,6 +70,15 @@ function mt:getLinkedUri(uri)
return nil
end
+---@param uri uri
+---@return uri
+function mt:getRootUri(uri)
+ if self:isChildUri(uri) then
+ return self.uri
+ end
+ return self:getLinkedUri(uri)
+end
+
---@param k string
---@param v any
function mt:set(k, v)
diff --git a/script/workspace/workspace.lua b/script/workspace/workspace.lua
index 31566e32..89908468 100644
--- a/script/workspace/workspace.lua
+++ b/script/workspace/workspace.lua
@@ -162,6 +162,18 @@ function m.getLibraryMatchers(scp)
end
log.info('Build library matchers:', scp)
+ local pattern = {}
+ for path, ignore in pairs(config.get(scp.uri, 'files.exclude')) do
+ if ignore then
+ log.info('Ignore by exclude:', path)
+ pattern[#pattern+1] = path
+ end
+ end
+ for _, path in ipairs(config.get(scp.uri, 'Lua.workspace.ignoreDir')) do
+ log.info('Ignore directory:', path)
+ pattern[#pattern+1] = path
+ end
+
local librarys = {}
for path in pairs(config.get(scp.uri, 'Lua.workspace.library')) do
path = m.getAbsolutePath(scp.uri, path)
@@ -178,7 +190,7 @@ function m.getLibraryMatchers(scp)
for path in pairs(librarys) do
if fs.exists(fs.path(path)) then
local nPath = fs.absolute(fs.path(path)):string()
- local matcher = glob.gitignore(true, {
+ local matcher = glob.gitignore(pattern, {
root = path,
ignoreCase = platform.OS == 'Windows',
}, globInteferFace)