diff options
author | Paulb23 <p_batty@hotmail.co.uk> | 2020-03-07 14:29:44 +0000 |
---|---|---|
committer | Paulb23 <p_batty@hotmail.co.uk> | 2020-07-11 15:40:00 +0100 |
commit | 156daddaaf16e36eb932452d1e30f4f77d29aae6 (patch) | |
tree | 942c5f0fe5bf8cbab99ca5534ecef4f76ea8d6b9 /scene | |
parent | 2f1080be9b032b1cf5086201e45057baa6b1a179 (diff) |
Expose Syntax highlighter for editor plugins
Diffstat (limited to 'scene')
-rw-r--r-- | scene/resources/syntax_highlighter.cpp | 9 | ||||
-rw-r--r-- | scene/resources/syntax_highlighter.h | 2 |
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() {} }; |