mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:37:43 +00:00
LibGUI: Add a GitCommit SyntaxHighlighter implementation
This highlighter just syntax highlights the commented lines in your git commit message. It could potentially be enhanced to handle the rebase UI or other more advanced cases in the future.
This commit is contained in:
parent
d32736582e
commit
8e8d24fe29
5 changed files with 231 additions and 0 deletions
26
Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.h
Normal file
26
Userland/Libraries/LibGUI/GitCommitSyntaxHighlighter.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* Copyright (c) 2022, Brian Gianforcaro <bgianf@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibSyntax/Highlighter.h>
|
||||
|
||||
namespace GUI {
|
||||
|
||||
class GitCommitSyntaxHighlighter final : public Syntax::Highlighter {
|
||||
public:
|
||||
GitCommitSyntaxHighlighter() { }
|
||||
virtual ~GitCommitSyntaxHighlighter() override;
|
||||
|
||||
virtual Syntax::Language language() const override { return Syntax::Language::GitCommit; }
|
||||
virtual void rehighlight(Palette const&) override;
|
||||
|
||||
protected:
|
||||
virtual Vector<MatchingTokenPair> matching_token_pairs_impl() const override;
|
||||
virtual bool token_types_equal(u64, u64) const override;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue