summaryrefslogtreecommitdiff
path: root/script/provider
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-11-26 21:05:42 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-11-26 21:05:42 +0800
commited27fb8fac021f77b4824f1a0068a97fe801c7bf (patch)
treefa92d03f6db380d46f454d5e0d0bd62f8a3d3a76 /script/provider
parent999316d43551dabfe8fadafa017332e840099f90 (diff)
downloadlua-language-server-ed27fb8fac021f77b4824f1a0068a97fe801c7bf.zip
stash
Diffstat (limited to 'script/provider')
-rw-r--r--script/provider/provider.lua26
1 files changed, 14 insertions, 12 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index 44b63d00..7c453315 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -27,26 +27,28 @@ end
---@async
local function updateConfig()
- local baseConfig = {}
-
local cfg = cfgLoader.loadLocalConfig(CONFIGPATH)
if cfg then
log.debug('load config from local', CONFIGPATH)
-- watch directory
filewatch.watch(workspace.getAbsolutePath(CONFIGPATH):gsub('[^/\\]+$', ''))
- mergeConfig(baseConfig, cfg)
+ config.update('specified', nil, cfg)
end
- local rc = cfgLoader.loadRCConfig('.luarc.json')
- if rc then
- log.debug('load config from luarc')
- mergeConfig(baseConfig, rc)
- end
+ for _, folder in ipairs(workspace.folders) do
+ local uri = folder.uri
+ local folderConfig = {}
+ local rc = cfgLoader.loadRCConfig(uri, '.luarc.json')
+ if rc then
+ log.debug('load config from luarc')
+ mergeConfig(folderConfig, rc)
+ end
- local clientConfig = cfgLoader.loadClientConfig()
- if clientConfig then
- log.debug('load config from client')
- mergeConfig(baseConfig, clientConfig)
+ local clientConfig = cfgLoader.loadClientConfig(uri)
+ if clientConfig then
+ log.debug('load config from client')
+ mergeConfig(folderConfig, clientConfig)
+ end
end
for k, v in pairs(baseConfig) do