mirror of
https://github.com/godotengine/godot.git
synced 2024-11-22 04:06:14 +00:00
Fixes language overridden external editors
This commit is contained in:
parent
0b747c2910
commit
52a7be4eef
@ -206,6 +206,7 @@ public:
|
||||
virtual int find_function(const String &p_function, const String &p_code) const = 0;
|
||||
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const = 0;
|
||||
virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) { return ERR_UNAVAILABLE; }
|
||||
virtual bool overrides_external_editor() { return false; }
|
||||
|
||||
virtual Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, bool &r_force, String &r_call_hint) { return ERR_UNAVAILABLE; }
|
||||
|
||||
|
@ -1368,6 +1368,16 @@ void EditorNode::_set_editing_top_editors(Object *p_current_object) {
|
||||
editor_plugins_over->edit(p_current_object);
|
||||
}
|
||||
|
||||
static bool overrides_external_editor(Object *p_object) {
|
||||
|
||||
Script *script = Object::cast_to<Script>(p_object);
|
||||
|
||||
if (!script)
|
||||
return false;
|
||||
|
||||
return script->get_language()->overrides_external_editor();
|
||||
}
|
||||
|
||||
void EditorNode::_edit_current() {
|
||||
|
||||
uint32_t current = editor_history.get_current();
|
||||
@ -1434,7 +1444,7 @@ void EditorNode::_edit_current() {
|
||||
if (main_plugin) {
|
||||
|
||||
// special case if use of external editor is true
|
||||
if (main_plugin->get_name() == "Script" && bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) {
|
||||
if (main_plugin->get_name() == "Script" && (bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor")) || overrides_external_editor(current_obj))) {
|
||||
main_plugin->edit(current_obj);
|
||||
}
|
||||
|
||||
@ -1442,6 +1452,7 @@ void EditorNode::_edit_current() {
|
||||
// update screen main_plugin
|
||||
|
||||
if (!changing_scene) {
|
||||
|
||||
if (editor_plugin_screen)
|
||||
editor_plugin_screen->make_visible(false);
|
||||
editor_plugin_screen = main_plugin;
|
||||
|
@ -1539,8 +1539,14 @@ bool ScriptEditor::edit(const Ref<Script> &p_script, int p_line, int p_col, bool
|
||||
|
||||
bool open_dominant = EditorSettings::get_singleton()->get("text_editor/files/open_dominant_script_on_scene_change");
|
||||
|
||||
if (p_script->get_language()->overrides_external_editor()) {
|
||||
Error err = p_script->get_language()->open_in_external_editor(p_script, p_line >= 0 ? p_line : 0, p_col);
|
||||
if (err != OK)
|
||||
ERR_PRINT("Couldn't open script in the overridden external text editor");
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((debugger->get_dump_stack_script() != p_script || debugger->get_debug_with_external_editor()) &&
|
||||
p_script->get_language()->open_in_external_editor(p_script, p_line >= 0 ? p_line : 0, p_col) == OK &&
|
||||
p_script->get_path().is_resource_file() &&
|
||||
bool(EditorSettings::get_singleton()->get("text_editor/external/use_external_editor"))) {
|
||||
|
||||
|
@ -389,7 +389,6 @@ public:
|
||||
virtual bool can_inherit_from_file() { return true; }
|
||||
virtual int find_function(const String &p_function, const String &p_code) const;
|
||||
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
|
||||
virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) { return OK; }
|
||||
virtual Error complete_code(const String &p_code, const String &p_base_path, Object *p_owner, List<String> *r_options, bool &r_forced, String &r_call_hint);
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual Error lookup_code(const String &p_code, const String &p_symbol, const String &p_base_path, Object *p_owner, LookupResult &r_result);
|
||||
|
@ -571,7 +571,6 @@ public:
|
||||
virtual bool has_named_classes() const;
|
||||
virtual int find_function(const String &p_function, const String &p_code) const;
|
||||
virtual String make_function(const String &p_class, const String &p_name, const PoolStringArray &p_args) const;
|
||||
virtual Error open_in_external_editor(const Ref<Script> &p_script, int p_line, int p_col) { return ERR_UNAVAILABLE; }
|
||||
virtual void auto_indent_code(String &p_code, int p_from_line, int p_to_line) const;
|
||||
virtual void add_global_constant(const StringName &p_variable, const Variant &p_value);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user