You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Expose Syntax highlighter for editor plugins
This commit is contained in:
@@ -387,6 +387,8 @@ void GDScriptSyntaxHighlighter::_update_cache() {
|
||||
type_color = EDITOR_GET("text_edit/highlighting/base_type_color");
|
||||
}
|
||||
|
||||
SyntaxHighlighter *GDScriptSyntaxHighlighter::create() {
|
||||
return memnew(GDScriptSyntaxHighlighter);
|
||||
Ref<SyntaxHighlighter> GDScriptSyntaxHighlighter::_create() const {
|
||||
Ref<GDScriptSyntaxHighlighter> syntax_highlighter;
|
||||
syntax_highlighter.instance();
|
||||
return syntax_highlighter;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
#include "scene/gui/text_edit.h"
|
||||
|
||||
class GDScriptSyntaxHighlighter : public SyntaxHighlighter {
|
||||
GDCLASS(GDScriptSyntaxHighlighter, SyntaxHighlighter)
|
||||
|
||||
private:
|
||||
enum Type {
|
||||
NONE,
|
||||
@@ -60,13 +62,13 @@ private:
|
||||
Color type_color;
|
||||
|
||||
public:
|
||||
static SyntaxHighlighter *create();
|
||||
virtual void _update_cache() override;
|
||||
virtual Dictionary _get_line_syntax_highlighting(int p_line) override;
|
||||
|
||||
virtual void _update_cache();
|
||||
virtual Dictionary _get_line_syntax_highlighting(int p_line);
|
||||
virtual String _get_name() const override;
|
||||
virtual Array _get_supported_languages() const override;
|
||||
|
||||
virtual String _get_name() const;
|
||||
virtual Array _get_supported_languages() const;
|
||||
virtual Ref<SyntaxHighlighter> _create() const override;
|
||||
};
|
||||
|
||||
#endif // GDSCRIPT_HIGHLIGHTER_H
|
||||
|
||||
@@ -142,6 +142,12 @@ static void _editor_init() {
|
||||
gd_export.instance();
|
||||
EditorExport::get_singleton()->add_export_plugin(gd_export);
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
Ref<GDScriptSyntaxHighlighter> gdscript_syntax_highlighter;
|
||||
gdscript_syntax_highlighter.instance();
|
||||
ScriptEditor::get_singleton()->register_syntax_highlighter(gdscript_syntax_highlighter);
|
||||
#endif
|
||||
|
||||
#ifndef GDSCRIPT_NO_LSP
|
||||
register_lsp_types();
|
||||
GDScriptLanguageServer *lsp_plugin = memnew(GDScriptLanguageServer);
|
||||
@@ -166,7 +172,6 @@ void register_gdscript_types() {
|
||||
ResourceSaver::add_resource_format_saver(resource_saver_gd);
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
ScriptEditor::register_create_syntax_highlighter_function(GDScriptSyntaxHighlighter::create);
|
||||
EditorNode::add_init_callback(_editor_init);
|
||||
|
||||
gdscript_translation_parser_plugin.instance();
|
||||
|
||||
Reference in New Issue
Block a user