1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-24 15:26:15 +00:00

GDScript: Highlight code region comments

This commit is contained in:
Danil Alexeev
2023-10-13 14:26:28 +03:00
parent 5034478611
commit faebb0895f
2 changed files with 34 additions and 25 deletions

View File

@@ -39,6 +39,15 @@ class GDScriptSyntaxHighlighter : public EditorSyntaxHighlighter {
private:
struct ColorRegion {
enum Type {
TYPE_NONE,
TYPE_STRING, // `"` and `'`, optional prefix `&`, `^`, or `r`.
TYPE_MULTILINE_STRING, // `"""` and `'''`, optional prefix `r`.
TYPE_COMMENT, // `#` and `##`.
TYPE_CODE_REGION, // `#region` and `#endregion`.
};
Type type = TYPE_NONE;
Color color;
String start_key;
String end_key;
@@ -94,7 +103,7 @@ private:
Color comment_marker_colors[COMMENT_MARKER_MAX];
HashMap<String, CommentMarkerLevel> comment_markers;
void add_color_region(const String &p_start_key, const String &p_end_key, const Color &p_color, bool p_line_only = false);
void add_color_region(ColorRegion::Type p_type, 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;