forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -708,23 +708,13 @@ void Client::handleCodeActionResponse(const CodeActionRequest::Response &respons
|
|||||||
|
|
||||||
void Client::executeCommand(const Command &command)
|
void Client::executeCommand(const Command &command)
|
||||||
{
|
{
|
||||||
using CommandOptions = LanguageServerProtocol::ServerCapabilities::ExecuteCommandOptions;
|
|
||||||
const QString method(ExecuteCommandRequest::methodName);
|
const QString method(ExecuteCommandRequest::methodName);
|
||||||
if (Utils::optional<bool> registered = m_dynamicCapabilities.isRegistered(method)) {
|
bool serverSupportsExecuteCommand = m_serverCapabilities.executeCommandProvider().has_value();
|
||||||
if (!registered.value())
|
serverSupportsExecuteCommand = m_dynamicCapabilities
|
||||||
return;
|
.isRegistered(ExecuteCommandRequest::methodName)
|
||||||
const CommandOptions option(m_dynamicCapabilities.option(method).toObject());
|
.value_or(serverSupportsExecuteCommand);
|
||||||
if (option.isValid(nullptr) && !option.commands().isEmpty() && !option.commands().contains(command.command()))
|
if (serverSupportsExecuteCommand)
|
||||||
return;
|
sendContent(ExecuteCommandRequest(ExecuteCommandParams(command)));
|
||||||
} 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const FormattingOptions formattingOptions(const TextEditor::TabSettings &settings)
|
static const FormattingOptions formattingOptions(const TextEditor::TabSettings &settings)
|
||||||
|
Reference in New Issue
Block a user