File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1616
1717local  m  =  {}
1818
19+ function  m .loadRCConfig (filename )
20+  local  path  =  fs .path (workspace .getAbsolutePath (filename ))
21+  local  buf  =  fsu .loadFile (path )
22+  if  not  buf  then 
23+  return 
24+  end 
25+  local  suc , res  =  pcall (json .decode , buf )
26+  if  not  suc  then 
27+  errorMessage (lang .script (' CONFIG_LOAD_ERROR' res ))
28+  return 
29+  end 
30+  return  res 
31+ end 
32+ 
1933function  m .loadLocalConfig (filename )
2034 local  path  =  fs .path (workspace .getAbsolutePath (filename ))
2135 local  buf  =  fsu .loadFile (path )
Original file line number Diff line number Diff line change @@ -22,9 +22,15 @@ local function updateConfig()
2222 config .setSource  ' path' 
2323 log .debug (' load config from local' CONFIGPATH )
2424 else 
25-  new  =  cfgLoader .loadClientConfig ()
26-  config .setSource  ' client' 
27-  log .debug (' load config from client' 
25+  new  =  cfgLoader .loadRCConfig (' .luarc.json' 
26+  if  new  then 
27+  config .setSource  ' luarc' 
28+  log .debug (' load config from luarc' 
29+  else 
30+  new  =  cfgLoader .loadClientConfig ()
31+  config .setSource  ' client' 
32+  log .debug (' load config from client' 
33+  end 
2834 end 
2935 if  not  new  then 
3036 log .warn (' load config failed!' 
                         You can’t perform that action at this time. 
           
                  
0 commit comments