diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-07-07 11:51:56 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-07-07 11:51:56 +0800 |
commit | c902388de8d140a1dbb979118ca705b47c52b51f (patch) | |
tree | 717ab5eef54e4477a9c42bbab40540a32e1d9b50 /script/config | |
parent | 484a6e70512948a125b28ac2803ae8ff469534e7 (diff) | |
download | lua-language-server-c902388de8d140a1dbb979118ca705b47c52b51f.zip |
cleanup
Diffstat (limited to 'script/config')
-rw-r--r-- | script/config/config.lua | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/script/config/config.lua b/script/config/config.lua index 521e6817..61b09f4e 100644 --- a/script/config/config.lua +++ b/script/config/config.lua @@ -200,8 +200,13 @@ local Template = { ['editor.acceptSuggestionOnEnter'] = Type.String >> 'on', } -local config = {} -local raw = {} +local config = {} +local rawConfig = {} + +local function update(key, value, raw) + config[key] = value + rawConfig[key] = raw +end local m = {} @@ -211,11 +216,9 @@ function m.set(key, value) return end if unit:checker(value) then - config[key] = unit:loader(value) - raw[key] = value + update(key, unit:loader(value), value) else - config[key] = unit.default - raw[key] = unit.default + update(key, unit.default, unit.default) end end @@ -224,7 +227,7 @@ function m.add(key, value) if not unit then return end - local list = raw[key] + local list = rawConfig[key] if type(list) ~= 'table' then return end @@ -234,8 +237,7 @@ function m.add(key, value) end copyed[#copyed+1] = value if unit:checker(copyed) then - config[key] = unit:loader(copyed) - raw[key] = copyed + update(key, unit:loader(copyed), copyed) end end |