The configuration may kick off indexing, which may involve sending LSP
messages.
The crash is fiddly to reproduce in a hermetic test (we need background
indexing on without disk storage, and to handle server->client messages
in LSPClient...)
Fixes https://github.com/clangd/clangd/issues/926
Server.emplace(*CDB, TFS, Opts,
static_cast<ClangdServer::Callbacks *>(this));
}
- applyConfiguration(Params.initializationOptions.ConfigSettings);
Opts.CodeComplete.EnableSnippets = Params.capabilities.CompletionSnippets;
Opts.CodeComplete.IncludeFixIts = Params.capabilities.CompletionFixes;
if (Opts.Encoding)
Result["offsetEncoding"] = *Opts.Encoding;
Reply(std::move(Result));
+
+ // Apply settings after we're fully initialized.
+ // This can start background indexing and in turn trigger LSP notifications.
+ applyConfiguration(Params.initializationOptions.ConfigSettings);
}
void ClangdLSPServer::onInitialized(const InitializedParams &Params) {}