diff options
author | sumneko <sumneko@hotmail.com> | 2019-05-08 16:51:55 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2019-05-08 16:51:55 +0800 |
commit | c5cdfa647574c38916c61930acf56469372d139f (patch) | |
tree | 2f047e9f9edb1891c187c460742715c3ddc29c90 /server | |
parent | 2bdcabc48557e6b968df7ae88cafe8d318c44a1d (diff) | |
download | lua-language-server-c5cdfa647574c38916c61930acf56469372d139f.zip |
#28 排除目录也使用 files.exclude
Diffstat (limited to 'server')
-rw-r--r-- | server/src/config.lua | 1 | ||||
-rw-r--r-- | server/src/method/initialized.lua | 5 | ||||
-rw-r--r-- | server/src/method/workspace/didChangeConfiguration.lua | 5 | ||||
-rw-r--r-- | server/src/service.lua | 1 | ||||
-rw-r--r-- | server/src/workspace.lua | 3 |
5 files changed, 15 insertions, 0 deletions
diff --git a/server/src/config.lua b/server/src/config.lua index 1396de92..27d4f36a 100644 --- a/server/src/config.lua +++ b/server/src/config.lua @@ -102,6 +102,7 @@ local ConfigTemplate = { local OtherTemplate = { associations = {{}, Hash(String, String)}, + exclude = {{}, Hash(String, Boolean)}, } local Config, Other diff --git a/server/src/method/initialized.lua b/server/src/method/initialized.lua index 05abffd7..47b924d0 100644 --- a/server/src/method/initialized.lua +++ b/server/src/method/initialized.lua @@ -51,11 +51,16 @@ return function (lsp) { scopeUri = uri, section = 'files.associations', + }, + { + scopeUri = uri, + section = 'files.exclude', } }, }, function (configs) lsp:onUpdateConfig(configs[1], { associations = configs[2], + exclude = configs[3], }) initAfterConfig(lsp, firstScope) end) diff --git a/server/src/method/workspace/didChangeConfiguration.lua b/server/src/method/workspace/didChangeConfiguration.lua index d5008954..ecaa9182 100644 --- a/server/src/method/workspace/didChangeConfiguration.lua +++ b/server/src/method/workspace/didChangeConfiguration.lua @@ -12,11 +12,16 @@ return function (lsp) { scopeUri = uri, section = 'files.associations', + }, + { + scopeUri = uri, + section = 'files.exclude', } }, }, function (configs) lsp:onUpdateConfig(configs[1], { associations = configs[2], + exclude = configs[3], }) end) end diff --git a/server/src/service.lua b/server/src/service.lua index 639f6cc2..f71494fc 100644 --- a/server/src/service.lua +++ b/server/src/service.lua @@ -704,6 +704,7 @@ function mt:onUpdateConfig(updated, other) end if not table.equal(oldConfig.workspace, newConfig.workspace) or not table.equal(oldOther.associations, newOther.associations) + or not table.equal(oldOther.exclude, newOther.exclude) then self:clearAllFiles() if self.workspace then diff --git a/server/src/workspace.lua b/server/src/workspace.lua index 87cc4c98..fd6f9c04 100644 --- a/server/src/workspace.lua +++ b/server/src/workspace.lua @@ -122,6 +122,9 @@ function mt:scanFiles() for path in pairs(config.config.workspace.ignoreDir) do ignored[#ignored+1] = path end + for path in pairs(config.other.exclude) do + ignored[#ignored+1] = path + end if config.config.workspace.ignoreSubmodules then local buf = io.load(self.root / '.gitmodules') if buf then |