| 25 | } |
| 26 | |
| 27 | void ClientConfig::Deserialize(nlohmann::json json) { |
| 28 | auto root = configTree.GetRoot(); |
| 29 | |
| 30 | if (json["emmylua"].is_object()) { |
| 31 | auto emmylua = json["emmylua"]; |
| 32 | if (emmylua["lint"].is_object()) { |
| 33 | auto lint = emmylua["lint"]; |
| 34 | if (lint["codeStyle"].is_boolean()) { |
| 35 | root.AddChild("code_style_check", bool(lint["codeStyle"])); |
| 36 | } |
| 37 | if (lint["nameStyle"].is_boolean()) { |
| 38 | root.AddChild("name_style_check", bool(lint["nameStyle"])); |
| 39 | } |
| 40 | if (lint["spellCheck"].is_boolean()) { |
| 41 | root.AddChild("spell_check", bool(lint["spellCheck"])); |
| 42 | } |
| 43 | } |
| 44 | |
| 45 | if (emmylua["spell"].is_object()) { |
| 46 | auto spell = emmylua["spell"]; |
| 47 | if (spell["dict"].is_array()) { |
| 48 | emmylua_spell_dict.clear(); |
| 49 | for (auto j: spell["dict"]) { |
| 50 | if (j.is_string()) { |
| 51 | emmylua_spell_dict.push_back(j); |
| 52 | } |
| 53 | } |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | if (emmylua["name"].is_object()) { |
| 58 | auto name = emmylua["name"]; |
| 59 | if (name["config"].is_object()) { |
| 60 | for (auto &[key, valueJson]: name["config"].items()) { |
| 61 | root.AddChild(key, CreateFromJson(configTree, valueJson)); |
| 62 | } |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | } |
nothing calls this directly
no test coverage detected