summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
Diffstat (limited to 'scene')
-rw-r--r--scene/resources/syntax_highlighter.cpp9
-rw-r--r--scene/resources/syntax_highlighter.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/scene/resources/syntax_highlighter.cpp b/scene/resources/syntax_highlighter.cpp
index 7b78a89c1b..f4fc12fa19 100644
--- a/scene/resources/syntax_highlighter.cpp
+++ b/scene/resources/syntax_highlighter.cpp
@@ -65,6 +65,15 @@ TextEdit *SyntaxHighlighter::get_text_edit() {
return text_edit;
}
+Ref<SyntaxHighlighter> SyntaxHighlighter::_create() const {
+ Ref<SyntaxHighlighter> syntax_highlighter;
+ syntax_highlighter.instance();
+ if (get_script_instance()) {
+ syntax_highlighter->set_script(get_script_instance()->get_script());
+ }
+ return syntax_highlighter;
+}
+
void SyntaxHighlighter::_bind_methods() {
ClassDB::bind_method(D_METHOD("_get_line_syntax_highlighting", "p_line"), &SyntaxHighlighter::_get_line_syntax_highlighting);
ClassDB::bind_method(D_METHOD("_update_cache"), &SyntaxHighlighter::_update_cache);
diff --git a/scene/resources/syntax_highlighter.h b/scene/resources/syntax_highlighter.h
index 201bcb03e1..7059ef4ce1 100644
--- a/scene/resources/syntax_highlighter.h
+++ b/scene/resources/syntax_highlighter.h
@@ -56,6 +56,8 @@ public:
void set_text_edit(TextEdit *p_text_edit);
TextEdit *get_text_edit();
+ virtual Ref<SyntaxHighlighter> _create() const;
+
SyntaxHighlighter() {}
virtual ~SyntaxHighlighter() {}
};