diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-22 16:54:05 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-22 16:54:05 +0800 |
commit | 1b3602f1e936c0e4964f87975bbc3aae5a1cbe09 (patch) | |
tree | 9ba224a4bc97b4a9ad699286271217095808fb82 /script/config | |
parent | 85732594a954187774e44dd914ca5566c0e526b8 (diff) | |
download | lua-language-server-1b3602f1e936c0e4964f87975bbc3aae5a1cbe09.zip |
supports quickfix for `.luarc.json`
Diffstat (limited to 'script/config')
-rw-r--r-- | script/config/config.lua | 15 | ||||
-rw-r--r-- | script/config/loader.lua | 4 |
2 files changed, 9 insertions, 10 deletions
diff --git a/script/config/config.lua b/script/config/config.lua index 0e18428f..2788cda7 100644 --- a/script/config/config.lua +++ b/script/config/config.lua @@ -216,6 +216,7 @@ local Template = { local config = {} local rawConfig = {} +---@class config.api local m = {} m.watchList = {} @@ -292,6 +293,10 @@ function m.get(key) return config[key] end +function m.getRaw(key) + return rawConfig[key] +end + function m.dump() local dump = {} @@ -359,16 +364,6 @@ function m.event(key, value, oldValue) } end ----@param source config.source -function m.setSource(source) - m._source = source -end - ----@return config.source -function m.getSource() - return m._source -end - function m.init() if m.inited then return diff --git a/script/config/loader.lua b/script/config/loader.lua index 85193eb6..daa370cd 100644 --- a/script/config/loader.lua +++ b/script/config/loader.lua @@ -40,12 +40,14 @@ function m.loadLocalConfig(filename) local path = workspace.getAbsolutePath(filename) if not path then m.lastLocalConfig = nil + m.lastLocalType = nil return nil end local buf = util.loadFile(path) if not buf then errorMessage(lang.script('CONFIG_LOAD_FAILED', path)) m.lastLocalConfig = nil + m.lastLocalType = nil return nil end local firstChar = buf:match '%S' @@ -56,6 +58,7 @@ function m.loadLocalConfig(filename) return m.lastLocalConfig end m.lastLocalConfig = res + m.lastLocalType = 'json' return res else local suc, res = pcall(function () @@ -66,6 +69,7 @@ function m.loadLocalConfig(filename) return m.lastLocalConfig end m.lastLocalConfig = res + m.lastLocalType = 'lua' return res end end |