summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-09-04 08:12:29 +0200
committerGitHub <noreply@github.com>2017-09-04 08:12:29 +0200
commitb5d2d0a9a502416a03f303fc30bee8a7ec8e93e2 (patch)
tree754f5946625e043fedbdb83503e52d2c9fbe3159 /editor
parent0f5e575d6026ff4f6d8a4d28fbd8e7eca77aeef5 (diff)
parent52a7be4eefbafcc983766bd80a87752b678c1c17 (diff)
Merge pull request #10939 from neikeq/fix-overridden-external-editors
Fixes language overridden external editors
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp13
-rw-r--r--editor/plugins/script_editor_plugin.cpp8
2 files changed, 19 insertions, 2 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 6b5db7572a..d4e0aacb0f 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -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;
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index dbc3bff873..b8a4ff9bf3 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -1545,8 +1545,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"))) {