Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions modules/gdscript/gdscript_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1048,10 +1048,19 @@ static void _find_global_enums(HashMap<String, ScriptLanguage::CodeCompletionOpt
}
}

static void _add_variant_types(HashMap<String, ScriptLanguage::CodeCompletionOption> &r_result) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me, this seems like premature splitting. This is a special case, so there's no need to separate this, an inline block inside _list_available_types() would be sufficient. Also, the function name is confusing: types instead of type when this function adds only one Variant type, and not, for example, all built-in Variant types.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a very helpful review, thanks! 🙏
It's my first time submitting a PR , so I really appreciate you catching these details.
I agree with you completely; this certainly looks like premature splitting. I'll follow your suggestion and move it back to an inline block within _list_available_types(), as the Variant is probably the only type needed for this change.
I apologize for the types plural—that was an oversight (and a lazy use of auto-complete!).

ScriptLanguage::CodeCompletionOption variant_option("Variant", ScriptLanguage::CODE_COMPLETION_KIND_CLASS);
r_result.insert(variant_option.display, variant_option);
}
static void _list_available_types(bool p_inherit_only, GDScriptParser::CompletionContext &p_context, HashMap<String, ScriptLanguage::CodeCompletionOption> &r_result) {
// Built-in Variant Types
_find_built_in_variants(r_result, true);

// Variant meta-type
if (!p_inherit_only) {
_add_variant_types(r_result);
}

LocalVector<StringName> native_types;
ClassDB::get_class_list(native_types);
for (const StringName &type : native_types) {
Expand Down