Repository: godotengine/godot
File: editor/gui/create_dialog.cpp (C++)

Code before:
	if (p_replace_mode) {
		set_title(vformat(TTR("Change Type of \"%s\""), p_current_name));
		set_ok_button_text(TTR("Change"));
	} else {
		set_title(vformat(TTR("Create New %s"), base_type));
		set_ok_button_text(TTR("Create"));
	}

	_load_favorites_and_history();
	_save_and_update_favorite_list();

	// Restore valid window bounds or pop up at default size.
	Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2());
	if (saved_size != Rect2()) {
		popup(saved_size);
	} else {
		popup_centered_clamped(Size2(900, 700) * EDSCALE, 0.8);
	}
}

void CreateDialog::_fill_type_list() {
	List<StringName> complete_type_list;
	ClassDB::get_class_list(&complete_type_list);
	for (const StringName &type : ScriptServer::get_global_class_list()) {
		complete_type_list.push_back(type);
	}

	EditorData &ed = EditorNode::get_editor_data();
	HashMap<String, DocData::ClassDoc> &class_docs_list = EditorHelp::get_doc_data()->class_list;

	for (const StringName &type : complete_type_list) {
		if (!_should_hide_type(type)) {
			TypeInfo type_info;
			type_info.type_name = type;

			const DocData::ClassDoc *class_docs = class_docs_list.getptr(type);
			if (class_docs) {
				type_info.search_keywords = class_docs->keywords.split(",");

				for (int i = 0; i < type_info.search_keywords.size(); i++) {
					type_info.search_keywords.set(i, type_info.search_keywords[i].strip_edges());
				}
			}

			type_info_list.push_back(type_info);

			if (!ed.get_custom_types().has(type)) {
				continue;
			}

			const Vector<EditorData::CustomType> &ct = ed.get_custom_types()[type];

Review comment (suggestion):
Considering this use-case, I'd probably keep using a parameter (instead of returning a new list), but make it use `LocalVector` for both `get_class_list` and `get_global_class_list`. You can use `SortArray` to sort just the subsection of the newly added elements to preserve behavior.

Code after:
	if (p_replace_mode) {
		set_title(vformat(TTR("Change Type of \"%s\""), p_current_name));
		set_ok_button_text(TTR("Change"));
	} else {
		set_title(vformat(TTR("Create New %s"), base_type));
		set_ok_button_text(TTR("Create"));
	}

	_load_favorites_and_history();
	_save_and_update_favorite_list();

	// Restore valid window bounds or pop up at default size.
	Rect2 saved_size = EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2());
	if (saved_size != Rect2()) {
		popup(saved_size);
	} else {
		popup_centered_clamped(Size2(900, 700) * EDSCALE, 0.8);
	}
}

void CreateDialog::for_inherit() {
	allow_abstract_scripts = true;
}

void CreateDialog::_fill_type_list() {
	LocalVector<StringName> complete_type_list;
	ClassDB::get_class_list(complete_type_list);
	ScriptServer::get_global_class_list(complete_type_list);

	EditorData &ed = EditorNode::get_editor_data();
	HashMap<String, DocData::ClassDoc> &class_docs_list = EditorHelp::get_doc_data()->class_list;

	for (const StringName &type : complete_type_list) {
		if (!_should_hide_type(type)) {
			TypeInfo type_info;
			type_info.type_name = type;

			const DocData::ClassDoc *class_docs = class_docs_list.getptr(type);
			if (class_docs) {
				type_info.search_keywords = class_docs->keywords.split(",");

				for (int i = 0; i < type_info.search_keywords.size(); i++) {
					type_info.search_keywords.set(i, type_info.search_keywords[i].strip_edges());
				}
			}

			type_info_list.push_back(type_info);

			if (!ed.get_custom_types().has(type)) {
				continue;
			}