You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-28 16:07:14 +00:00
Extract Syntax highlighting from TextEdit and add EditorSyntaxHighlighter
- Extacted all syntax highlighting code from text edit - Removed enable syntax highlighting from text edit - Added line_edited_from signal to text_edit - Renamed get/set_syntax_highlighting to get/set_syntax_highlighter - Added EditorSyntaxHighligher
This commit is contained in:
@@ -31,12 +31,25 @@
|
||||
#ifndef GDSCRIPT_HIGHLIGHTER_H
|
||||
#define GDSCRIPT_HIGHLIGHTER_H
|
||||
|
||||
#include "editor/plugins/script_editor_plugin.h"
|
||||
#include "scene/gui/text_edit.h"
|
||||
|
||||
class GDScriptSyntaxHighlighter : public SyntaxHighlighter {
|
||||
GDCLASS(GDScriptSyntaxHighlighter, SyntaxHighlighter)
|
||||
class GDScriptSyntaxHighlighter : public EditorSyntaxHighlighter {
|
||||
GDCLASS(GDScriptSyntaxHighlighter, EditorSyntaxHighlighter)
|
||||
|
||||
private:
|
||||
struct ColorRegion {
|
||||
Color color;
|
||||
String start_key;
|
||||
String end_key;
|
||||
bool line_only;
|
||||
};
|
||||
Vector<ColorRegion> color_regions;
|
||||
Map<int, int> color_region_cache;
|
||||
|
||||
Dictionary keywords;
|
||||
Dictionary member_keywords;
|
||||
|
||||
enum Type {
|
||||
NONE,
|
||||
REGION,
|
||||
@@ -61,6 +74,8 @@ private:
|
||||
Color node_path_color;
|
||||
Color type_color;
|
||||
|
||||
void add_color_region(const String &p_start_key, const String &p_end_key, const Color &p_color, bool p_line_only = false);
|
||||
|
||||
public:
|
||||
virtual void _update_cache() override;
|
||||
virtual Dictionary _get_line_syntax_highlighting(int p_line) override;
|
||||
@@ -68,7 +83,7 @@ public:
|
||||
virtual String _get_name() const override;
|
||||
virtual Array _get_supported_languages() const override;
|
||||
|
||||
virtual Ref<SyntaxHighlighter> _create() const override;
|
||||
virtual Ref<EditorSyntaxHighlighter> _create() const override;
|
||||
};
|
||||
|
||||
#endif // GDSCRIPT_HIGHLIGHTER_H
|
||||
|
||||
Reference in New Issue
Block a user