diff --git a/doc/classes/EditorSyntaxHighlighter.xml b/doc/classes/EditorSyntaxHighlighter.xml
index 3685907574f..1e67dbd80df 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 2edc0963820..d40dbabbce2 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -86,9 +86,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;
}
@@ -98,6 +102,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 5de0aaa1e97..41901102482 100644
--- a/editor/plugins/script_editor_plugin.h
+++ b/editor/plugins/script_editor_plugin.h
@@ -62,6 +62,7 @@ protected:
GDVIRTUAL0RC(String, _get_name)
GDVIRTUAL0RC(PackedStringArray, _get_supported_languages)
+ GDVIRTUAL0RC(Ref, _create)
public:
virtual String _get_name() const;