From c5cdfa647574c38916c61930acf56469372d139f Mon Sep 17 00:00:00 2001 From: sumneko Date: Wed, 8 May 2019 16:51:55 +0800 Subject: =?UTF-8?q?#28=20=E6=8E=92=E9=99=A4=E7=9B=AE=E5=BD=95=E4=B9=9F?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20files.exclude?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/src/config.lua | 1 + server/src/method/initialized.lua | 5 +++++ server/src/method/workspace/didChangeConfiguration.lua | 5 +++++ server/src/service.lua | 1 + server/src/workspace.lua | 3 +++ 5 files changed, 15 insertions(+) (limited to 'server') 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 -- cgit v1.2.3