GDScript: Fix autocompletetion showing class names with an underscore

Fixes #35469.

(cherry picked from commit 00c6cdd793)
This commit is contained in:
janglee 2020-01-30 18:13:07 +05:30 committed by Rémi Verschelde
parent 373ec9a8a2
commit e0fe0c3d82
1 changed files with 3 additions and 0 deletions

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);
for (List<StringName>::Element *E = enum_constants.front(); E; E = E->next()) {
String candidate = class_name + "." + E->get();
if (candidate[0] == '_') { // Trim leading underscore.
candidate = candidate.substr(1);
}
ScriptCodeCompletionOption option(candidate, ScriptCodeCompletionOption::KIND_ENUM);
r_result.insert(option.display, option);
}