aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2021-01-22 09:51:32 +0100
committerDavid Schulz <david.schulz@qt.io>2021-01-25 09:58:09 +0000
commit7910dadbca869512b869c927be3c56b9127a2847 (patch)
tree15590c1a1fbfb212b82a224d5772b5b4013ed769 /src
parent90746d86232f6e5525fd6f619e3baf28edc31d6c (diff)
LanguageClient: Do not filter executed commands
The commands provided with the capabilities are not the only allowed commands, but the ones that can always be executed. Change-Id: Ie005fafe2e64c334f67809c00623dec2901972c6 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/plugins/languageclient/client.cpp22
1 files changed, 6 insertions, 16 deletions
diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp
index 7910897059..f3f76b8764 100644
--- a/src/plugins/languageclient/client.cpp
+++ b/src/plugins/languageclient/client.cpp
@@ -708,23 +708,13 @@ void Client::handleCodeActionResponse(const CodeActionRequest::Response &respons
void Client::executeCommand(const Command &command)
{
- using CommandOptions = LanguageServerProtocol::ServerCapabilities::ExecuteCommandOptions;
const QString method(ExecuteCommandRequest::methodName);
- if (Utils::optional<bool> registered = m_dynamicCapabilities.isRegistered(method)) {
- if (!registered.value())
- return;
- const CommandOptions option(m_dynamicCapabilities.option(method).toObject());
- if (option.isValid(nullptr) && !option.commands().isEmpty() && !option.commands().contains(command.command()))
- return;
- } else if (Utils::optional<CommandOptions> option = m_serverCapabilities.executeCommandProvider()) {
- if (option->isValid(nullptr) && !option->commands().isEmpty() && !option->commands().contains(command.command()))
- return;
- } else {
- return;
- }
-
- const ExecuteCommandRequest request((ExecuteCommandParams(command)));
- sendContent(request);
+ bool serverSupportsExecuteCommand = m_serverCapabilities.executeCommandProvider().has_value();
+ serverSupportsExecuteCommand = m_dynamicCapabilities
+ .isRegistered(ExecuteCommandRequest::methodName)
+ .value_or(serverSupportsExecuteCommand);
+ if (serverSupportsExecuteCommand)
+ sendContent(ExecuteCommandRequest(ExecuteCommandParams(command)));
}
static const FormattingOptions formattingOptions(const TextEditor::TabSettings &settings)