forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/7.0'
Conflicts: cmake/QtCreatorIDEBranding.cmake qbs/modules/qtc/qtc.qbs qtcreator_ide_branding.pri src/plugins/docker/dockerdevice.cpp src/plugins/mcusupport/mcupackage.cpp src/plugins/mcusupport/mcupackage.h src/plugins/mcusupport/mcusupportoptions.cpp src/plugins/mcusupport/mcusupportoptions.h src/plugins/mcusupport/mcusupportoptionspage.cpp src/plugins/mcusupport/mcusupportsdk.cpp src/plugins/mcusupport/mcusupportsdk.h Change-Id: I8c8f5953a21729ba9178dbc44ed613eed131a0c8
This commit is contained in:
@@ -105,6 +105,10 @@ Client::Client(BaseClientInterface *clientInterface)
|
||||
connect(clientInterface, &BaseClientInterface::messageReceived, this, &Client::handleMessage);
|
||||
connect(clientInterface, &BaseClientInterface::error, this, &Client::setError);
|
||||
connect(clientInterface, &BaseClientInterface::finished, this, &Client::finished);
|
||||
connect(Core::EditorManager::instance(),
|
||||
&Core::EditorManager::documentClosed,
|
||||
this,
|
||||
&Client::documentClosed);
|
||||
|
||||
m_tokenSupport.setTokenTypesMap(SemanticTokens::defaultTokenTypesMap());
|
||||
m_tokenSupport.setTokenModifiersMap(SemanticTokens::defaultTokenModifiersMap());
|
||||
@@ -308,13 +312,11 @@ void Client::initialize()
|
||||
initRequest.setResponseCallback([this](const InitializeRequest::Response &initResponse){
|
||||
initializeCallback(initResponse);
|
||||
});
|
||||
// directly send data otherwise the state check would fail;
|
||||
if (Utils::optional<ResponseHandler> responseHandler = initRequest.responseHandler())
|
||||
m_responseHandlers[responseHandler->id] = responseHandler->callback;
|
||||
|
||||
LanguageClientManager::logBaseMessage(LspLogMessage::ClientMessage,
|
||||
name(),
|
||||
initRequest.toBaseMessage());
|
||||
// directly send message otherwise the state check of sendContent would fail
|
||||
sendMessage(initRequest.toBaseMessage());
|
||||
m_clientInterface->sendMessage(initRequest.toBaseMessage());
|
||||
m_state = InitializeRequested;
|
||||
}
|
||||
@@ -427,9 +429,7 @@ void Client::sendContent(const IContent &content, SendDocUpdates sendUpdates)
|
||||
QString error;
|
||||
if (!QTC_GUARD(content.isValid(&error)))
|
||||
Core::MessageManager::writeFlashing(error);
|
||||
const BaseMessage message = content.toBaseMessage();
|
||||
LanguageClientManager::logBaseMessage(LspLogMessage::ClientMessage, name(), message);
|
||||
m_clientInterface->sendMessage(message);
|
||||
sendMessage(content.toBaseMessage());
|
||||
}
|
||||
|
||||
void Client::cancelRequest(const MessageId &id)
|
||||
@@ -632,6 +632,12 @@ void Client::deactivateDocument(TextEditor::TextDocument *document)
|
||||
}
|
||||
}
|
||||
|
||||
void Client::documentClosed(Core::IDocument *document)
|
||||
{
|
||||
if (auto textDocument = qobject_cast<TextEditor::TextDocument *>(document))
|
||||
closeDocument(textDocument);
|
||||
}
|
||||
|
||||
bool Client::documentOpen(const TextEditor::TextDocument *document) const
|
||||
{
|
||||
return m_openedDocument.contains(const_cast<TextEditor::TextDocument *>(document));
|
||||
@@ -1486,6 +1492,12 @@ void Client::handleDiagnostics(const PublishDiagnosticsParams ¶ms)
|
||||
}
|
||||
}
|
||||
|
||||
void Client::sendMessage(const BaseMessage &message)
|
||||
{
|
||||
LanguageClientManager::logBaseMessage(LspLogMessage::ClientMessage, name(), message);
|
||||
m_clientInterface->sendMessage(message);
|
||||
}
|
||||
|
||||
bool Client::documentUpdatePostponed(const Utils::FilePath &fileName) const
|
||||
{
|
||||
return Utils::contains(m_documentsToUpdate, [fileName](const auto &elem) {
|
||||
@@ -1602,8 +1614,8 @@ void Client::shutDownCallback(const ShutdownRequest::Response &shutdownResponse)
|
||||
qDebug() << error;
|
||||
return;
|
||||
}
|
||||
// directly send data otherwise the state check would fail;
|
||||
m_clientInterface->sendMessage(ExitNotification().toBaseMessage());
|
||||
// directly send message otherwise the state check of sendContent would fail
|
||||
sendMessage(ExitNotification().toBaseMessage());
|
||||
qCDebug(LOGLSPCLIENT) << "language server " << m_displayName << " shutdown";
|
||||
m_state = Shutdown;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user