forked from qt-creator/qt-creator
LanguageClient: update outline after document
Do not react on documents contents changes, but postpone the document symbol request after these document changes were send to the server. Change-Id: I43ec8f832c6a1fa6471146a5ec6e3e9223b02c91 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -283,7 +283,7 @@ private:
|
|||||||
void updateModel(const DocumentUri &resultUri, const DocumentSymbolsResult &result);
|
void updateModel(const DocumentUri &resultUri, const DocumentSymbolsResult &result);
|
||||||
void updateEntry();
|
void updateEntry();
|
||||||
void activateEntry();
|
void activateEntry();
|
||||||
void requestSymbols();
|
void documentUpdated(TextEditor::TextDocument *document);
|
||||||
|
|
||||||
LanguageClientOutlineModel m_model;
|
LanguageClientOutlineModel m_model;
|
||||||
QPointer<Client> m_client;
|
QPointer<Client> m_client;
|
||||||
@@ -318,13 +318,12 @@ OutlineComboBox::OutlineComboBox(Client *client, TextEditor::BaseTextEditor *edi
|
|||||||
|
|
||||||
connect(client->documentSymbolCache(), &DocumentSymbolCache::gotSymbols,
|
connect(client->documentSymbolCache(), &DocumentSymbolCache::gotSymbols,
|
||||||
this, &OutlineComboBox::updateModel);
|
this, &OutlineComboBox::updateModel);
|
||||||
connect(editor->textDocument(), &TextEditor::TextDocument::contentsChanged,
|
connect(client, &Client::documentUpdated, this, &OutlineComboBox::documentUpdated);
|
||||||
this, &OutlineComboBox::requestSymbols);
|
|
||||||
connect(m_editorWidget, &TextEditor::TextEditorWidget::cursorPositionChanged,
|
connect(m_editorWidget, &TextEditor::TextEditorWidget::cursorPositionChanged,
|
||||||
this, &OutlineComboBox::updateEntry);
|
this, &OutlineComboBox::updateEntry);
|
||||||
connect(this, QOverload<int>::of(&QComboBox::activated), this, &OutlineComboBox::activateEntry);
|
connect(this, QOverload<int>::of(&QComboBox::activated), this, &OutlineComboBox::activateEntry);
|
||||||
|
|
||||||
requestSymbols();
|
documentUpdated(editor->textDocument());
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutlineComboBox::updateModel(const DocumentUri &resultUri, const DocumentSymbolsResult &result)
|
void OutlineComboBox::updateModel(const DocumentUri &resultUri, const DocumentSymbolsResult &result)
|
||||||
@@ -365,9 +364,9 @@ void OutlineComboBox::activateEntry()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutlineComboBox::requestSymbols()
|
void OutlineComboBox::documentUpdated(TextEditor::TextDocument *document)
|
||||||
{
|
{
|
||||||
if (m_client)
|
if (document == m_editorWidget->textDocument())
|
||||||
m_client->documentSymbolCache()->requestSymbols(m_uri);
|
m_client->documentSymbolCache()->requestSymbols(m_uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user