| 1029 | } |
| 1030 | |
| 1031 | void CodeTextEditor::_complete_request() { |
| 1032 | List<ScriptLanguage::CodeCompletionOption> entries; |
| 1033 | String ctext = text_editor->get_text_for_code_completion(); |
| 1034 | _code_complete_script(ctext, &entries); |
| 1035 | bool forced = false; |
| 1036 | if (code_complete_func) { |
| 1037 | code_complete_func(code_complete_ud, ctext, &entries, forced); |
| 1038 | } |
| 1039 | |
| 1040 | for (const ScriptLanguage::CodeCompletionOption &e : entries) { |
| 1041 | Color font_color = completion_font_color; |
| 1042 | if (!e.theme_color_name.is_empty() && EDITOR_GET("text_editor/completion/colorize_suggestions")) { |
| 1043 | font_color = get_theme_color(e.theme_color_name, SNAME("Editor")); |
| 1044 | } else if (e.insert_text.begins_with("\"") || e.insert_text.begins_with("\'")) { |
| 1045 | font_color = completion_string_color; |
| 1046 | } else if (e.insert_text.begins_with("##") || e.insert_text.begins_with("///")) { |
| 1047 | font_color = completion_doc_comment_color; |
| 1048 | } else if (e.insert_text.begins_with("&")) { |
| 1049 | font_color = completion_string_name_color; |
| 1050 | } else if (e.insert_text.begins_with("^")) { |
| 1051 | font_color = completion_node_path_color; |
| 1052 | } else if (e.insert_text.begins_with("#") || e.insert_text.begins_with("//")) { |
| 1053 | font_color = completion_comment_color; |
| 1054 | } |
| 1055 | text_editor->add_code_completion_option((CodeEdit::CodeCompletionKind)e.kind, e.display, e.insert_text, font_color, _get_completion_icon(e), e.default_value, e.location); |
| 1056 | } |
| 1057 | text_editor->update_code_completion_options(forced); |
| 1058 | } |
| 1059 | |
| 1060 | Ref<Texture2D> CodeTextEditor::_get_completion_icon(const ScriptLanguage::CodeCompletionOption &p_option) { |
| 1061 | Ref<Texture2D> tex; |
nothing calls this directly
no test coverage detected