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:
Alexis Murzeau
2020-04-26 21:23:03 +02:00
parent 15419cb145
commit 9ca930554f

View File

@@ -187,6 +187,9 @@ void LanguageClientOutlineWidget::handleResponse(const DocumentUri &uri,
m_model.setInfo(Utils::get<QList<DocumentSymbol>>(result)); m_model.setInfo(Utils::get<QList<DocumentSymbol>>(result));
else else
m_model.clear(); m_model.clear();
// The list has changed, update the current items
updateSelectionInTree(m_editor->textCursor());
} }
void LanguageClientOutlineWidget::updateTextCursor(const QModelIndex &proxyIndex) 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)); m_model.setInfo(Utils::get<QList<DocumentSymbol>>(result));
else else
m_model.clear(); m_model.clear();
// The list has changed, update the current item
updateEntry();
} }
void OutlineComboBox::updateEntry() void OutlineComboBox::updateEntry()