External editor improvements and fixes

Notable changes:

- Now ScriptLanguages have the option to override the global external editor setting.
If `ScriptLanguage::open_in_external_editor()` returns `ERR_UNAVAILABLE` (which it does by default), then the global external editor option will be used.
- Added formatting to the external editor execution arguments. Now it's possible to write something like this: `{project} -g {file}:{line}:{col}`.
- `VisualScript::get_member_line()` now can return the line of functions (well, it returns the id of the _Function_ node of the function). I guess there is nothing else we can get a "line" from.

Fixes:

- Fixes a bug where `ScriptEditor::script_goto_method()` would not work if the script is not already open in the built-in editor.
- Fixes wrong DEFVAL for `cursor_set_column` and `cursor_set_line` in TextEdit.
- `Script::get_member_line()` now returns -1 ("found nothing") by default.
This commit is contained in:
Ignacio Etcheverry 2017-04-15 19:48:10 +02:00
parent fce779a4ef
commit 4b8568006d
11 changed files with 74 additions and 66 deletions

View file

@ -69,26 +69,6 @@ Ref<Script> ScriptTextEditor::get_edited_script() const {
return script;
}
bool ScriptTextEditor::goto_method(const String &p_method) {
Vector<String> functions = get_functions();
String method_search = p_method + ":";
for (int i = 0; i < functions.size(); i++) {
String function = functions[i];
if (function.begins_with(method_search)) {
int line = function.get_slice(":", 1).to_int();
goto_line(line - 1);
return true;
}
}
return false;
}
void ScriptTextEditor::_load_theme_settings() {
TextEdit *text_edit = code_editor->get_text_edit();
@ -296,7 +276,7 @@ void ScriptTextEditor::tag_saved_version() {
}
void ScriptTextEditor::goto_line(int p_line, bool p_with_error) {
code_editor->get_text_edit()->cursor_set_line(p_line);
code_editor->get_text_edit()->call_deferred("cursor_set_line", p_line);
}
void ScriptTextEditor::ensure_focus() {