forked from qt-creator/qt-creator
LanguageClient: Restructure request response handling
Instead of working on a Client member IContent now returns an optional response handler that consists of an id, a name and a callback. Change-Id: I5ca7dd4eaa7ae37f333f99c9fe60339db03ebf2c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -245,7 +245,9 @@ void Client::initialize()
|
||||
initializeCallback(initResponse);
|
||||
});
|
||||
// directly send data otherwise the state check would fail;
|
||||
initRequest.registerResponseHandler(&m_responseHandlers);
|
||||
if (Utils::optional<ResponseHandler> responseHandler = initRequest.responseHandler())
|
||||
m_responseHandlers[responseHandler->id] = responseHandler->callback;
|
||||
|
||||
LanguageClientManager::logBaseMessage(LspLogMessage::ClientMessage,
|
||||
name(),
|
||||
initRequest.toBaseMessage());
|
||||
@@ -321,7 +323,8 @@ void Client::sendContent(const IContent &content)
|
||||
QTC_ASSERT(m_clientInterface, return);
|
||||
QTC_ASSERT(m_state == Initialized, return);
|
||||
sendPostponedDocumentUpdates();
|
||||
content.registerResponseHandler(&m_responseHandlers);
|
||||
if (Utils::optional<ResponseHandler> responseHandler = content.responseHandler())
|
||||
m_responseHandlers[responseHandler->id] = responseHandler->callback;
|
||||
QString error;
|
||||
if (!QTC_GUARD(content.isValid(&error)))
|
||||
Core::MessageManager::write(error);
|
||||
|
||||
Reference in New Issue
Block a user