aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/languageclient/clientrequest.cpp
diff options
context:
space:
mode:
authorEike Ziller <[email protected]>2024-05-06 16:49:18 +0200
committerEike Ziller <[email protected]>2024-05-07 10:41:32 +0000
commit770f1b0376db49b9ea5aad906dd6165ab71d9152 (patch)
tree82550a2b183ac1dca16ee9716062302a08a9a66a /src/plugins/languageclient/clientrequest.cpp
parent67072d3f5bb1b425a2b9d3bf30d57542e9f88902 (diff)
LanguageClient: Avoid calling throwing functions
Similar to with std::optional we want to avoid calling throwing functions for std::variant, which includes std::get. In many cases this also avoids the chain of `std::holds_alternative` + `std::get` calls. And we never declare any `throws`. Change-Id: I14f62ddef921b6bee90226ea34d1ffa62629bdc3 Reviewed-by: David Schulz <[email protected]> Reviewed-by: <[email protected]>
Diffstat (limited to 'src/plugins/languageclient/clientrequest.cpp')
-rw-r--r--src/plugins/languageclient/clientrequest.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/plugins/languageclient/clientrequest.cpp b/src/plugins/languageclient/clientrequest.cpp
index 4e221f1b9d4..3125b25a72c 100644
--- a/src/plugins/languageclient/clientrequest.cpp
+++ b/src/plugins/languageclient/clientrequest.cpp
@@ -29,7 +29,8 @@ bool ClientWorkspaceSymbolRequest::preStartCheck()
= client()->capabilities().workspaceSymbolProvider();
if (!capability.has_value())
return false;
- if (std::holds_alternative<bool>(*capability) && !std::get<bool>(*capability))
+ const auto boolvalue = std::get_if<bool>(&*capability);
+ if (boolvalue && !boolvalue)
return false;
return true;