Skip to content

Commit

Permalink
Filter groups and categories from autocompletion
Browse files Browse the repository at this point in the history
  • Loading branch information
HolonProduction committed Dec 4, 2023
1 parent d76c1d0 commit b33e04b
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion modules/gdscript/gdscript_editor.cpp
Expand Up @@ -1057,6 +1057,8 @@ static void _find_identifiers_in_class(const GDScriptParser::ClassNode *p_class,
_find_identifiers_in_base(base_type, p_only_functions, r_result, p_recursion_depth + 1);
}

const int PROPERTY_USAGE_ORGANIZATIONAL = PROPERTY_USAGE_CATEGORY | PROPERTY_USAGE_GROUP | PROPERTY_USAGE_SUBGROUP;

static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base, bool p_only_functions, HashMap<String, ScriptLanguage::CodeCompletionOption> &r_result, int p_recursion_depth) {
ERR_FAIL_COND(p_recursion_depth > COMPLETION_RECURSION_LIMIT);

Expand All @@ -1083,6 +1085,12 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
List<PropertyInfo> members;
scr->get_script_property_list(&members);
for (const PropertyInfo &E : members) {
if (E.usage & PROPERTY_USAGE_ORGANIZATIONAL) {
continue;
}
if (E.name.contains("/")) {
continue;
}
int location = p_recursion_depth + _get_property_location(scr->get_class_name(), E.name);
ScriptLanguage::CodeCompletionOption option(E.name, ScriptLanguage::CODE_COMPLETION_KIND_MEMBER, location);
r_result.insert(option.display, option);
Expand Down Expand Up @@ -1152,7 +1160,7 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
List<PropertyInfo> pinfo;
ClassDB::get_property_list(type, &pinfo);
for (const PropertyInfo &E : pinfo) {
if (E.usage & (PROPERTY_USAGE_GROUP | PROPERTY_USAGE_CATEGORY)) {
if (E.usage & PROPERTY_USAGE_ORGANIZATIONAL) {
continue;
}
if (E.name.contains("/")) {
Expand Down Expand Up @@ -1213,6 +1221,9 @@ static void _find_identifiers_in_base(const GDScriptCompletionIdentifier &p_base
}

for (const PropertyInfo &E : members) {
if (E.usage & PROPERTY_USAGE_ORGANIZATIONAL) {
continue;
}
if (!String(E.name).contains("/")) {
ScriptLanguage::CodeCompletionOption option(E.name, ScriptLanguage::CODE_COMPLETION_KIND_MEMBER);
if (GDScriptParser::theme_color_names.has(E.name)) {
Expand Down

0 comments on commit b33e04b

Please sign in to comment.