1313#include < llvm/ADT/StringRef.h>
1414#include < llvm/Support/Path.h>
1515
16+ #include < rapidjson/document.h>
17+ #include < rapidjson/writer.h>
18+
1619#include < algorithm>
1720#include < ctype.h>
1821#include < functional>
@@ -22,13 +25,29 @@ using namespace llvm;
2225namespace ccls {
2326REFLECT_STRUCT (SymbolInformation, name, kind, location, containerName);
2427
25- void MessageHandler::workspace_didChangeConfiguration (EmptyParam &) {
26- for (auto &[folder, _] : g_config->workspaceFolders )
27- project->load (folder);
28- project->index (wfiles, RequestId ());
28+ void MessageHandler::workspace_didChangeConfiguration (JsonReader &reader) {
29+ auto it = reader.m ->FindMember (" settings" );
30+ if (it != reader.m ->MemberEnd () && it->value .IsObject ()) {
31+ rapidjson::StringBuffer output;
32+ rapidjson::Writer<rapidjson::StringBuffer> writer (output);
33+ JsonReader m1 (&it->value );
34+ it->value .Accept (writer);
35+ LOG_S (INFO) << " didChangeConfiguration: " << output.GetString ();
36+ try {
37+ reflect (m1, *g_config);
38+ } catch (std::invalid_argument &) {
39+ reader.path_ .push_back (" settings" );
40+ reader.path_ .insert (reader.path_ .end (), m1.path_ .begin (), m1.path_ .end ());
41+ throw ;
42+ }
2943
30- manager->clear ();
31- };
44+ for (auto &[folder, _] : g_config->workspaceFolders )
45+ project->load (folder);
46+ project->index (wfiles, RequestId ());
47+
48+ manager->clear ();
49+ }
50+ }
3251
3352void MessageHandler::workspace_didChangeWatchedFiles (
3453 DidChangeWatchedFilesParam ¶m) {
0 commit comments