forked from qt-creator/qt-creator
Client: rerequest document highlight if server is unreachable
Makes sure the highlight is properly updated and prevents assert in Client::sendMessage. Change-Id: Ie7ad54c34272867e17f6e20654f27e2fd8711fdc Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -774,9 +774,13 @@ void ClientPrivate::requestDocumentHighlights(TextEditor::TextEditorWidget *widg
|
|||||||
delete m_documentHighlightsTimer.take(widget);
|
delete m_documentHighlightsTimer.take(widget);
|
||||||
});
|
});
|
||||||
connect(timer, &QTimer::timeout, this, [this, widget, connection]() {
|
connect(timer, &QTimer::timeout, this, [this, widget, connection]() {
|
||||||
|
if (q->reachable()) {
|
||||||
disconnect(connection);
|
disconnect(connection);
|
||||||
requestDocumentHighlightsNow(widget);
|
requestDocumentHighlightsNow(widget);
|
||||||
m_documentHighlightsTimer.take(widget)->deleteLater();
|
m_documentHighlightsTimer.take(widget)->deleteLater();
|
||||||
|
} else {
|
||||||
|
m_documentHighlightsTimer[widget]->start(250);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
timer->start(250);
|
timer->start(250);
|
||||||
@@ -784,6 +788,7 @@ void ClientPrivate::requestDocumentHighlights(TextEditor::TextEditorWidget *widg
|
|||||||
|
|
||||||
void ClientPrivate::requestDocumentHighlightsNow(TextEditor::TextEditorWidget *widget)
|
void ClientPrivate::requestDocumentHighlightsNow(TextEditor::TextEditorWidget *widget)
|
||||||
{
|
{
|
||||||
|
QTC_ASSERT(q->reachable(), return);
|
||||||
const auto uri = DocumentUri::fromFilePath(widget->textDocument()->filePath());
|
const auto uri = DocumentUri::fromFilePath(widget->textDocument()->filePath());
|
||||||
if (m_dynamicCapabilities.isRegistered(DocumentHighlightsRequest::methodName).value_or(false)) {
|
if (m_dynamicCapabilities.isRegistered(DocumentHighlightsRequest::methodName).value_or(false)) {
|
||||||
TextDocumentRegistrationOptions option(
|
TextDocumentRegistrationOptions option(
|
||||||
|
Reference in New Issue
Block a user