GDScript: Fix autocompletetion showing class names with an underscore

Fixes #35469.
This commit is contained in:
janglee 2020-01-30 18:13:07 +05:30 committed by Rémi Verschelde
parent 0cc154b120
commit 00c6cdd793

View file

@ -1838,6 +1838,9 @@ static void _find_enumeration_candidates(const String p_enum_hint, Map<String, S
ClassDB::get_enum_constants(class_name, enum_name, &enum_constants); ClassDB::get_enum_constants(class_name, enum_name, &enum_constants);
for (List<StringName>::Element *E = enum_constants.front(); E; E = E->next()) { for (List<StringName>::Element *E = enum_constants.front(); E; E = E->next()) {
String candidate = class_name + "." + E->get(); String candidate = class_name + "." + E->get();
if (candidate[0] == '_') { // Trim leading underscore.
candidate = candidate.substr(1);
}
ScriptCodeCompletionOption option(candidate, ScriptCodeCompletionOption::KIND_ENUM); ScriptCodeCompletionOption option(candidate, ScriptCodeCompletionOption::KIND_ENUM);
r_result.insert(option.display, option); r_result.insert(option.display, option);
} }