early return and add a comment

This commit is contained in:
Fangrui Song 2024-11-23 17:51:50 -08:00
parent e55cc6865c
commit 5d401fc95d

View File

@ -27,26 +27,28 @@ REFLECT_STRUCT(SymbolInformation, name, kind, location, containerName);
void MessageHandler::workspace_didChangeConfiguration(JsonReader &reader) {
auto it = reader.m->FindMember("settings");
if (it != reader.m->MemberEnd() && it->value.IsObject()) {
rapidjson::StringBuffer output;
rapidjson::Writer<rapidjson::StringBuffer> writer(output);
JsonReader m1(&it->value);
it->value.Accept(writer);
LOG_S(INFO) << "didChangeConfiguration: " << output.GetString();
try {
reflect(m1, *g_config);
} catch (std::invalid_argument &) {
reader.path_.push_back("settings");
reader.path_.insert(reader.path_.end(), m1.path_.begin(), m1.path_.end());
throw;
}
if (!(it != reader.m->MemberEnd() && it->value.IsObject()))
return;
for (auto &[folder, _] : g_config->workspaceFolders)
project->load(folder);
project->index(wfiles, RequestId());
manager->clear();
// Similar to MessageHandler::initialize.
rapidjson::StringBuffer output;
rapidjson::Writer<rapidjson::StringBuffer> writer(output);
JsonReader m1(&it->value);
it->value.Accept(writer);
LOG_S(INFO) << "didChangeConfiguration: " << output.GetString();
try {
reflect(m1, *g_config);
} catch (std::invalid_argument &) {
reader.path_.push_back("settings");
reader.path_.insert(reader.path_.end(), m1.path_.begin(), m1.path_.end());
throw;
}
for (auto &[folder, _] : g_config->workspaceFolders)
project->load(folder);
project->index(wfiles, RequestId());
manager->clear();
}
void MessageHandler::workspace_didChangeWatchedFiles(