From 75f395c2a0dd3d1af4f53585145dc22f76ecd134 Mon Sep 17 00:00:00 2001 From: George Marques Date: Tue, 29 May 2018 23:16:59 -0300 Subject: Use type hints to improve completion - Allow type hints to be completed. - Use type information to infer completion candidates. - Show typed function signature in tooltip. - Add type hints when completing declaration from virtual functions (optional). --- editor/connections_dialog.cpp | 4 +++- editor/editor_settings.cpp | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'editor') diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 8933fd7fe8..c4f4e28fec 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -820,7 +820,9 @@ void ConnectionsDock::update_tree() { if (i > 0) signaldesc += ", "; String tname = "var"; - if (pi.type != Variant::NIL) { + if (pi.type == Variant::OBJECT && pi.class_name != StringName()) { + tname = pi.class_name.operator String(); + } else if (pi.type != Variant::NIL) { tname = Variant::get_type_name(pi.type); } signaldesc += tname + " " + (pi.name == "" ? String("arg " + itos(i)) : pi.name); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 4cfdb6f6d3..9736eb0969 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -404,6 +404,7 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { _initial_set("text_editor/completion/callhint_tooltip_offset", Vector2()); _initial_set("text_editor/files/restore_scripts_on_load", true); _initial_set("text_editor/completion/complete_file_paths", true); + _initial_set("text_editor/completion/add_type_hints", false); _initial_set("docks/scene_tree/start_create_dialog_fully_expanded", false); _initial_set("docks/scene_tree/draw_relationship_lines", false); -- cgit v1.2.3 From 03746da73f275030832f83373388cb0f248616eb Mon Sep 17 00:00:00 2001 From: George Marques Date: Tue, 5 Jun 2018 13:50:21 -0300 Subject: Add editor highlight for type-safe lines The line number is hightlighted to indicate that the line contains only type-safe code. --- editor/editor_settings.cpp | 2 ++ editor/editor_themes.cpp | 2 ++ editor/plugins/script_text_editor.cpp | 21 ++++++++++++++++++++- 3 files changed, 24 insertions(+), 1 deletion(-) (limited to 'editor') diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 9736eb0969..466b12157d 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -364,6 +364,7 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { _initial_set("text_editor/highlighting/highlight_all_occurrences", true); _initial_set("text_editor/highlighting/highlight_current_line", true); + _initial_set("text_editor/highlighting/highlight_type_safe_lines", true); _initial_set("text_editor/cursor/scroll_past_end_of_file", false); _initial_set("text_editor/indent/type", 0); @@ -593,6 +594,7 @@ void EditorSettings::_load_default_text_editor_theme() { _initial_set("text_editor/highlighting/completion_font_color", Color::html("aaaaaa")); _initial_set("text_editor/highlighting/text_color", Color::html("aaaaaa")); _initial_set("text_editor/highlighting/line_number_color", Color::html("66aaaaaa")); + _initial_set("text_editor/highlighting/safe_line_number_color", Color::html("99aac8aa")); _initial_set("text_editor/highlighting/caret_color", Color::html("aaaaaa")); _initial_set("text_editor/highlighting/caret_background_color", Color::html("000000")); _initial_set("text_editor/highlighting/text_selected_color", Color::html("000000")); diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp index 084caff083..ea9f6db61a 100644 --- a/editor/editor_themes.cpp +++ b/editor/editor_themes.cpp @@ -1089,6 +1089,7 @@ Ref create_editor_theme(const Ref p_theme) { const Color completion_font_color = font_color; const Color text_color = font_color; const Color line_number_color = dim_color; + const Color safe_line_number_color = dim_color * Color(1, 1.2, 1, 1.5); const Color caret_color = mono_color; const Color caret_background_color = mono_color.inverted(); const Color text_selected_color = dark_color_3; @@ -1123,6 +1124,7 @@ Ref create_editor_theme(const Ref p_theme) { setting->set_initial_value("text_editor/highlighting/completion_font_color", completion_font_color, true); setting->set_initial_value("text_editor/highlighting/text_color", text_color, true); setting->set_initial_value("text_editor/highlighting/line_number_color", line_number_color, true); + setting->set_initial_value("text_editor/highlighting/safe_line_number_color", safe_line_number_color, true); setting->set_initial_value("text_editor/highlighting/caret_color", caret_color, true); setting->set_initial_value("text_editor/highlighting/caret_background_color", caret_background_color, true); setting->set_initial_value("text_editor/highlighting/text_selected_color", text_selected_color, true); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index ffc2203475..2263d782d9 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -116,6 +116,7 @@ void ScriptTextEditor::_load_theme_settings() { Color completion_font_color = EDITOR_GET("text_editor/highlighting/completion_font_color"); Color text_color = EDITOR_GET("text_editor/highlighting/text_color"); Color line_number_color = EDITOR_GET("text_editor/highlighting/line_number_color"); + Color safe_line_number_color = EDITOR_GET("text_editor/highlighting/safe_line_number_color"); Color caret_color = EDITOR_GET("text_editor/highlighting/caret_color"); Color caret_background_color = EDITOR_GET("text_editor/highlighting/caret_background_color"); Color text_selected_color = EDITOR_GET("text_editor/highlighting/text_selected_color"); @@ -147,6 +148,7 @@ void ScriptTextEditor::_load_theme_settings() { text_edit->add_color_override("completion_font_color", completion_font_color); text_edit->add_color_override("font_color", text_color); text_edit->add_color_override("line_number_color", line_number_color); + text_edit->add_color_override("safe_line_number_color", safe_line_number_color); text_edit->add_color_override("caret_color", caret_color); text_edit->add_color_override("caret_background_color", caret_background_color); text_edit->add_color_override("font_selected_color", text_selected_color); @@ -589,6 +591,7 @@ void ScriptTextEditor::set_edited_script(const Ref