mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 12:47:41 +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)
|
void AutoCompleteEngine::set_declarations_of_document(const String& filename, Vector<GUI::AutocompleteProvider::Declaration>&& declarations)
|
||||||
{
|
{
|
||||||
VERIFY(set_declarations_of_document_callback);
|
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)
|
if (m_store_all_declarations)
|
||||||
m_all_declarations.set(filename, declarations);
|
m_all_declarations.set(filename, declarations);
|
||||||
set_declarations_of_document_callback(m_connection, filename, move(declarations));
|
set_declarations_of_document_callback(m_connection, filename, move(declarations));
|
||||||
|
|
|
@ -37,7 +37,7 @@
|
||||||
namespace LanguageServers::Cpp {
|
namespace LanguageServers::Cpp {
|
||||||
|
|
||||||
ParserAutoComplete::ParserAutoComplete(ClientConnection& connection, const FileDB& filedb)
|
ParserAutoComplete::ParserAutoComplete(ClientConnection& connection, const FileDB& filedb)
|
||||||
: AutoCompleteEngine(connection, filedb)
|
: AutoCompleteEngine(connection, filedb, true)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue