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.cpp60
1 files changed, 52 insertions, 8 deletions
diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp
index ed50c7914e..7c396e1da3 100644
--- a/editor/code_editor.cpp
+++ b/editor/code_editor.cpp
@@ -341,7 +341,11 @@ bool FindReplaceBar::search_prev() {
bool FindReplaceBar::search_next() {
uint32_t flags = 0;
- String text = get_search_text();
+ String text;
+ if (replace_all_mode)
+ text = get_replace_text();
+ else
+ text = get_search_text();
if (is_whole_words())
flags |= TextEdit::SEARCH_WHOLE_WORDS;
@@ -724,7 +728,7 @@ void CodeTextEditor::_code_complete_timer_timeout() {
void CodeTextEditor::_complete_request() {
- List<String> entries;
+ List<ScriptCodeCompletionOption> entries;
String ctext = text_editor->get_text_for_completion();
_code_complete_script(ctext, &entries);
bool forced = false;
@@ -733,15 +737,55 @@ void CodeTextEditor::_complete_request() {
}
if (entries.size() == 0)
return;
- Vector<String> strs;
- strs.resize(entries.size());
- int i = 0;
- for (List<String>::Element *E = entries.front(); E; E = E->next()) {
- strs.write[i++] = E->get();
+ for (List<ScriptCodeCompletionOption>::Element *E = entries.front(); E; E = E->next()) {
+ E->get().icon = _get_completion_icon(E->get());
}
+ text_editor->code_complete(entries, forced);
+}
- text_editor->code_complete(strs, forced);
+Ref<Texture> CodeTextEditor::_get_completion_icon(const ScriptCodeCompletionOption &p_option) {
+ Ref<Texture> tex;
+ switch (p_option.kind) {
+ case ScriptCodeCompletionOption::KIND_CLASS: {
+ if (has_icon(p_option.display, "EditorIcons")) {
+ tex = get_icon(p_option.display, "EditorIcons");
+ } else {
+ tex = get_icon("Object", "EditorIcons");
+ }
+ } break;
+ case ScriptCodeCompletionOption::KIND_ENUM:
+ tex = get_icon("Enum", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_FILE_PATH:
+ tex = get_icon("File", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_NODE_PATH:
+ tex = get_icon("NodePath", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_VARIABLE:
+ tex = get_icon("Variant", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_CONSTANT:
+ tex = get_icon("MemberConstant", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_MEMBER:
+ tex = get_icon("MemberProperty", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_SIGNAL:
+ tex = get_icon("MemberSignal", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_FUNCTION:
+ tex = get_icon("MemberMethod", "EditorIcons");
+ break;
+ case ScriptCodeCompletionOption::KIND_PLAIN_TEXT:
+ tex = get_icon("CubeMesh", "EditorIcons");
+ break;
+ default:
+ tex = get_icon("String", "EditorIcons");
+ break;
+ }
+ return tex;
}
void CodeTextEditor::_font_resize_timeout() {