You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
Improve sorting of enum autocompletion
(cherry picked from commit 76fd7ec394)
This commit is contained in:
committed by
Yuri Sizov
parent
c4fb3bc342
commit
571cb746f9
@@ -1210,6 +1210,8 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int location = ScriptLanguage::LOCATION_OTHER;
|
||||||
|
|
||||||
if (!p_only_functions) {
|
if (!p_only_functions) {
|
||||||
List<PropertyInfo> members;
|
List<PropertyInfo> members;
|
||||||
if (p_base.value.get_type() != Variant::NIL) {
|
if (p_base.value.get_type() != Variant::NIL) {
|
||||||
@@ -1223,7 +1225,11 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!String(E.name).contains("/")) {
|
if (!String(E.name).contains("/")) {
|
||||||
ScriptLanguage::CodeCompletionOption option(E.name, ScriptLanguage::CODE_COMPLETION_KIND_MEMBER);
|
ScriptLanguage::CodeCompletionOption option(E.name, ScriptLanguage::CODE_COMPLETION_KIND_MEMBER, location);
|
||||||
|
if (base_type.kind == GDScriptParser::DataType::ENUM) {
|
||||||
|
// Sort enum members in their declaration order.
|
||||||
|
location += 1;
|
||||||
|
}
|
||||||
if (GDScriptParser::theme_color_names.has(E.name)) {
|
if (GDScriptParser::theme_color_names.has(E.name)) {
|
||||||
option.theme_color_name = GDScriptParser::theme_color_names[E.name];
|
option.theme_color_name = GDScriptParser::theme_color_names[E.name];
|
||||||
}
|
}
|
||||||
@@ -1239,7 +1245,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
|
|||||||
// Enum types are static and cannot change, therefore we skip non-const dictionary methods.
|
// Enum types are static and cannot change, therefore we skip non-const dictionary methods.
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ScriptLanguage::CodeCompletionOption option(E.name, ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION);
|
ScriptLanguage::CodeCompletionOption option(E.name, ScriptLanguage::CODE_COMPLETION_KIND_FUNCTION, location);
|
||||||
if (E.arguments.size()) {
|
if (E.arguments.size()) {
|
||||||
option.insert_text += "(";
|
option.insert_text += "(";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user