diff options
author | David Schulz <david.schulz@qt.io> | 2019-03-12 13:04:41 +0100 |
---|---|---|
committer | David Schulz <david.schulz@qt.io> | 2019-03-12 13:46:59 +0000 |
commit | a78bbe48cccf87877ef988cc145e58e64543573b (patch) | |
tree | 4859037ac47e1bcef7e3e0f74bcf45020bcad3b3 /src/plugins/languageclient/languageclientmanager.cpp | |
parent | bbbf7272726a89a6637a50660af549452d07c4e6 (diff) |
LanguageClient: connect the opened editor to LanguageClientManager
... and not just the first one returned by
BaseTextEditor::textEditorForDocument
Change-Id: I39e9271b3a2b6c0f131a5ce77959a8d57e462397
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'src/plugins/languageclient/languageclientmanager.cpp')
-rw-r--r-- | src/plugins/languageclient/languageclientmanager.cpp | 26 |
1 files changed, 12 insertions, 14 deletions
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<TextDocument *>(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<BaseTextEditor *>(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); + }); } } } |