summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/DevTools/HackStudio/LanguageServers/AutoCompleteEngine.cpp6
-rw-r--r--Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp2
2 files changed, 7 insertions, 1 deletions
diff --git a/Userland/DevTools/HackStudio/LanguageServers/AutoCompleteEngine.cpp b/Userland/DevTools/HackStudio/LanguageServers/AutoCompleteEngine.cpp
index 718f69a96d..5e8d570805 100644
--- a/Userland/DevTools/HackStudio/LanguageServers/AutoCompleteEngine.cpp
+++ b/Userland/DevTools/HackStudio/LanguageServers/AutoCompleteEngine.cpp
@@ -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));
diff --git a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp
index dd402047f5..9f269c6659 100644
--- a/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp
+++ b/Userland/DevTools/HackStudio/LanguageServers/Cpp/ParserAutoComplete.cpp
@@ -37,7 +37,7 @@
namespace LanguageServers::Cpp {
ParserAutoComplete::ParserAutoComplete(ClientConnection& connection, const FileDB& filedb)
- : AutoCompleteEngine(connection, filedb)
+ : AutoCompleteEngine(connection, filedb, true)
{
}