summaryrefslogtreecommitdiff
path: root/editor/code_editor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/code_editor.cpp')
-rw-r--r--editor/code_editor.cpp229
1 files changed, 158 insertions, 71 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index 1c62c3d3e1..03914bec3b 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -105,6 +105,11 @@ void FindReplaceBar::_notification(int p_what) {
hide_button->set_custom_minimum_size(hide_button->get_normal_texture()->get_size());
} else if (p_what == NOTIFICATION_THEME_CHANGED) {
matches_label->add_theme_color_override("font_color", results_count > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor"));
+ } else if (p_what == NOTIFICATION_PREDELETE) {
+ if (base_text_editor) {
+ base_text_editor->remove_find_replace_bar();
+ base_text_editor = nullptr;
+ }
}
}
@@ -117,7 +122,7 @@ void FindReplaceBar::_unhandled_input(const Ref<InputEvent> &p_event) {
}
Control *focus_owner = get_focus_owner();
- if (text_editor->has_focus() || (focus_owner && vbc_lineedit->is_a_parent_of(focus_owner))) {
+ if (text_editor->has_focus() || (focus_owner && vbc_lineedit->is_ancestor_of(focus_owner))) {
bool accepted = true;
switch (k->get_keycode()) {
@@ -302,7 +307,7 @@ void FindReplaceBar::_replace_all() {
matches_label->add_theme_color_override("font_color", rc > 0 ? get_theme_color("font_color", "Label") : get_theme_color("error_color", "Editor"));
matches_label->set_text(vformat(TTR("%d replaced."), rc));
- text_editor->call_deferred("connect", "text_changed", Callable(this, "_editor_text_changed"));
+ text_editor->call_deferred("connect", "text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed));
results_count = -1;
}
@@ -539,7 +544,7 @@ void FindReplaceBar::_search_text_changed(const String &p_text) {
search_current();
}
-void FindReplaceBar::_search_text_entered(const String &p_text) {
+void FindReplaceBar::_search_text_submitted(const String &p_text) {
if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
search_prev();
} else {
@@ -547,7 +552,7 @@ void FindReplaceBar::_search_text_entered(const String &p_text) {
}
}
-void FindReplaceBar::_replace_text_entered(const String &p_text) {
+void FindReplaceBar::_replace_text_submitted(const String &p_text) {
if (selection_only->is_pressed() && text_editor->is_selection_active()) {
_replace_all();
_hide_bar();
@@ -583,15 +588,33 @@ void FindReplaceBar::set_error(const String &p_label) {
emit_signal("error", p_label);
}
-void FindReplaceBar::set_text_edit(CodeEdit *p_text_edit) {
+void FindReplaceBar::set_text_edit(CodeTextEditor *p_text_editor) {
+ if (p_text_editor == base_text_editor) {
+ return;
+ }
+
+ if (base_text_editor) {
+ base_text_editor->remove_find_replace_bar();
+ base_text_editor = nullptr;
+ text_editor->disconnect("text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed));
+ text_editor = nullptr;
+ }
+
+ if (!p_text_editor) {
+ return;
+ }
+
results_count = -1;
- text_editor = p_text_edit;
+ base_text_editor = p_text_editor;
+ text_editor = base_text_editor->get_text_editor();
text_editor->connect("text_changed", callable_mp(this, &FindReplaceBar::_editor_text_changed));
+
+ _update_results_count();
+ _update_matches_label();
}
void FindReplaceBar::_bind_methods() {
ClassDB::bind_method("_unhandled_input", &FindReplaceBar::_unhandled_input);
-
ClassDB::bind_method("_search_current", &FindReplaceBar::search_current);
ADD_SIGNAL(MethodInfo("search"));
@@ -629,7 +652,7 @@ FindReplaceBar::FindReplaceBar() {
vbc_lineedit->add_child(search_text);
search_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
search_text->connect("text_changed", callable_mp(this, &FindReplaceBar::_search_text_changed));
- search_text->connect("text_entered", callable_mp(this, &FindReplaceBar::_search_text_entered));
+ search_text->connect("text_submitted", callable_mp(this, &FindReplaceBar::_search_text_submitted));
matches_label = memnew(Label);
hbc_button_search->add_child(matches_label);
@@ -663,7 +686,7 @@ FindReplaceBar::FindReplaceBar() {
replace_text = memnew(LineEdit);
vbc_lineedit->add_child(replace_text);
replace_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0));
- replace_text->connect("text_entered", callable_mp(this, &FindReplaceBar::_replace_text_entered));
+ replace_text->connect("text_submitted", callable_mp(this, &FindReplaceBar::_replace_text_submitted));
replace = memnew(Button);
hbc_button_replace->add_child(replace);
@@ -715,8 +738,8 @@ void CodeTextEditor::_input(const Ref<InputEvent> &event) {
accept_event();
return;
}
- if (ED_IS_SHORTCUT("script_text_editor/clone_down", key_event)) {
- clone_lines_down();
+ if (ED_IS_SHORTCUT("script_text_editor/duplicate_selection", key_event)) {
+ duplicate_selection();
accept_event();
return;
}
@@ -726,7 +749,7 @@ void CodeTextEditor::_text_editor_gui_input(const Ref<InputEvent> &p_event) {
Ref<InputEventMouseButton> mb = p_event;
if (mb.is_valid()) {
- if (mb->is_pressed() && mb->get_command()) {
+ if (mb->is_pressed() && mb->is_command_pressed()) {
if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_UP) {
_zoom_in();
} else if (mb->get_button_index() == MOUSE_BUTTON_WHEEL_DOWN) {
@@ -816,12 +839,12 @@ void CodeTextEditor::_code_complete_timer_timeout() {
if (!is_visible_in_tree()) {
return;
}
- text_editor->query_code_comple();
+ text_editor->request_code_completion();
}
void CodeTextEditor::_complete_request() {
List<ScriptCodeCompletionOption> entries;
- String ctext = text_editor->get_text_for_completion();
+ String ctext = text_editor->get_text_for_code_completion();
_code_complete_script(ctext, &entries);
bool forced = false;
if (code_complete_func) {
@@ -832,16 +855,17 @@ void CodeTextEditor::_complete_request() {
}
for (List<ScriptCodeCompletionOption>::Element *E = entries.front(); E; E = E->next()) {
- ScriptCodeCompletionOption *e = &E->get();
- e->icon = _get_completion_icon(*e);
- e->font_color = completion_font_color;
- if (e->insert_text.begins_with("\"") || e->insert_text.begins_with("\'")) {
- e->font_color = completion_string_color;
- } else if (e->insert_text.begins_with("#") || e->insert_text.begins_with("//")) {
- e->font_color = completion_comment_color;
+ ScriptCodeCompletionOption &e = E->get();
+
+ Color font_color = completion_font_color;
+ if (e.insert_text.begins_with("\"") || e.insert_text.begins_with("\'")) {
+ font_color = completion_string_color;
+ } else if (e.insert_text.begins_with("#") || e.insert_text.begins_with("//")) {
+ font_color = completion_comment_color;
}
+ text_editor->add_code_completion_option((CodeEdit::CodeCompletionKind)e.kind, e.display, e.insert_text, font_color, _get_completion_icon(e), e.default_value);
}
- text_editor->code_complete(entries, forced);
+ text_editor->update_code_completion_options(forced);
}
Ref<Texture2D> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOption &p_option) {
@@ -915,7 +939,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_highlight_current_line(EditorSettings::get_singleton()->get("text_editor/highlighting/highlight_current_line"));
text_editor->set_indent_using_spaces(EditorSettings::get_singleton()->get("text_editor/indent/type"));
text_editor->set_indent_size(EditorSettings::get_singleton()->get("text_editor/indent/size"));
- text_editor->set_auto_indent(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent"));
+ text_editor->set_auto_indent_enabled(EditorSettings::get_singleton()->get("text_editor/indent/auto_indent"));
text_editor->set_draw_tabs(EditorSettings::get_singleton()->get("text_editor/indent/draw_tabs"));
text_editor->set_draw_spaces(EditorSettings::get_singleton()->get("text_editor/indent/draw_spaces"));
text_editor->set_smooth_scroll_enabled(EditorSettings::get_singleton()->get("text_editor/navigation/smooth_scrolling"));
@@ -925,7 +949,7 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_draw_line_numbers(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_numbers"));
text_editor->set_line_numbers_zero_padded(EditorSettings::get_singleton()->get("text_editor/appearance/line_numbers_zero_padded"));
text_editor->set_draw_bookmarks_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/show_bookmark_gutter"));
- text_editor->set_hiding_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/code_folding"));
+ text_editor->set_line_folding_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/code_folding"));
text_editor->set_draw_fold_gutter(EditorSettings::get_singleton()->get("text_editor/appearance/code_folding"));
text_editor->set_wrap_enabled(EditorSettings::get_singleton()->get("text_editor/appearance/word_wrap"));
text_editor->set_show_line_length_guidelines(EditorSettings::get_singleton()->get("text_editor/appearance/show_line_length_guidelines"));
@@ -938,6 +962,25 @@ void CodeTextEditor::update_editor_settings() {
text_editor->set_auto_brace_completion(EditorSettings::get_singleton()->get("text_editor/completion/auto_brace_complete"));
}
+void CodeTextEditor::set_find_replace_bar(FindReplaceBar *p_bar) {
+ if (find_replace_bar) {
+ return;
+ }
+
+ find_replace_bar = p_bar;
+ find_replace_bar->set_text_edit(this);
+ find_replace_bar->connect("error", callable_mp(error, &Label::set_text));
+}
+
+void CodeTextEditor::remove_find_replace_bar() {
+ if (!find_replace_bar) {
+ return;
+ }
+
+ find_replace_bar->disconnect("error", callable_mp(error, &Label::set_text));
+ find_replace_bar = nullptr;
+}
+
void CodeTextEditor::trim_trailing_whitespace() {
bool trimed_whitespace = false;
for (int i = 0; i < text_editor->get_line_count(); i++) {
@@ -1012,7 +1055,7 @@ void CodeTextEditor::convert_indent_to_spaces() {
if (cursor_line == i && cursor_column > j) {
cursor_column += indent_size - 1;
}
- line = line.left(j) + indent + line.right(j + 1);
+ line = line.left(j) + indent + line.substr(j + 1);
}
j++;
}
@@ -1056,7 +1099,7 @@ void CodeTextEditor::convert_indent_to_tabs() {
if (cursor_line == i && cursor_column > j) {
cursor_column -= indent_size;
}
- line = line.left(j - indent_size) + "\t" + line.right(j + 1);
+ line = line.left(j - indent_size) + "\t" + line.substr(j + 1);
j = 0;
space_count = -1;
}
@@ -1114,7 +1157,7 @@ void CodeTextEditor::convert_case(CaseStyle p_case) {
new_line = text_editor->get_line(i).left(begin_col) + new_line;
}
if (i == end) {
- new_line = new_line + text_editor->get_line(i).right(end_col);
+ new_line = new_line + text_editor->get_line(i).substr(end_col);
}
text_editor->set_line(i, new_line);
}
@@ -1221,7 +1264,7 @@ void CodeTextEditor::_delete_line(int p_line) {
text_editor->cursor_set_line(1);
text_editor->cursor_set_column(0);
}
- text_editor->backspace_at_cursor();
+ text_editor->backspace();
text_editor->unfold_line(p_line);
text_editor->cursor_set_line(p_line);
}
@@ -1244,7 +1287,7 @@ void CodeTextEditor::delete_lines() {
text_editor->end_complex_operation();
}
-void CodeTextEditor::clone_lines_down() {
+void CodeTextEditor::duplicate_selection() {
const int cursor_column = text_editor->cursor_get_column();
int from_line = text_editor->cursor_get_line();
int to_line = text_editor->cursor_get_line();
@@ -1468,12 +1511,41 @@ void CodeTextEditor::set_error_pos(int p_line, int p_column) {
void CodeTextEditor::goto_error() {
if (error->get_text() != "") {
+ text_editor->unfold_line(error_line);
text_editor->cursor_set_line(error_line);
text_editor->cursor_set_column(error_column);
text_editor->center_viewport_to_cursor();
}
}
+void CodeTextEditor::_update_text_editor_theme() {
+ text_editor->add_theme_color_override("background_color", EDITOR_GET("text_editor/highlighting/background_color"));
+ text_editor->add_theme_color_override("completion_background_color", EDITOR_GET("text_editor/highlighting/completion_background_color"));
+ text_editor->add_theme_color_override("completion_selected_color", EDITOR_GET("text_editor/highlighting/completion_selected_color"));
+ text_editor->add_theme_color_override("completion_existing_color", EDITOR_GET("text_editor/highlighting/completion_existing_color"));
+ text_editor->add_theme_color_override("completion_scroll_color", EDITOR_GET("text_editor/highlighting/completion_scroll_color"));
+ text_editor->add_theme_color_override("completion_font_color", EDITOR_GET("text_editor/highlighting/completion_font_color"));
+ text_editor->add_theme_color_override("font_color", EDITOR_GET("text_editor/highlighting/text_color"));
+ text_editor->add_theme_color_override("line_number_color", EDITOR_GET("text_editor/highlighting/line_number_color"));
+ text_editor->add_theme_color_override("caret_color", EDITOR_GET("text_editor/highlighting/caret_color"));
+ text_editor->add_theme_color_override("caret_background_color", EDITOR_GET("text_editor/highlighting/caret_background_color"));
+ text_editor->add_theme_color_override("font_selected_color", EDITOR_GET("text_editor/highlighting/text_selected_color"));
+ text_editor->add_theme_color_override("selection_color", EDITOR_GET("text_editor/highlighting/selection_color"));
+ text_editor->add_theme_color_override("brace_mismatch_color", EDITOR_GET("text_editor/highlighting/brace_mismatch_color"));
+ text_editor->add_theme_color_override("current_line_color", EDITOR_GET("text_editor/highlighting/current_line_color"));
+ text_editor->add_theme_color_override("line_length_guideline_color", EDITOR_GET("text_editor/highlighting/line_length_guideline_color"));
+ text_editor->add_theme_color_override("word_highlighted_color", EDITOR_GET("text_editor/highlighting/word_highlighted_color"));
+ text_editor->add_theme_color_override("bookmark_color", EDITOR_GET("text_editor/highlighting/bookmark_color"));
+ text_editor->add_theme_color_override("breakpoint_color", EDITOR_GET("text_editor/highlighting/breakpoint_color"));
+ text_editor->add_theme_color_override("executing_line_color", EDITOR_GET("text_editor/highlighting/executing_line_color"));
+ text_editor->add_theme_color_override("code_folding_color", EDITOR_GET("text_editor/highlighting/code_folding_color"));
+ text_editor->add_theme_color_override("search_result_color", EDITOR_GET("text_editor/highlighting/search_result_color"));
+ text_editor->add_theme_color_override("search_result_border_color", EDITOR_GET("text_editor/highlighting/search_result_border_color"));
+ text_editor->add_theme_constant_override("line_spacing", EDITOR_DEF("text_editor/theme/line_spacing", 6));
+ emit_signal("load_theme_settings");
+ _load_theme_settings();
+}
+
void CodeTextEditor::_update_font() {
text_editor->add_theme_font_override("font", get_theme_font("source", "EditorFonts"));
text_editor->add_theme_font_size_override("font_size", get_theme_font_size("source_size", "EditorFonts"));
@@ -1497,6 +1569,7 @@ void CodeTextEditor::_update_font() {
}
void CodeTextEditor::_on_settings_change() {
+ _update_text_editor_theme();
_update_font();
font_size = EditorSettings::get_singleton()->get("interface/editor/code_font_size");
@@ -1534,9 +1607,7 @@ void CodeTextEditor::_on_settings_change() {
EDITOR_GET("text_editor/completion/code_complete_delay"));
// Call hint settings.
- text_editor->set_callhint_settings(
- EDITOR_GET("text_editor/completion/put_callhint_tooltip_below_current_line"),
- EDITOR_GET("text_editor/completion/callhint_tooltip_offset"));
+ text_editor->set_code_hint_draw_below(EDITOR_GET("text_editor/completion/put_callhint_tooltip_below_current_line"));
idle->set_wait_time(EDITOR_GET("text_editor/completion/idle_parse_delay"));
}
@@ -1550,15 +1621,19 @@ void CodeTextEditor::validate_script() {
idle->start();
}
-void CodeTextEditor::_warning_label_gui_input(const Ref<InputEvent> &p_event) {
- Ref<InputEventMouseButton> mb = p_event;
- if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MOUSE_BUTTON_LEFT) {
- _warning_button_pressed();
- }
+void CodeTextEditor::_error_button_pressed() {
+ _set_show_errors_panel(!is_errors_panel_opened);
+ _set_show_warnings_panel(false);
}
void CodeTextEditor::_warning_button_pressed() {
_set_show_warnings_panel(!is_warnings_panel_opened);
+ _set_show_errors_panel(false);
+}
+
+void CodeTextEditor::_set_show_errors_panel(bool p_show) {
+ is_errors_panel_opened = p_show;
+ emit_signal("show_errors_panel", p_show);
}
void CodeTextEditor::_set_show_warnings_panel(bool p_show) {
@@ -1583,17 +1658,15 @@ void CodeTextEditor::_error_pressed(const Ref<InputEvent> &p_event) {
void CodeTextEditor::_notification(int p_what) {
switch (p_what) {
- case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
- _load_theme_settings();
- emit_signal("load_theme_settings");
- } break;
case NOTIFICATION_THEME_CHANGED: {
if (toggle_scripts_button->is_visible()) {
update_toggle_scripts_button();
}
+ _update_text_editor_theme();
_update_font();
} break;
case NOTIFICATION_ENTER_TREE: {
+ error_button->set_icon(get_theme_icon("StatusError", "EditorIcons"));
warning_button->set_icon(get_theme_icon("NodeWarning", "EditorIcons"));
add_theme_constant_override("separation", 4 * EDSCALE);
} break;
@@ -1603,16 +1676,28 @@ void CodeTextEditor::_notification(int p_what) {
}
set_process_input(is_visible_in_tree());
} break;
+ case NOTIFICATION_PREDELETE: {
+ if (find_replace_bar) {
+ find_replace_bar->set_text_edit(nullptr);
+ }
+ } break;
default:
break;
}
}
-void CodeTextEditor::set_warning_nb(int p_warning_nb) {
- warning_count_label->set_text(itos(p_warning_nb));
- warning_count_label->set_visible(p_warning_nb > 0);
- warning_button->set_visible(p_warning_nb > 0);
- if (!p_warning_nb) {
+void CodeTextEditor::set_error_count(int p_error_count) {
+ error_button->set_text(itos(p_error_count));
+ error_button->set_visible(p_error_count > 0);
+ if (!p_error_count) {
+ _set_show_errors_panel(false);
+ }
+}
+
+void CodeTextEditor::set_warning_count(int p_warning_count) {
+ warning_button->set_text(itos(p_warning_count));
+ warning_button->set_visible(p_warning_count > 0);
+ if (!p_warning_count) {
_set_show_warnings_panel(false);
}
}
@@ -1679,6 +1764,7 @@ void CodeTextEditor::_bind_methods() {
ADD_SIGNAL(MethodInfo("validate_script"));
ADD_SIGNAL(MethodInfo("load_theme_settings"));
+ ADD_SIGNAL(MethodInfo("show_errors_panel"));
ADD_SIGNAL(MethodInfo("show_warnings_panel"));
}
@@ -1735,17 +1821,9 @@ CodeTextEditor::CodeTextEditor() {
} break;
}
- // Added second so it opens at the bottom, so it won't shift the entire text editor when opening.
- find_replace_bar = memnew(FindReplaceBar);
- add_child(find_replace_bar);
- find_replace_bar->set_h_size_flags(SIZE_EXPAND_FILL);
- find_replace_bar->hide();
-
- find_replace_bar->set_text_edit(text_editor);
-
text_editor->set_draw_line_numbers(true);
text_editor->set_brace_matching(true);
- text_editor->set_auto_indent(true);
+ text_editor->set_auto_indent_enabled(true);
status_bar = memnew(HBoxContainer);
add_child(status_bar);
@@ -1783,7 +1861,22 @@ CodeTextEditor::CodeTextEditor() {
error->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
error->set_mouse_filter(MOUSE_FILTER_STOP);
error->connect("gui_input", callable_mp(this, &CodeTextEditor::_error_pressed));
- find_replace_bar->connect("error", callable_mp(error, &Label::set_text));
+
+ // Errors
+ error_button = memnew(Button);
+ error_button->set_flat(true);
+ status_bar->add_child(error_button);
+ error_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
+ error_button->set_default_cursor_shape(CURSOR_POINTING_HAND);
+ error_button->connect("pressed", callable_mp(this, &CodeTextEditor::_error_button_pressed));
+ error_button->set_tooltip(TTR("Errors"));
+
+ error_button->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("error_color", "Editor"));
+ error_button->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts"));
+ error_button->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size("status_source_size", "EditorFonts"));
+
+ is_errors_panel_opened = false;
+ set_error_count(0);
// Warnings
warning_button = memnew(Button);
@@ -1794,20 +1887,12 @@ CodeTextEditor::CodeTextEditor() {
warning_button->connect("pressed", callable_mp(this, &CodeTextEditor::_warning_button_pressed));
warning_button->set_tooltip(TTR("Warnings"));
- warning_count_label = memnew(Label);
- status_bar->add_child(warning_count_label);
- warning_count_label->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER);
- warning_count_label->set_align(Label::ALIGN_RIGHT);
- warning_count_label->set_default_cursor_shape(CURSOR_POINTING_HAND);
- warning_count_label->set_mouse_filter(MOUSE_FILTER_STOP);
- warning_count_label->set_tooltip(TTR("Warnings"));
- warning_count_label->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("warning_color", "Editor"));
- warning_count_label->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts"));
- warning_count_label->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size("status_source_size", "EditorFonts"));
- warning_count_label->connect("gui_input", callable_mp(this, &CodeTextEditor::_warning_label_gui_input));
+ warning_button->add_theme_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_theme_color("warning_color", "Editor"));
+ warning_button->add_theme_font_override("font", EditorNode::get_singleton()->get_gui_base()->get_theme_font("status_source", "EditorFonts"));
+ warning_button->add_theme_font_size_override("font_size", EditorNode::get_singleton()->get_gui_base()->get_theme_font_size("status_source_size", "EditorFonts"));
is_warnings_panel_opened = false;
- set_warning_nb(0);
+ set_warning_count(0);
// Line and column
line_and_col_txt = memnew(Label);
@@ -1821,15 +1906,17 @@ CodeTextEditor::CodeTextEditor() {
text_editor->connect("gui_input", callable_mp(this, &CodeTextEditor::_text_editor_gui_input));
text_editor->connect("cursor_changed", callable_mp(this, &CodeTextEditor::_line_col_changed));
text_editor->connect("text_changed", callable_mp(this, &CodeTextEditor::_text_changed));
- text_editor->connect("request_completion", callable_mp(this, &CodeTextEditor::_complete_request));
- Vector<String> cs;
+ text_editor->connect("request_code_completion", callable_mp(this, &CodeTextEditor::_complete_request));
+ TypedArray<String> cs;
cs.push_back(".");
cs.push_back(",");
cs.push_back("(");
cs.push_back("=");
cs.push_back("$");
cs.push_back("@");
- text_editor->set_completion(true, cs);
+ cs.push_back("\"");
+ cs.push_back("\'");
+ text_editor->set_code_completion_prefixes(cs);
idle->connect("timeout", callable_mp(this, &CodeTextEditor::_text_changed_idle_timeout));
code_complete_timer->connect("timeout", callable_mp(this, &CodeTextEditor::_code_complete_timer_timeout));