diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-07-22 15:38:49 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-07-22 15:38:49 +0800 |
commit | 48c5a0eea7c9478b43d447b0c47ee2f3d7b01f47 (patch) | |
tree | 34c8cf81b3bea7aa2ee5b5c7511e7066d8cbd304 /script/config | |
parent | ff59147f34b74cf47c474f370463c4ff7ffc0d0c (diff) | |
download | lua-language-server-48c5a0eea7c9478b43d447b0c47ee2f3d7b01f47.zip |
#409
Diffstat (limited to 'script/config')
-rw-r--r-- | script/config/config.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/script/config/config.lua b/script/config/config.lua index e9b29e6b..d6919c65 100644 --- a/script/config/config.lua +++ b/script/config/config.lua @@ -254,6 +254,29 @@ function m.add(key, value) return true end +function m.prop(key, prop, value) + local unit = Template[key] + if not unit then + return false + end + local map = rawConfig[key] + if type(map) ~= 'table' then + return false + end + if util.equal(map[prop], value) then + return false + end + local copyed = {} + for k, v in pairs(map) do + copyed[k] = v + end + copyed[prop] = value + if unit:checker(copyed) then + update(key, unit:loader(copyed), copyed) + end + return true +end + function m.get(key) return config[key] end |