mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 08:28:11 +00:00
HackStudio: Keep the DeclarationsModel around, and use a filtering proxy
Rather than construct a new DeclarationsModel each time the user types something in the Locator, keep a single one around permanently in the ProjectDeclarations, and then use a FilteringProxyModel over it for the suggestions.
This commit is contained in:
parent
e72b14ef1d
commit
85101c6626
6 changed files with 78 additions and 22 deletions
|
@ -1,11 +1,13 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Itamar S. <itamar8910@gmail.com>
|
||||
* Copyright (c) 2024, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "DeclarationsModel.h"
|
||||
#include <AK/ByteString.h>
|
||||
#include <AK/Function.h>
|
||||
#include <AK/HashMap.h>
|
||||
|
@ -25,13 +27,18 @@ public:
|
|||
|
||||
void set_declared_symbols(ByteString const& filename, Vector<CodeComprehension::Declaration> const&);
|
||||
|
||||
DeclarationsModel& declarations_model() { return m_declarations_model; }
|
||||
void update_declarations_model();
|
||||
|
||||
static Optional<GUI::Icon> get_icon_for(CodeComprehension::DeclarationType);
|
||||
|
||||
Function<void()> on_update = nullptr;
|
||||
|
||||
private:
|
||||
ProjectDeclarations() = default;
|
||||
ProjectDeclarations();
|
||||
|
||||
HashMap<ByteString, Vector<CodeComprehension::Declaration>> m_document_to_declarations;
|
||||
NonnullRefPtr<DeclarationsModel> m_declarations_model;
|
||||
};
|
||||
|
||||
template<typename Func>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue