diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-04-06 16:03:18 +0200 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2023-04-11 08:14:57 +0000 |
commit | 205fb14a43e9545b9e46b5019427454d9c947264 (patch) | |
tree | 7e4fbe38c9561a2e8efeca6b8d6b715ae0cacb47 | |
parent | 25f7dfac25e8dd3f73ed5d189e2975843e808439 (diff) | |
download | qt-creator-205fb14a43e9545b9e46b5019427454d9c947264.tar.gz |
ClientRequestTask: A few fixes
1. Rename ClientRequestTaskAdapter into
WorkspaceSymbolRequestTaskAdapter as it's adapting
the WorkspaceSymbolRequestTask, not the general
ClientRequestTask.
2. Rename the registered name inside Tasking namespace
into SymbolRequest, as WorkspaceSymbolRequest
may collide with the class defined inside workspace.h
header. We also aim for rather short names inside
Tasking namespace in order to not to be too verbose.
3. Register the adapter with QTC_DECLARE_CUSTOM_TASK,
not the task itself.
4. Fix isRunning() assert inside start().
5. Drop check for Client::locatorsEnabled() inside
preStartCheck(), as that's being done beforehand
when needed.
Amends 8e9b8933256c1483f1f72ade010ea879550d40d7
Change-Id: I7cef290e18d5d86b48aa17d548a058bf35fd31ec
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r-- | src/plugins/languageclient/clientrequesttask.cpp | 6 | ||||
-rw-r--r-- | src/plugins/languageclient/clientrequesttask.h | 8 |
2 files changed, 7 insertions, 7 deletions
diff --git a/src/plugins/languageclient/clientrequesttask.cpp b/src/plugins/languageclient/clientrequesttask.cpp index c5503bd694..ed3ddaff2c 100644 --- a/src/plugins/languageclient/clientrequesttask.cpp +++ b/src/plugins/languageclient/clientrequesttask.cpp @@ -9,21 +9,21 @@ using namespace LanguageServerProtocol; namespace LanguageClient { -ClientRequestTaskAdapter::ClientRequestTaskAdapter() +WorkspaceSymbolRequestTaskAdapter::WorkspaceSymbolRequestTaskAdapter() { task()->setResponseCallback([this](const WorkspaceSymbolRequest::Response &response){ emit done(response.result().has_value()); }); } -void ClientRequestTaskAdapter::start() +void WorkspaceSymbolRequestTaskAdapter::start() { task()->start(); } bool WorkspaceSymbolRequestTask::preStartCheck() { - if (!ClientRequestTask::preStartCheck() || !client()->locatorsEnabled()) + if (!ClientRequestTask::preStartCheck()) return false; const std::optional<std::variant<bool, WorkDoneProgressOptions>> capability diff --git a/src/plugins/languageclient/clientrequesttask.h b/src/plugins/languageclient/clientrequesttask.h index c2de15e700..dc14d5bf2f 100644 --- a/src/plugins/languageclient/clientrequesttask.h +++ b/src/plugins/languageclient/clientrequesttask.h @@ -31,7 +31,7 @@ public: void start() { - QTC_ASSERT(isRunning(), return); + QTC_ASSERT(!isRunning(), return); QTC_ASSERT(preStartCheck(), m_callback({}); return); Request request(m_params); @@ -65,14 +65,14 @@ public: bool preStartCheck() override; }; -class LANGUAGECLIENT_EXPORT ClientRequestTaskAdapter +class LANGUAGECLIENT_EXPORT WorkspaceSymbolRequestTaskAdapter : public Utils::Tasking::TaskAdapter<WorkspaceSymbolRequestTask> { public: - ClientRequestTaskAdapter(); + WorkspaceSymbolRequestTaskAdapter(); void start() final; }; } // namespace LanguageClient -QTC_DECLARE_CUSTOM_TASK(WorkspaceSymbolRequest, LanguageClient::WorkspaceSymbolRequestTask); +QTC_DECLARE_CUSTOM_TASK(SymbolRequest, LanguageClient::WorkspaceSymbolRequestTaskAdapter); |