MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / update_config

Function update_config

CodeFormatLib/src/CodeFormatLib.cpp:306–342  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

304}
305
306int update_config(lua_State *L) {
307 int top = lua_gettop(L);
308
309 if (top < 3) {
310 return 0;
311 }
312
313 if (lua_isinteger(L, 1) && lua_isstring(L, 2) && lua_isstring(L, 3)) {
314 try {
315 auto type = static_cast<UpdateType>(lua_tointeger(L, 1));
316 std::string workspaceUri = lua_tostring(L, 2);
317 std::string configPath = lua_tostring(L, 3);
318 switch (type) {
319 case UpdateType::Created:
320 case UpdateType::Changed: {
321 LuaCodeFormat::GetInstance().UpdateCodeStyle(workspaceUri, configPath);
322 break;
323 }
324 case UpdateType::Deleted: {
325 LuaCodeFormat::GetInstance().RemoveCodeStyle(workspaceUri);
326 break;
327 }
328 }
329
330 lua_pushboolean(L, true);
331 return 1;
332 } catch (std::exception &e) {
333 std::string err = e.what();
334 lua_settop(L, top);
335 lua_pushboolean(L, false);
336 lua_pushlstring(L, err.c_str(), err.size());
337 return 2;
338 }
339 }
340
341 return 0;
342}
343
344void PushDiagnosticToLua(lua_State *L, std::vector<LuaDiagnosticInfo> &diagnosticInfos) {
345 int count = 1;

Callers

nothing calls this directly

Calls 10

lua_gettopFunction · 0.85
lua_isstringFunction · 0.85
lua_pushbooleanFunction · 0.85
lua_settopFunction · 0.85
lua_pushlstringFunction · 0.85
lua_isintegerFunction · 0.70
UpdateCodeStyleMethod · 0.45
RemoveCodeStyleMethod · 0.45
whatMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected