diff --git a/src/plugins/languageclient/languageclientmanager.cpp b/src/plugins/languageclient/languageclientmanager.cpp index 614617edda4..6fcb7c61533 100644 --- a/src/plugins/languageclient/languageclientmanager.cpp +++ b/src/plugins/languageclient/languageclientmanager.cpp @@ -205,20 +205,18 @@ void LanguageClientManager::editorOpened(Core::IEditor *iEditor) for (Client *interface : reachableClients()) interface->openDocument(document); - if (auto textDocument = qobject_cast(document)) { - if (BaseTextEditor *editor = BaseTextEditor::textEditorForDocument(textDocument)) { - if (TextEditorWidget *widget = editor->editorWidget()) { - connect(widget, &TextEditorWidget::requestLinkAt, this, - [this, filePath = document->filePath()] - (const QTextCursor &cursor, Utils::ProcessLinkCallback &callback){ - findLinkAt(filePath, cursor, callback); - }); - connect(widget, &TextEditorWidget::requestUsages, this, - [this, filePath = document->filePath()] - (const QTextCursor &cursor){ - findUsages(filePath, cursor); - }); - } + if (BaseTextEditor *editor = qobject_cast(iEditor)) { + if (TextEditorWidget *widget = editor->editorWidget()) { + connect(widget, &TextEditorWidget::requestLinkAt, this, + [this, filePath = document->filePath()] + (const QTextCursor &cursor, Utils::ProcessLinkCallback &callback) { + findLinkAt(filePath, cursor, callback); + }); + connect(widget, &TextEditorWidget::requestUsages, this, + [this, filePath = document->filePath()] + (const QTextCursor &cursor) { + findUsages(filePath, cursor); + }); } } }