mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 03:18:11 +00:00
LanguageServers: Only notify client about updated declarations
If the declarations haven't changed since we last notified the client, then there's no need to do so.
This commit is contained in:
parent
667926df73
commit
5adfcd54d8
2 changed files with 7 additions and 1 deletions
|
@ -41,6 +41,12 @@ AutoCompleteEngine::~AutoCompleteEngine()
|
|||
void AutoCompleteEngine::set_declarations_of_document(const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations)
|
||||
{
|
||||
VERIFY(set_declarations_of_document_callback);
|
||||
|
||||
// Optimization - Only notify callback if declerations have changed
|
||||
if (auto previous_declarations = m_all_declarations.get(filename); previous_declarations.has_value()) {
|
||||
if (previous_declarations.value() == declarations)
|
||||
return;
|
||||
}
|
||||
if (m_store_all_declarations)
|
||||
m_all_declarations.set(filename, declarations);
|
||||
set_declarations_of_document_callback(m_connection, filename, move(declarations));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue