Core: Allow to pass a reason for a failed search

... and make use of it in the LanguageClient.

Change-Id: I7e47a7419c7168c5e26709ae225e4887d4c5089b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Christian Kandeler
2022-09-20 14:07:53 +02:00
parent 380362e75d
commit 5c0cafa68e
5 changed files with 16 additions and 10 deletions

View File

@@ -401,8 +401,11 @@ void SymbolSupport::handleRenameResponse(Core::SearchResult *search,
const RenameRequest::Response &response)
{
const std::optional<PrepareRenameRequest::Response::Error> &error = response.error();
if (error.has_value())
QString errorMessage;
if (error.has_value()) {
m_client->log(*error);
errorMessage = error->toString();
}
const std::optional<WorkspaceEdit> &edits = response.result();
if (edits.has_value()) {
@@ -412,7 +415,7 @@ void SymbolSupport::handleRenameResponse(Core::SearchResult *search,
search->setSearchAgainEnabled(false);
search->finishSearch(false);
} else {
search->finishSearch(error.has_value());
search->finishSearch(error.has_value(), errorMessage);
}
}