From 680dc9e81a79761f733db5ce7f3fa0c05b8e1ff6 Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Thu, 10 Sep 2020 21:25:40 +0100 Subject: Add comment and string tracking to CodeEdit --- editor/plugins/script_text_editor.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'editor/plugins/script_text_editor.cpp') diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index fe5d830239..99278a18ba 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -203,6 +203,26 @@ void ScriptTextEditor::_set_theme_for_script() { CodeEdit *text_edit = code_editor->get_text_editor(); text_edit->get_syntax_highlighter()->update_cache(); + List strings; + script->get_language()->get_string_delimiters(&strings); + text_edit->clear_string_delimiters(); + for (List::Element *E = strings.front(); E; E = E->next()) { + String string = E->get(); + String beg = string.get_slice(" ", 0); + String end = string.get_slice_count(" ") > 1 ? string.get_slice(" ", 1) : String(); + text_edit->add_string_delimiter(beg, end, end == ""); + } + + List comments; + script->get_language()->get_comment_delimiters(&comments); + text_edit->clear_comment_delimiters(); + for (List::Element *E = comments.front(); E; E = E->next()) { + String comment = E->get(); + String beg = comment.get_slice(" ", 0); + String end = comment.get_slice_count(" ") > 1 ? comment.get_slice(" ", 1) : String(); + text_edit->add_comment_delimiter(beg, end, end == ""); + } + /* add keywords for auto completion */ // singleton autoloads (as types, just as engine singletons are) Map autoloads = ProjectSettings::get_singleton()->get_autoload_list(); -- cgit v1.2.3 From 1c166737986a4c30fa5327f5f5eb97906dfa8abf Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Sun, 13 Sep 2020 21:14:20 +0100 Subject: Move and expose AutoComplete in CodeEdit --- editor/plugins/script_text_editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editor/plugins/script_text_editor.cpp') diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 99278a18ba..6836a877dd 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1076,7 +1076,7 @@ void ScriptTextEditor::_edit_option(int p_op) { _edit_option_toggle_inline_comment(); } break; case EDIT_COMPLETE: { - tx->query_code_comple(); + tx->request_code_completion(true); } break; case EDIT_AUTO_INDENT: { String text = tx->get_text(); -- cgit v1.2.3 From c1b9971ad833adb6cfced27c56e9098ac01bd277 Mon Sep 17 00:00:00 2001 From: Paulb23 Date: Fri, 18 Sep 2020 20:45:47 +0100 Subject: Move and expose Code Hint in CodeEdit --- editor/plugins/script_text_editor.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'editor/plugins/script_text_editor.cpp') diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 6836a877dd..a29e51e8fb 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1824,9 +1824,7 @@ ScriptTextEditor::ScriptTextEditor() { update_settings(); - code_editor->get_text_editor()->set_callhint_settings( - EditorSettings::get_singleton()->get("text_editor/completion/put_callhint_tooltip_below_current_line"), - EditorSettings::get_singleton()->get("text_editor/completion/callhint_tooltip_offset")); + code_editor->get_text_editor()->set_code_hint_draw_below(EditorSettings::get_singleton()->get("text_editor/completion/put_callhint_tooltip_below_current_line")); code_editor->get_text_editor()->set_select_identifiers_on_hover(true); code_editor->get_text_editor()->set_context_menu_enabled(false); -- cgit v1.2.3