summaryrefslogtreecommitdiff
path: root/script/provider/provider.lua
diff options
context:
space:
mode:
author最萌小汐 <sumneko@hotmail.com>2021-07-01 20:48:38 +0800
committer最萌小汐 <sumneko@hotmail.com>2021-07-01 20:48:38 +0800
commit0a17fa78337e15474183f7db7dd8ddc9eb364cd4 (patch)
tree2b074e0fcb86f398b98a23a1b1eb26cc4a0ef9fe /script/provider/provider.lua
parent0dacc5f651818c9ae21ab66a8df4879c6b39908b (diff)
downloadlua-language-server-0a17fa78337e15474183f7db7dd8ddc9eb364cd4.zip
resolve #556, #583, #581
Diffstat (limited to 'script/provider/provider.lua')
-rw-r--r--script/provider/provider.lua47
1 files changed, 13 insertions, 34 deletions
diff --git a/script/provider/provider.lua b/script/provider/provider.lua
index d0509957..b8ea2d9b 100644
--- a/script/provider/provider.lua
+++ b/script/provider/provider.lua
@@ -20,50 +20,29 @@ local progress = require 'progress'
local tm = require 'text-merger'
local vm = require 'vm'
local nonil = require 'without-check-nil'
+local cfgLoader = require 'config.loader'
local function updateConfig()
local diagnostics = require 'provider.diagnostic'
local telemetry = require 'service.telemetry'
- local configs = proto.awaitRequest('workspace/configuration', {
- items = {
- {
- scopeUri = workspace.uri,
- section = 'Lua',
- },
- {
- scopeUri = workspace.uri,
- section = 'files.associations',
- },
- {
- scopeUri = workspace.uri,
- section = 'files.exclude',
- },
- {
- scopeUri = workspace.uri,
- section = 'editor.semanticHighlighting.enabled',
- },
- {
- scopeUri = workspace.uri,
- section = 'editor.acceptSuggestionOnEnter',
- },
- },
- })
- if not configs or not configs[1] then
- log.warn('No config?', util.dump(configs))
+ local new
+ if CONFIGPATH then
+ new = cfgLoader.loadLocalConfig(CONFIGPATH)
+ log.debug('load config from local', CONFIGPATH)
+ else
+ new = cfgLoader.loadClientConfig()
+ log.debug('load config from client')
+ end
+ if not new then
+ log.warn('load config failed!')
return
end
-
- local new = {
- ['Lua'] = configs[1],
- ['files.associations'] = configs[2],
- ['files.exclude'] = configs[3],
- ['editor.semanticHighlighting.enabled'] = configs[4],
- ['editor.acceptSuggestionOnEnter'] = configs[5],
- }
+ log.debug('loaded config dump:', util.dump(new))
local oldConfig = config.dump()
config.update(new)
local newConfig = config.dump()
+ log.debug('config updated:', util.dump(newConfig))
if not util.equal(oldConfig.Lua.runtime, newConfig.Lua.runtime) then
library.init()