diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-07 16:56:02 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-07 16:56:02 +0100 |
commit | ddbf20ecf6c1e359a3b9f7c5ba7e0b5f3eec2f4d (patch) | |
tree | d55897c4c002ff69b34d9e79962055912bb1eb79 /Userland/Libraries/LibSyntax/Highlighter.h | |
parent | 22baa5e64fdd60b780beef785fd76ad1bd70f9bf (diff) | |
download | serenity-ddbf20ecf6c1e359a3b9f7c5ba7e0b5f3eec2f4d.zip |
LibSyntax+LibGUI+LibJS: Move JS syntax highlighter to LibJS
This is a little bit messy but the basic idea is:
Syntax::Highlighter now has a Syntax::HighlighterClient to talk to the
outside world. It mostly communicates in LibGUI primitives that are
available in headers, so inlineable.
GUI::TextEditor inherits from Syntax::HighlighterClient.
This let us to move GUI::JSSyntaxHighlighter to JS::SyntaxHighlighter
and remove LibGUI's dependency on LibJS.
Diffstat (limited to 'Userland/Libraries/LibSyntax/Highlighter.h')
-rw-r--r-- | Userland/Libraries/LibSyntax/Highlighter.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/Libraries/LibSyntax/Highlighter.h b/Userland/Libraries/LibSyntax/Highlighter.h index 8ac7b2691c..4f56fc05d5 100644 --- a/Userland/Libraries/LibSyntax/Highlighter.h +++ b/Userland/Libraries/LibSyntax/Highlighter.h @@ -30,6 +30,7 @@ #include <AK/WeakPtr.h> #include <LibGUI/TextDocument.h> #include <LibGfx/Palette.h> +#include <LibSyntax/HighlighterClient.h> namespace Syntax { @@ -61,14 +62,15 @@ public: virtual bool is_identifier(void*) const { return false; }; virtual bool is_navigatable(void*) const { return false; }; - void attach(GUI::TextEditor& editor); + void attach(HighlighterClient&); void detach(); void cursor_did_change(); protected: Highlighter() { } - WeakPtr<GUI::TextEditor> m_editor; + // FIXME: This should be WeakPtr somehow + HighlighterClient* m_client { nullptr }; struct MatchingTokenPair { void* open; |