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 @@ -91,9 +91,13 @@ PackedStringArray EditorSyntaxHighlighter::_get_supported_languages() const {
9191
9292Ref<EditorSyntaxHighlighter> EditorSyntaxHighlighter::_create () const {
9393 Ref<EditorSyntaxHighlighter> syntax_highlighter;
94- syntax_highlighter.instantiate ();
95- if (get_script_instance ()) {
96- syntax_highlighter->set_script (get_script_instance ()->get_script ());
94+ if (GDVIRTUAL_IS_OVERRIDDEN (_create)) {
95+ GDVIRTUAL_CALL (_create, syntax_highlighter);
96+ } else {
97+ syntax_highlighter.instantiate ();
98+ if (get_script_instance ()) {
99+ syntax_highlighter->set_script (get_script_instance ()->get_script ());
100+ }
97101 }
98102 return syntax_highlighter;
99103}
@@ -103,6 +107,7 @@ void EditorSyntaxHighlighter::_bind_methods() {
103107
104108 GDVIRTUAL_BIND (_get_name)
105109 GDVIRTUAL_BIND (_get_supported_languages)
110+ GDVIRTUAL_BIND (_create)
106111}
107112
108113// //
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ class EditorSyntaxHighlighter : public SyntaxHighlighter {
6161
6262 GDVIRTUAL0RC (String, _get_name)
6363 GDVIRTUAL0RC (PackedStringArray, _get_supported_languages)
64+ GDVIRTUAL0RC (Ref<EditorSyntaxHighlighter>, _create)
6465
6566public:
6667 virtual String _get_name () const ;
You can’t perform that action at this time.
0 commit comments