summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2019-01-25 16:00:56 +0800
committer最萌小汐 <sumneko@hotmail.com>2019-01-25 16:00:56 +0800
commit1df57357aece99476057b7a904930e7d26335f2c (patch)
treee03296c9eb6b15d83a20ae4b8bac3758322897aa /server
parentf593f77690ce69c57128bb0cf20734f97fe8d598 (diff)
downloadlua-language-server-1df57357aece99476057b7a904930e7d26335f2c.zip
忽略子模块
Diffstat (limited to 'server')
-rw-r--r--server/src/config.lua7
-rw-r--r--server/src/workspace.lua16
2 files changed, 19 insertions, 4 deletions
diff --git a/server/src/config.lua b/server/src/config.lua
index a19f17d8..449a6002 100644
--- a/server/src/config.lua
+++ b/server/src/config.lua
@@ -29,11 +29,12 @@ end
local Template = {
diagnostics = {
- globals = {{}, Str2Hash ';'},
- disable = {{}, Str2Hash ';'},
+ globals = {{}, Str2Hash ';'},
+ disable = {{}, Str2Hash ';'},
},
workspace = {
- ignoreDir = {{}, Str2Hash ';'}
+ ignoreDir = {{}, Str2Hash ';'},
+ ignoreSubmodules= {true, Boolean},
}
}
diff --git a/server/src/workspace.lua b/server/src/workspace.lua
index 2fd7ad65..6e7faaaf 100644
--- a/server/src/workspace.lua
+++ b/server/src/workspace.lua
@@ -78,9 +78,23 @@ function mt:init(rootUri)
log.info('Log path: ', logPath)
log.init(ROOT, logPath)
+ local ignored = {}
+ for path in pairs(config.config.workspace.ignoreDir) do
+ ignored[path] = true
+ end
+ if config.config.workspace.ignoreSubmodules then
+ local buf = io.load(ROOT:parent_path() / '.gitmodules')
+ if buf then
+ for path in buf:gmatch('path = ([^\r\n]+)') do
+ log.debug('忽略子模块:', path)
+ ignored[path] = true
+ end
+ end
+ end
+
async.run('scanfiles', {
root = self.root:string(),
- ignore = config.config.workspace.ignoreDir,
+ ignore = ignored,
}, function (file)
if file == 'ok' then
self:reset()