1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibGUI+HackStudio: Add an opt-in autocompletion interface to TextEditor

...and use that to implement autocomplete in HackStudio.

Now everyone can have autocomplete :^)
This commit is contained in:
AnotherTest 2020-12-30 13:55:06 +03:30 committed by Andreas Kling
parent 7e457b98c3
commit 20b74e4ede
19 changed files with 211 additions and 162 deletions

View file

@ -30,6 +30,7 @@
#include <AK/NonnullOwnPtrVector.h>
#include <AK/NonnullRefPtrVector.h>
#include <LibCore/ElapsedTimer.h>
#include <LibGUI/Forward.h>
#include <LibGUI/ScrollableWidget.h>
#include <LibGUI/TextDocument.h>
#include <LibGUI/TextRange.h>
@ -159,6 +160,9 @@ public:
const SyntaxHighlighter* syntax_highlighter() const;
void set_syntax_highlighter(OwnPtr<SyntaxHighlighter>);
const AutocompleteProvider* autocomplete_provider() const;
void set_autocomplete_provider(OwnPtr<AutocompleteProvider>&&);
bool is_in_drag_select() const { return m_in_drag_select; }
protected:
@ -317,6 +321,8 @@ private:
NonnullOwnPtrVector<LineVisualData> m_line_visual_data;
OwnPtr<SyntaxHighlighter> m_highlighter;
OwnPtr<AutocompleteProvider> m_autocomplete_provider;
OwnPtr<AutocompleteBox> m_autocomplete_box;
RefPtr<Core::Timer> m_automatic_selection_scroll_timer;
Gfx::IntPoint m_last_mousemove_position;