1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-06 12:20:30 +00:00

Support editing JSON in ScriptEditor

This commit is contained in:
Paulb23
2023-01-28 14:05:23 +00:00
parent 218bef90af
commit a197d6ef4e
4 changed files with 149 additions and 24 deletions

View File

@@ -96,6 +96,24 @@ public:
virtual Ref<EditorSyntaxHighlighter> _create() const override;
};
class EditorJSONSyntaxHighlighter : public EditorSyntaxHighlighter {
GDCLASS(EditorJSONSyntaxHighlighter, EditorSyntaxHighlighter)
private:
Ref<CodeHighlighter> highlighter;
public:
virtual void _update_cache() override;
virtual Dictionary _get_line_syntax_highlighting_impl(int p_line) override { return highlighter->get_line_syntax_highlighting(p_line); }
virtual PackedStringArray _get_supported_languages() const override { return PackedStringArray{ "json" }; }
virtual String _get_name() const override { return TTR("JSON"); }
virtual Ref<EditorSyntaxHighlighter> _create() const override;
EditorJSONSyntaxHighlighter() { highlighter.instantiate(); }
};
///////////////////////////////////////////////////////////////////////////////
class ScriptEditorQuickOpen : public ConfirmationDialog {