Commit 153c8710 authored by Mark Nauwelaerts's avatar Mark Nauwelaerts
Browse files

lspclient: optimize to only update marks in applicable cases

parent 92cb3daa
...@@ -1640,7 +1640,7 @@ public: ...@@ -1640,7 +1640,7 @@ public:
} }
} }
// update marks // update marks
updateState(); updateMarks();
} }
}; };
...@@ -2114,7 +2114,7 @@ public: ...@@ -2114,7 +2114,7 @@ public:
m_diagnosticsTree->setRowHidden(topItem->row(), QModelIndex(), topItem->rowCount() == 0); m_diagnosticsTree->setRowHidden(topItem->row(), QModelIndex(), topItem->rowCount() == 0);
m_diagnosticsTree->scrollTo(topItem->index(), QAbstractItemView::PositionAtTop); m_diagnosticsTree->scrollTo(topItem->index(), QAbstractItemView::PositionAtTop);
updateState(); updateMarks();
// also sync updated diagnositic to current position // also sync updated diagnositic to current position
auto currentView = m_mainWindow->activeView(); auto currentView = m_mainWindow->activeView();
if (currentView && currentView->document()) { if (currentView && currentView->document()) {
...@@ -2402,6 +2402,21 @@ public: ...@@ -2402,6 +2402,21 @@ public:
// so register anyway if server available and will sort out what to do/show later // so register anyway if server available and will sort out what to do/show later
updateHover(activeView, server.data()); updateHover(activeView, server.data());
updateMarks(doc);
// connect for cleanup stuff
if (activeView) {
connect(activeView, &KTextEditor::View::destroyed, this, &self_type::viewDestroyed, Qt::UniqueConnection);
}
}
void updateMarks(KTextEditor::Document *doc = nullptr)
{
if (!doc) {
KTextEditor::View *activeView = m_mainWindow->activeView();
doc = activeView ? activeView->document() : nullptr;
}
// update marks if applicable // update marks if applicable
if (m_markModel && doc) { if (m_markModel && doc) {
addMarks(doc, m_markModel, m_ranges, m_marks); addMarks(doc, m_markModel, m_ranges, m_marks);
...@@ -2410,11 +2425,6 @@ public: ...@@ -2410,11 +2425,6 @@ public:
clearMarks(doc, m_diagnosticsRanges, m_diagnosticsMarks, RangeData::markTypeDiagAll); clearMarks(doc, m_diagnosticsRanges, m_diagnosticsMarks, RangeData::markTypeDiagAll);
addMarks(doc, m_diagnosticsModel.data(), m_diagnosticsRanges, m_diagnosticsMarks); addMarks(doc, m_diagnosticsModel.data(), m_diagnosticsRanges, m_diagnosticsMarks);
} }
// connect for cleanup stuff
if (activeView) {
connect(activeView, &KTextEditor::View::destroyed, this, &self_type::viewDestroyed, Qt::UniqueConnection);
}
} }
void viewDestroyed(QObject *view) void viewDestroyed(QObject *view)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment