forked from qt-creator/qt-creator
LSP: fix outline's selected item when writing
When receiving textDocument/documentSymbol or textDocument/symbolInformation, the outline widget and the outline combobox is cleared and updated with received symbols. This causes the selected index to become the first item of the list when writing text. Fix the issue by updating the selected index after having updated the outline widget and outline combobox. Change-Id: I52541940f8a979cbf130da4383db48c470fc94e1 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -187,6 +187,9 @@ void LanguageClientOutlineWidget::handleResponse(const DocumentUri &uri,
|
||||
m_model.setInfo(Utils::get<QList<DocumentSymbol>>(result));
|
||||
else
|
||||
m_model.clear();
|
||||
|
||||
// The list has changed, update the current items
|
||||
updateSelectionInTree(m_editor->textCursor());
|
||||
}
|
||||
|
||||
void LanguageClientOutlineWidget::updateTextCursor(const QModelIndex &proxyIndex)
|
||||
@@ -313,6 +316,9 @@ void OutlineComboBox::updateModel(const DocumentUri &resultUri, const DocumentSy
|
||||
m_model.setInfo(Utils::get<QList<DocumentSymbol>>(result));
|
||||
else
|
||||
m_model.clear();
|
||||
|
||||
// The list has changed, update the current item
|
||||
updateEntry();
|
||||
}
|
||||
|
||||
void OutlineComboBox::updateEntry()
|
||||
|
Reference in New Issue
Block a user