summaryrefslogtreecommitdiffstats
path: root/scene/gui/code_edit.h
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/code_edit.h')
-rw-r--r--scene/gui/code_edit.h29
1 files changed, 27 insertions, 2 deletions
diff --git a/scene/gui/code_edit.h b/scene/gui/code_edit.h
index addbb6e468..4b0629d29d 100644
--- a/scene/gui/code_edit.h
+++ b/scene/gui/code_edit.h
@@ -31,6 +31,7 @@
#ifndef CODE_EDIT_H
#define CODE_EDIT_H
+#include "core/object/script_language.h"
#include "scene/gui/text_edit.h"
class CodeEdit : public TextEdit {
@@ -124,6 +125,11 @@ private:
/* Line Folding */
bool line_folding_enabled = false;
+ String code_region_start_string;
+ String code_region_end_string;
+ String code_region_start_tag = "region";
+ String code_region_end_tag = "endregion";
+ void _update_code_region_tags();
/* Delimiters */
enum DelimiterType {
@@ -216,6 +222,7 @@ private:
void _update_scroll_selected_line(float p_mouse_y);
void _filter_code_completion_candidates_impl();
+ bool _should_reset_selected_option_for_new_options(const Vector<ScriptLanguage::CodeCompletionOption> &p_new_options);
/* Line length guidelines */
TypedArray<int> line_length_guideline_columns;
@@ -231,8 +238,11 @@ private:
struct ThemeCache {
/* Gutters */
Color code_folding_color = Color(1, 1, 1);
+ Color folded_code_region_color = Color(1, 1, 1);
Ref<Texture2D> can_fold_icon;
Ref<Texture2D> folded_icon;
+ Ref<Texture2D> can_fold_code_region_icon;
+ Ref<Texture2D> folded_code_region_icon;
Ref<Texture2D> folded_eol_icon;
Color breakpoint_color = Color(1, 1, 1);
@@ -269,11 +279,17 @@ private:
/* Other visuals */
Ref<StyleBox> style_normal;
+ Color brace_mismatch_color;
+
Ref<Font> font;
int font_size = 16;
int line_spacing = 1;
} theme_cache;
+ virtual Color _get_brace_mismatch_color() const override;
+ virtual Color _get_code_folding_color() const override;
+ virtual Ref<Texture2D> _get_folded_eol_icon() const override;
+
/* Callbacks */
int lines_edited_changed = 0;
int lines_edited_from = -1;
@@ -292,8 +308,6 @@ protected:
static void _bind_compatibility_methods();
#endif
- virtual void _update_theme_item_cache() override;
-
/* Text manipulation */
// Overridable actions
@@ -398,6 +412,14 @@ public:
bool is_line_folded(int p_line) const;
TypedArray<int> get_folded_lines() const;
+ /* Code region */
+ void create_code_region();
+ String get_code_region_start_tag() const;
+ String get_code_region_end_tag() const;
+ void set_code_region_tags(const String &p_start = "region", const String &p_end = "endregion");
+ bool is_line_code_region_start(int p_line) const;
+ bool is_line_code_region_end(int p_line) const;
+
/* Delimiters */
void add_string_delimiter(const String &p_start_key, const String &p_end_key, bool p_line_only = false);
void remove_string_delimiter(const String &p_start_key);
@@ -465,6 +487,9 @@ public:
void set_symbol_lookup_word_as_valid(bool p_valid);
+ /* Text manipulation */
+ void duplicate_lines();
+
CodeEdit();
~CodeEdit();
};