diff options
author | sumneko <sumneko@hotmail.com> | 2021-10-01 15:43:18 +0800 |
---|---|---|
committer | sumneko <sumneko@hotmail.com> | 2021-10-01 15:43:18 +0800 |
commit | 80cacc02ae952a8dede16ad69c7ed00ed0928a07 (patch) | |
tree | 904c8d5fb61b7f4ef204d7d4ee34cca8faa86ca7 /script/config | |
parent | 98e3b264a52738d79bc914f68207d7f3971ef9ae (diff) | |
download | lua-language-server-80cacc02ae952a8dede16ad69c7ed00ed0928a07.zip |
load config in `.luarc.json`
Diffstat (limited to 'script/config')
-rw-r--r-- | script/config/loader.lua | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/script/config/loader.lua b/script/config/loader.lua index 9f15830d..c7af26d9 100644 --- a/script/config/loader.lua +++ b/script/config/loader.lua @@ -16,6 +16,20 @@ end local m = {} +function m.loadRCConfig(filename) + local path = fs.path(workspace.getAbsolutePath(filename)) + local buf = fsu.loadFile(path) + if not buf then + return + end + local suc, res = pcall(json.decode, buf) + if not suc then + errorMessage(lang.script('CONFIG_LOAD_ERROR', res)) + return + end + return res +end + function m.loadLocalConfig(filename) local path = fs.path(workspace.getAbsolutePath(filename)) local buf = fsu.loadFile(path) |