1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-10 13:00:37 +00:00

Improve sorting of Code Completion options.

Done by ordering options by their location in the code - e.g. local, parent class, global, etc.
This commit is contained in:
Eric M
2022-03-09 00:03:36 +10:00
parent 74b07dd194
commit 4ab605d14d
7 changed files with 196 additions and 24 deletions

View File

@@ -311,6 +311,13 @@ public:
CODE_COMPLETION_KIND_MAX
};
enum CodeCompletionLocation {
LOCATION_LOCAL = 0,
LOCATION_PARENT_MASK = 1 << 8,
LOCATION_OTHER_USER_CODE = 1 << 9,
LOCATION_OTHER = 1 << 10,
};
struct CodeCompletionOption {
CodeCompletionKind kind = CODE_COMPLETION_KIND_PLAIN_TEXT;
String display;
@@ -319,13 +326,15 @@ public:
RES icon;
Variant default_value;
Vector<Pair<int, int>> matches;
int location = LOCATION_OTHER;
CodeCompletionOption() {}
CodeCompletionOption(const String &p_text, CodeCompletionKind p_kind) {
CodeCompletionOption(const String &p_text, CodeCompletionKind p_kind, int p_location = LOCATION_OTHER) {
display = p_text;
insert_text = p_text;
kind = p_kind;
location = p_location;
}
};