forked from qt-creator/qt-creator
LanguageClient: connect each editor widget to the LanguageClientManager
... not just the first returned by BaseTextEditor::textEditorForDocument Change-Id: I262cd68e6dea59aa23be718fb85d2ae68c40ef39 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -195,28 +195,29 @@ void LanguageClientManager::clientFinished(Client *client)
|
||||
}
|
||||
}
|
||||
|
||||
void LanguageClientManager::documentOpened(Core::IDocument *document)
|
||||
void LanguageClientManager::editorOpened(Core::IEditor *editor)
|
||||
{
|
||||
using namespace TextEditor;
|
||||
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()) {
|
||||
if (auto *textEditor = qobject_cast<BaseTextEditor *>(editor)) {
|
||||
if (TextEditorWidget *widget = textEditor->editorWidget()) {
|
||||
connect(widget, &TextEditorWidget::requestLinkAt, this,
|
||||
[this, filePath = document->filePath()]
|
||||
[this, filePath = editor->document()->filePath()]
|
||||
(const QTextCursor &cursor, Utils::ProcessLinkCallback &callback){
|
||||
findLinkAt(filePath, cursor, callback);
|
||||
});
|
||||
connect(widget, &TextEditorWidget::requestUsages, this,
|
||||
[this, filePath = document->filePath()]
|
||||
[this, filePath = editor->document()->filePath()]
|
||||
(const QTextCursor &cursor){
|
||||
findUsages(filePath, cursor);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LanguageClientManager::documentOpened(Core::IDocument *document)
|
||||
{
|
||||
for (Client *interface : reachableClients())
|
||||
interface->openDocument(document);
|
||||
}
|
||||
|
||||
void LanguageClientManager::documentClosed(Core::IDocument *document)
|
||||
|
||||
@@ -75,6 +75,7 @@ signals:
|
||||
private:
|
||||
LanguageClientManager();
|
||||
|
||||
void editorOpened(Core::IEditor *editor);
|
||||
void documentOpened(Core::IDocument *document);
|
||||
void documentClosed(Core::IDocument *document);
|
||||
void documentContentsSaved(Core::IDocument *document);
|
||||
|
||||
Reference in New Issue
Block a user