diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2021-11-22 20:42:16 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2021-11-22 20:42:16 +0800 |
commit | e9ef67eb9f999aa51ac793cd70252e5587eb3bd6 (patch) | |
tree | 500a08121f1dc3975be11c04787733510e13c7a6 /script | |
parent | 22cfc98fa8684002e6ab8a8279e898862ba0f494 (diff) | |
download | lua-language-server-e9ef67eb9f999aa51ac793cd70252e5587eb3bd6.zip |
add `$schema`
Diffstat (limited to 'script')
-rw-r--r-- | script/client.lua | 8 | ||||
-rw-r--r-- | script/provider/provider.lua | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/script/client.lua b/script/client.lua index 0409b742..d9ec0c16 100644 --- a/script/client.lua +++ b/script/client.lua @@ -207,7 +207,7 @@ end local function tryModifyRC(finalChanges, create) if #finalChanges == 0 then - return + return false end local workspace = require 'workspace' local loader = require 'config.loader' @@ -219,7 +219,9 @@ local function tryModifyRC(finalChanges, create) if not buf and not create then return false end - local rc = loader.lastRCConfig or {} + local rc = loader.lastRCConfig or { + ['$schema'] = lang.id == 'zh-cn' and [[https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema-zh-cn.json]] or [[https://raw.githubusercontent.com/sumneko/vscode-lua/master/setting/schema.json]] + } applyConfig(rc, finalChanges) util.saveFile(path, json.beautify(rc, { indent = ' ' })) return true @@ -227,7 +229,7 @@ end local function tryModifyClient(finalChanges) if #finalChanges == 0 then - return + return false end if not m.getOption 'changeConfiguration' then return false diff --git a/script/provider/provider.lua b/script/provider/provider.lua index 564c3ad9..ead0ca46 100644 --- a/script/provider/provider.lua +++ b/script/provider/provider.lua @@ -29,8 +29,8 @@ end local function updateConfig() local merged = {} - if CONFIGPATH then - local cfg = cfgLoader.loadLocalConfig(CONFIGPATH) + local cfg = cfgLoader.loadLocalConfig(CONFIGPATH) + if cfg then log.debug('load config from local', CONFIGPATH) -- watch directory filewatch.watch(workspace.getAbsolutePath(CONFIGPATH):gsub('[^/\\]+$', '')) |