diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-05-16 18:30:37 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-16 18:30:37 +0800 |
commit | dd3bf8c1b3c9d371db93e8dbe5c5cd012e824d76 (patch) | |
tree | 1594d5b620d70168384bea656cc8c89a2affebb8 | |
parent | cbcbab98990b77339418209466ae037dbfec0eee (diff) | |
parent | f63ac95e2c30965f280b417647c34fd3fe7adf1d (diff) | |
download | lua-language-server-dd3bf8c1b3c9d371db93e8dbe5c5cd012e824d76.zip |
Merge pull request #1145 from kevinhwang91/check-jsonc-exist
fix(client): check .luarc.jsonc existed
-rw-r--r-- | script/client.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/script/client.lua b/script/client.lua index d86fb4f2..2ce29803 100644 --- a/script/client.lua +++ b/script/client.lua @@ -1,3 +1,4 @@ +local fs = require 'bee.filesystem' local nonil = require 'without-check-nil' local util = require 'utility' local lang = require 'language' @@ -247,11 +248,11 @@ local function tryModifyRC(uri, finalChanges, create) return false end local workspace = require 'workspace' - local path = workspace.getAbsolutePath(uri, '.luarc.json') - or workspace.getAbsolutePath(uri, '.luarc.jsonc') + local path = workspace.getAbsolutePath(uri, '.luarc.jsonc') if not path then return false end + path = fs.exists(path) and path or workspace.getAbsolutePath(uri, '.luarc.json') local buf = util.loadFile(path) if not buf and not create then return false |