File tree Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Expand file tree Collapse file tree 3 files changed +15
-3
lines changed Original file line number Diff line number Diff line change 1010 <tutorials >
1111 </tutorials >
1212 <methods >
13+ <method name =" _create" qualifiers =" virtual const" >
14+ <return type =" EditorSyntaxHighlighter" />
15+ <description >
16+ Virtual method which creates a new instance of the syntax highlighter.
17+ </description >
18+ </method >
1319 <method name =" _get_name" qualifiers =" virtual const" >
1420 <return type =" String" />
1521 <description >
Original file line number Diff line number Diff line change @@ -86,9 +86,13 @@ PackedStringArray EditorSyntaxHighlighter::_get_supported_languages() const {
8686
8787Ref<EditorSyntaxHighlighter> EditorSyntaxHighlighter::_create () const {
8888 Ref<EditorSyntaxHighlighter> syntax_highlighter;
89- syntax_highlighter.instantiate ();
90- if (get_script_instance ()) {
91- syntax_highlighter->set_script (get_script_instance ()->get_script ());
89+ if (GDVIRTUAL_IS_OVERRIDDEN (_create)) {
90+ GDVIRTUAL_CALL (_create, syntax_highlighter);
91+ } else {
92+ syntax_highlighter.instantiate ();
93+ if (get_script_instance ()) {
94+ syntax_highlighter->set_script (get_script_instance ()->get_script ());
95+ }
9296 }
9397 return syntax_highlighter;
9498}
@@ -98,6 +102,7 @@ void EditorSyntaxHighlighter::_bind_methods() {
98102
99103 GDVIRTUAL_BIND (_get_name)
100104 GDVIRTUAL_BIND (_get_supported_languages)
105+ GDVIRTUAL_BIND (_create)
101106}
102107
103108// //
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ class EditorSyntaxHighlighter : public SyntaxHighlighter {
6262
6363 GDVIRTUAL0RC (String, _get_name)
6464 GDVIRTUAL0RC (PackedStringArray, _get_supported_languages)
65+ GDVIRTUAL0RC (Ref<EditorSyntaxHighlighter>, _create)
6566
6667public:
6768 virtual String _get_name () const ;
You can’t perform that action at this time.
0 commit comments