From 9ca930554fa8b185d5990b7a00489f010689b584 Mon Sep 17 00:00:00 2001 From: Alexis Murzeau Date: Sun, 26 Apr 2020 21:23:03 +0200 Subject: 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 --- src/plugins/languageclient/languageclientoutline.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/plugins/languageclient') diff --git a/src/plugins/languageclient/languageclientoutline.cpp b/src/plugins/languageclient/languageclientoutline.cpp index 9655509229..89f19b04a5 100644 --- a/src/plugins/languageclient/languageclientoutline.cpp +++ b/src/plugins/languageclient/languageclientoutline.cpp @@ -187,6 +187,9 @@ void LanguageClientOutlineWidget::handleResponse(const DocumentUri &uri, m_model.setInfo(Utils::get>(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>(result)); else m_model.clear(); + + // The list has changed, update the current item + updateEntry(); } void OutlineComboBox::updateEntry() -- cgit v1.2.3