diff --git a/doc/classes/EditorSyntaxHighlighter.xml b/doc/classes/EditorSyntaxHighlighter.xml
index 3685907574..1e67dbd80d 100644
--- a/doc/classes/EditorSyntaxHighlighter.xml
+++ b/doc/classes/EditorSyntaxHighlighter.xml
@@ -10,6 +10,12 @@
+
+
+
+ Virtual method which creates a new instance of the syntax highlighter.
+
+
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index 433511fc07..1830d45d0b 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -91,9 +91,13 @@ PackedStringArray EditorSyntaxHighlighter::_get_supported_languages() const {
Ref EditorSyntaxHighlighter::_create() const {
Ref syntax_highlighter;
- syntax_highlighter.instantiate();
- if (get_script_instance()) {
- syntax_highlighter->set_script(get_script_instance()->get_script());
+ if (GDVIRTUAL_IS_OVERRIDDEN(_create)) {
+ GDVIRTUAL_CALL(_create, syntax_highlighter);
+ } else {
+ syntax_highlighter.instantiate();
+ if (get_script_instance()) {
+ syntax_highlighter->set_script(get_script_instance()->get_script());
+ }
}
return syntax_highlighter;
}
@@ -103,6 +107,7 @@ void EditorSyntaxHighlighter::_bind_methods() {
GDVIRTUAL_BIND(_get_name)
GDVIRTUAL_BIND(_get_supported_languages)
+ GDVIRTUAL_BIND(_create)
}
////
diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h
index 784054d5b6..32aadaced7 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -61,6 +61,7 @@ protected:
GDVIRTUAL0RC(String, _get_name)
GDVIRTUAL0RC(PackedStringArray, _get_supported_languages)
+ GDVIRTUAL0RC(Ref, _create)
public:
virtual String _get_name() const;