LanguageClient: optimize call and type hierarchy

Trigger a fetch from the can fetch function in order to get whether the
item has children. This information is used to show the expansion marker
for items that have children, and not for items that have not been
fetched yet.

Change-Id: Ifc20588aa805368369e72fc8501244f64bbbc91d
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
David Schulz
2024-06-25 15:25:56 +02:00
parent eeaf1e18e0
commit 269fc1fd6b

View File

@@ -76,7 +76,12 @@ protected:
} }
private: private:
bool canFetchMore() const override { return m_client && !m_fetchedChildren; } bool canFetchMore() const override
{
if (m_client && !m_fetchedChildren)
const_cast<HierarchyItem*>(this)->fetchMore();
return false;
}
void fetchMore() override void fetchMore() override
{ {
@@ -96,8 +101,6 @@ private:
appendChild(new HierarchyItem(getSourceItem(item), m_client)); appendChild(new HierarchyItem(getSourceItem(item), m_client));
} }
} }
if (!hasChildren())
update();
}); });
m_client->sendMessage(request); m_client->sendMessage(request);
} }