ronantakizawa/codereview-bench huggingface dataset:
Repository: godotengine/godot
File: editor/debugger/script_editor_debugger.cpp (C++)

Code before:
	if (path.is_empty() || !FileAccess::exists(path)) {
		return;
	}
	FileSystemDock::get_singleton()->open_file(path);
}

void ScriptEditorDebugger::_vmem_tree_rmb_selected(const Vector2 &p_pos, MouseButton p_button) {
	if (p_button != MouseButton::RIGHT) {
		return;
	}

	TreeItem *item = vmem_tree->get_selected();
	if (!item) {
		return;
	}

	String path = item->get_text(0);
	if (path.is_empty() || !FileAccess::exists(path)) {
		return;
	}

	vmem_item_menu->clear();
	vmem_item_menu->reset_size();

	vmem_item_menu->add_icon_item(get_editor_theme_icon(SNAME("ShowInFileSystem")),
			TTR("Show in FileSystem"), VMEM_MENU_SHOW_IN_FILESYSTEM);
	vmem_item_menu->add_icon_item(get_editor_theme_icon(SNAME("Filesystem")),
			TTR("Show in File Manager"), VMEM_MENU_SHOW_IN_EXPLORER);

	vmem_item_menu->add_item(TTR("View Owners..."), VMEM_MENU_OWNERS);

	vmem_item_menu->set_position(vmem_tree->get_screen_position() + p_pos);
	vmem_item_menu->popup();
}

void ScriptEditorDebugger::_vmem_item_menu_id_pressed(int p_option) {
	TreeItem *item = vmem_tree->get_selected();
	if (!item) {
		return;
	}

	String path = item->get_text(0);
	if (path.is_empty() || !FileAccess::exists(path)) {
		return;
	}

	switch (p_option) {
		case VMEM_MENU_SHOW_IN_FILESYSTEM: {
			FileSystemDock::get_singleton()->navigate_to_path(path);
		} break;
		case VMEM_MENU_SHOW_IN_EXPLORER: {

Review comment (suggestion):
```suggestion
			TTRC("Show in FileSystem"), VMEM_MENU_SHOW_IN_FILESYSTEM);
```
Same in other options.

Code after:
		item = item->get_next();
	}
}

void ScriptEditorDebugger::_vmem_item_activated() {
	TreeItem *selected = vmem_tree->get_selected();
	if (!selected) {
		return;
	}
	const String path = selected->get_text(0);
	if (path.is_empty() || !FileAccess::exists(path)) {
		return;
	}
	FileSystemDock::get_singleton()->navigate_to_path(path);
}

void ScriptEditorDebugger::_vmem_tree_rmb_selected(const Vector2 &p_pos, MouseButton p_button) {
	if (p_button != MouseButton::RIGHT) {
		return;
	}

	TreeItem *item = vmem_tree->get_selected();
	if (!item) {
		return;
	}

	String path = item->get_text(0);
	if (path.is_empty() || !FileAccess::exists(path)) {
		return;
	}

	vmem_item_menu->set_position(vmem_tree->get_screen_position() + p_pos);
	vmem_item_menu->popup();
}

void ScriptEditorDebugger::_vmem_item_menu_id_pressed(int p_option) {
	TreeItem *item = vmem_tree->get_selected();
	if (!item) {
		return;
	}

	String path = item->get_text(0);
	switch (p_option) {
		case VMEM_MENU_SHOW_IN_FILESYSTEM: {
			FileSystemDock::get_singleton()->navigate_to_path(path);
		} break;
		case VMEM_MENU_SHOW_IN_EXPLORER: {
			OS::get_singleton()->shell_show_in_file_manager(ProjectSettings::get_singleton()->globalize_path(path), true);
		} break;
		case VMEM_MENU_OWNERS: {
			FileSystemDock::get_owners_dialog()->show(path);
Repository: godotengine/godot
File: editor/editor_node.h (C/C++)

Code before:
	void notify_settings_overrides_changed();

	void dim_editor(bool p_dimming);
	bool is_editor_dimmed() const;

	void edit_current() { _edit_current(); }

	bool has_scenes_in_session();

	void undo();
	void redo();

	int execute_and_show_output(const String &p_title, const String &p_path, const List<String> &p_arguments, bool p_close_on_ok = true, bool p_close_on_errors = false, String *r_output = nullptr);

	EditorNode();
	~EditorNode();

	void add_resource_conversion_plugin(const Ref<EditorResourceConversionPlugin> &p_plugin);
	void remove_resource_conversion_plugin(const Ref<EditorResourceConversionPlugin> &p_plugin);
	Vector<Ref<EditorResourceConversionPlugin>> find_resource_conversion_plugin_for_resource(const Ref<Resource> &p_for_resource);
	Vector<Ref<EditorResourceConversionPlugin>> find_resource_conversion_plugin_for_type_name(const String &p_type);

	bool ensure_main_scene(bool p_from_native);
	bool validate_custom_directory();
	void run_editor_script(const Ref<Script> &p_script);
	bool _is_scene_unsaved(int p_idx);
};

struct EditorProgressBG {
	String task;
	void step(int p_step = -1) { EditorNode::progress_task_step_bg(task, p_step); }
	EditorProgressBG(const String &p_task, const String &p_label, int p_amount) {
		EditorNode::progress_add_task_bg(p_task, p_label, p_amount);
		task = p_task;
	}
	~EditorProgressBG() { EditorNode::progress_end_task_bg(task); }
};


Review comment (suggestion):
```suggestion
	bool is_scene_unsaved(int p_idx);
```

Code after:
	void dim_editor(bool p_dimming);
	bool is_editor_dimmed() const;

	void edit_current() { _edit_current(); }

	bool has_scenes_in_session();

	void undo();
	void redo();

	int execute_and_show_output(const String &p_title, const String &p_path, const List<String> &p_arguments, bool p_close_on_ok = true, bool p_close_on_errors = false, String *r_output = nullptr);

	EditorNode();
	~EditorNode();

	void add_resource_conversion_plugin(const Ref<EditorResourceConversionPlugin> &p_plugin);
	void remove_resource_conversion_plugin(const Ref<EditorResourceConversionPlugin> &p_plugin);
	Vector<Ref<EditorResourceConversionPlugin>> find_resource_conversion_plugin_for_resource(const Ref<Resource> &p_for_resource);
	Vector<Ref<EditorResourceConversionPlugin>> find_resource_conversion_plugin_for_type_name(const String &p_type);

	bool ensure_main_scene(bool p_from_native);
	bool validate_custom_directory();
	void run_editor_script(const Ref<Script> &p_script);
	bool is_scene_unsaved(int p_idx);
};

struct EditorProgressBG {
	String task;
	void step(int p_step = -1) { EditorNode::progress_task_step_bg(task, p_step); }
	EditorProgressBG(const String &p_task, const String &p_label, int p_amount) {
		EditorNode::progress_add_task_bg(p_task, p_label, p_amount);
		task = p_task;
	}
	~EditorProgressBG() { EditorNode::progress_end_task_bg(task); }
};
Repository: godotengine/godot
File: editor/file_system/dependency_editor.cpp (C++)

Code before:
	set_ok_button_text(TTR("Delete"));
	add_child(delete_confirm);
	dep_edit = memnew(DependencyEditor);
	add_child(dep_edit);
	delete_confirm->connect(SceneStringName(confirmed), callable_mp(this, &OrphanResourcesDialog::_delete_confirm));
	set_hide_on_ok(false);

	VBoxContainer *vbc = memnew(VBoxContainer);
	add_child(vbc);

	files = memnew(Tree);
	files->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
	files->set_columns(2);
	files->set_column_titles_visible(true);
	files->set_column_custom_minimum_width(1, 100 * EDSCALE);
	files->set_column_expand(0, true);
	files->set_column_clip_content(0, true);
	files->set_column_expand(1, false);
	files->set_column_clip_content(1, true);
	files->set_column_title(0, TTR("Resource"));
	files->set_column_title(1, TTR("Owns"));
	files->set_hide_root(true);
	files->set_scroll_hint_mode(Tree::SCROLL_HINT_MODE_BOTTOM);
	files->connect("button_clicked", callable_mp(this, &OrphanResourcesDialog::_button_pressed));

	MarginContainer *mc = vbc->add_margin_child(TTR("Resources Without Explicit Ownership:"), files, true);
	mc->set_theme_type_variation("NoBorderHorizontalWindow");
	mc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
}


Review comment (suggestion):
Since you are changing it anyway
```suggestion
	MarginContainer *mc = vbc->add_margin_child(TTRC("Resources Without Explicit Ownership:"), files, true);
```

Code after:
}

void OrphanResourcesDialog::_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button) {
	if (p_button != MouseButton::LEFT) {
		return;
	}
	TreeItem *ti = Object::cast_to<TreeItem>(p_item);

	String path = ti->get_metadata(0);
	dep_edit->edit(path);
}

OrphanResourcesDialog::OrphanResourcesDialog() {
	set_title(TTR("Orphan Resource Explorer"));
	delete_confirm = memnew(ConfirmationDialog);
	set_ok_button_text(TTR("Delete"));
	add_child(delete_confirm);
	dep_edit = memnew(DependencyEditor);
	add_child(dep_edit);
	delete_confirm->connect(SceneStringName(confirmed), callable_mp(this, &OrphanResourcesDialog::_delete_confirm));
	set_hide_on_ok(false);

	VBoxContainer *vbc = memnew(VBoxContainer);
	add_child(vbc);

	files = memnew(Tree);
	files->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
	files->set_columns(2);
	files->set_column_titles_visible(true);
	files->set_column_custom_minimum_width(1, 100 * EDSCALE);
	files->set_column_expand(0, true);
	files->set_column_clip_content(0, true);
	files->set_column_expand(1, false);
	files->set_column_clip_content(1, true);
	files->set_column_title(0, TTR("Resource"));
	files->set_column_title(1, TTR("Owns"));
	files->set_hide_root(true);
	files->set_scroll_hint_mode(Tree::SCROLL_HINT_MODE_BOTTOM);
	files->connect("button_clicked", callable_mp(this, &OrphanResourcesDialog::_button_pressed));

	MarginContainer *mc = vbc->add_margin_child(TTRC("Resources Without Explicit Ownership:"), files, true);
	mc->set_theme_type_variation("NoBorderHorizontalWindow");
	mc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
}
Repository: godotengine/godot
File: editor/settings/editor_layouts_dialog.cpp (C++)

Code before:
	if (name->is_visible()) {
		name->grab_focus();
	} else {
		layout_names->grab_focus(true);
	}
}

EditorLayoutsDialog::EditorLayoutsDialog() {
	makevb = memnew(VBoxContainer);
	add_child(makevb);

	layout_names = memnew(ItemList);
	layout_names->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
	layout_names->set_select_mode(ItemList::SELECT_MULTI);
	layout_names->set_allow_rmb_select(true);
	layout_names->set_scroll_hint_mode(ItemList::SCROLL_HINT_MODE_BOTH);
	layout_names->connect("multi_selected", callable_mp(this, &EditorLayoutsDialog::_update_ok_disable_state).unbind(2));

	MarginContainer *mc = makevb->add_margin_child(TTR("Select Existing Layout:"), layout_names);
	mc->set_custom_minimum_size(Size2(300 * EDSCALE, 50 * EDSCALE));
	mc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	mc->set_theme_type_variation("NoBorderHorizontalWindow");

	name = memnew(LineEdit);
	makevb->add_child(name);
	name->set_placeholder(TTR("Or enter new layout name."));
	name->set_accessibility_name(TTRC("New layout name"));
	name->connect(SceneStringName(gui_input), callable_mp(this, &EditorLayoutsDialog::_line_gui_input));
	name->connect(SceneStringName(focus_entered), callable_mp(this, &EditorLayoutsDialog::_deselect_layout_names));
	name->connect(SceneStringName(text_changed), callable_mp(this, &EditorLayoutsDialog::_update_ok_disable_state).unbind(1));
}

void EditorLayoutsDialog::set_name_line_enabled(bool p_enabled) {
	name->set_visible(p_enabled);
}


Review comment (suggestion):
```suggestion
	name->set_placeholder(TTRC("Or enter new layout name."));
```

Code after:
	if (name->is_visible()) {
		name->grab_focus();
	} else {
		layout_names->grab_focus(true);
	}
}

EditorLayoutsDialog::EditorLayoutsDialog() {
	makevb = memnew(VBoxContainer);
	add_child(makevb);

	layout_names = memnew(ItemList);
	layout_names->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
	layout_names->set_select_mode(ItemList::SELECT_MULTI);
	layout_names->set_allow_rmb_select(true);
	layout_names->set_scroll_hint_mode(ItemList::SCROLL_HINT_MODE_BOTH);
	layout_names->connect("multi_selected", callable_mp(this, &EditorLayoutsDialog::_update_ok_disable_state).unbind(2));

	MarginContainer *mc = makevb->add_margin_child(TTRC("Select Existing Layout:"), layout_names);
	mc->set_custom_minimum_size(Size2(300 * EDSCALE, 50 * EDSCALE));
	mc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
	mc->set_theme_type_variation("NoBorderHorizontalWindow");

	name = memnew(LineEdit);
	makevb->add_child(name);
	name->set_placeholder(TTRC("Or enter new layout name."));
	name->set_accessibility_name(TTRC("New layout name"));
	name->connect(SceneStringName(gui_input), callable_mp(this, &EditorLayoutsDialog::_line_gui_input));
	name->connect(SceneStringName(focus_entered), callable_mp(this, &EditorLayoutsDialog::_deselect_layout_names));
	name->connect(SceneStringName(text_changed), callable_mp(this, &EditorLayoutsDialog::_update_ok_disable_state).unbind(1));
}

void EditorLayoutsDialog::set_name_line_enabled(bool p_enabled) {
	name->set_visible(p_enabled);
}
Repository: godotengine/godot
File: scene/debugger/scene_debugger.cpp (C++)

Code before:
		} else {
			_find_3d_items_at_pos(selection_position, items);
		}
#endif // _3D_DISABLED
	}

	items.sort();

	switch (selection_drag_state) {
		case SELECTION_DRAG_END: {
			selection_position = Point2(Math::INF, Math::INF);
			selection_drag_state = SELECTION_DRAG_NONE;

			if (selection_drag_area.get_area() > SELECTION_MIN_AREA) {
				if (!items.is_empty()) {
					Vector<Node *> nodes;
					for (const SelectResult item : items) {
						nodes.append(item.item);
					}
					_send_ids(nodes, false);
				}

				_update_selection_drag();
				return;
			}

			_update_selection_drag();
		} break;

		case SELECTION_DRAG_NONE: {
			if (node_select_mode == SELECT_MODE_LIST) {
				break;
			}

			if (multi_shortcut_pressed) {
				// Allow forcing box selection when an item was clicked.
				selection_drag_state = SELECTION_DRAG_MOVE;
			} else if (items.is_empty()) {
#ifdef _3D_DISABLED
				if (!selected_ci_nodes.is_empty()) {
#else
				if (!selected_ci_nodes.is_empty() || !selected_3d_nodes.is_empty()) {
#endif // _3D_DISABLED
					EngineDebugger::get_singleton()->send_message("remote_nothing_selected", Array());
					_clear_selection();
				}

				selection_drag_state = SELECTION_DRAG_MOVE;
			} else {
				break;
			}

Review comment (suggestion):
This broke 3D disabled builds, needs to be in `#ifndef _3D_DISABLED` checks, will make a fix tomorrow if someone hasn't gotten to it before then

Edit: Will write a fix now, pushing momentarily

Code after:
#ifndef _3D_DISABLED
	} else if (node_select_type == NODE_TYPE_3D) {
		if (selection_drag_valid) {
			_find_3d_items_at_rect(selection_drag_area, items);
		} else {
			_find_3d_items_at_pos(selection_position, items);
		}
#endif // _3D_DISABLED
	}

	if ((prefer_group_selection || avoid_locked_nodes) && !list_shortcut_pressed && node_select_mode == SELECT_MODE_SINGLE) {
		for (int i = 0; i < items.size(); i++) {
			Node *node = items[i].item;
			Node *final_node = node;
			real_t order = items[i].order;

			// Replace the node by the group if grouped.
			if (prefer_group_selection) {
				while (node && node != root) {
					if (node->has_meta("_edit_group_")) {
						final_node = node;

						if (Object::cast_to<CanvasItem>(final_node)) {
							CanvasItem *ci_tmp = Object::cast_to<CanvasItem>(final_node);
							order = ci_tmp->get_effective_z_index() + ci_tmp->get_canvas_layer();
						} else if (Object::cast_to<Node3D>(final_node)) {
							Node3D *node3d_tmp = Object::cast_to<Node3D>(final_node);
							Camera3D *camera = root->get_camera_3d();
							Vector3 pos = camera->project_ray_origin(selection_position);
							order = -pos.distance_to(node3d_tmp->get_global_transform().origin);
						}
					}
					node = node->get_parent();
				}
			}

			// Filter out locked nodes.
			if (avoid_locked_nodes && final_node->get_meta("_edit_lock_", false)) {
				items.remove_at(i);
				i--;
				continue;
			}

			items.write[i].item = final_node;
			items.write[i].order = order;
		}
	}

	// Remove possible duplicates.
	for (int i = 0; i < items.size(); i++) {
		Node *item = items[i].item;
Repository: godotengine/godot
File: editor/file_system/dependency_editor.h (C/C++)

Code before:

#pragma once

#include "scene/gui/dialogs.h"

class EditorFileDialog;
class EditorFileSystemDirectory;
class ItemList;
class PopupMenu;
class Tree;
class TreeItem;
class VBoxContainer;
class LineEdit;
class MenuButton;

enum class DependencyEditorSortBy {
	TYPE,
	TYPE_REVERSE,
	NAME,
	NAME_REVERSE,
	PATH,
	PATH_REVERSE,
	MAX,
};

enum class DependencyEditorColumn {
	TYPE,
	NAME,
	PATH,
	MAX,
};

class DependencyEditor : public AcceptDialog {
	GDCLASS(DependencyEditor, AcceptDialog);

	Tree *tree = nullptr;
	Button *fixdeps = nullptr;
	Label *warning_label = nullptr;
	LineEdit *filter = nullptr;
	MenuButton *menu_sort = nullptr;

	EditorFileDialog *search = nullptr;

	DependencyEditorSortBy sort_by = DependencyEditorSortBy::PATH;
	String replacing;
	String editing;
	List<String> missing;

	void _fix_and_find(EditorFileSystemDirectory *efsd, HashMap<String, HashMap<String, String>> &candidates);

	void _searched(const String &p_path);

Review comment (suggestion):
The names don't need to be that verbose.
```suggestion
enum class Column {
```
Like, in outside code typically you'd write `DependencyEditor::Column`, repeating the class in the enum name is redundant.

Code after:

#pragma once

#include "scene/gui/dialogs.h"

class EditorFileDialog;
class EditorFileSystemDirectory;
class ItemList;
class PopupMenu;
class Tree;
class TreeItem;
class VBoxContainer;
class LineEdit;
class MenuButton;

enum class DependencyEditorSortBy {
	TYPE,
	TYPE_REVERSE,
	NAME,
	NAME_REVERSE,
	PATH,
	PATH_REVERSE,
	MAX,
};

enum class Column {
	TYPE,
	NAME,
	PATH,
	MAX,
};

class DependencyEditor : public AcceptDialog {
	GDCLASS(DependencyEditor, AcceptDialog);

	Tree *tree = nullptr;
	Button *fixdeps = nullptr;
	Label *warning_label = nullptr;
	LineEdit *filter = nullptr;
	MenuButton *menu_sort = nullptr;

	EditorFileDialog *search = nullptr;

	DependencyEditorSortBy sort_by = DependencyEditorSortBy::PATH;
	String replacing;
	String editing;
	List<String> missing;

	void _fix_and_find(EditorFileSystemDirectory *efsd, HashMap<String, HashMap<String, String>> &candidates);

	void _searched(const String &p_path);
Repository: godotengine/godot
File: editor/file_system/dependency_editor.cpp (C++)

Code before:
		return ResourceUID::get_singleton()->get_id_path(uid);
	}

	// UID fallback path.
	return p_dep.get_slice("::", 2);
}

static String _get_stored_dep_path(const String &p_dep) {
	if (p_dep.get_slice_count("::") > 2) {
		return p_dep.get_slice("::", 2);
	}
	return p_dep.get_slice("::", 0);
}

List<String> DependencyEditor::_filter_deps(const List<String> &p_deps) {
	String filter_text = filter->get_text();

	if (filter_text.is_empty()) {
		return p_deps;
	}

	List<String> filtered;

	for (const String &item : p_deps) {
		String path = item.contains("::") ? item.get_slice("::", 2) : item;

		if (item.containsn(filter_text)) {
			filtered.push_back(item);
		}
	}

	return filtered;
}

void DependencyEditor::_update_list() {
	filter->set_right_icon(get_editor_theme_icon(SNAME("Search")));
	menu_sort->set_button_icon(get_editor_theme_icon(SNAME("Sort")));
	List<String> deps;
	ResourceLoader::get_dependencies(editing, &deps, true);
	deps = _filter_deps(deps);

	switch (sort_by) {
		case DependencyEditorSortBy::TYPE:
			deps.sort_custom<DependencyEditorSortByType>();
			break;
		case DependencyEditorSortBy::TYPE_REVERSE:
			deps.sort_custom<DependencyEditorSortByTypeReverse>();
			break;
		case DependencyEditorSortBy::PATH:
			deps.sort_custom<DependencyEditorSortByPath>();
			break;

Review comment (suggestion):
```suggestion
		const String path = item.contains("::") ? item.get_slice("::", 2) : item;
```

Code after:

	switch (sort_by) {
		case DependencyEditorSortBy::TYPE:
			deps.sort_custom<DependencyEditorSortByType>();
			break;
		case DependencyEditorSortBy::TYPE_REVERSE:
			deps.sort_custom<DependencyEditorSortByType>();
			deps.reverse();
			break;
		case DependencyEditorSortBy::PATH:
			deps.sort_custom<DependencyEditorSortByPath>();
			break;
		case DependencyEditorSortBy::PATH_REVERSE:
			deps.sort_custom<DependencyEditorSortByPath>();
			deps.reverse();
			break;
		case DependencyEditorSortBy::NAME:
			deps.sort_custom<DependencyEditorSortByFile>();
			break;
		case DependencyEditorSortBy::NAME_REVERSE:
			deps.sort_custom<DependencyEditorSortByFile>();
			deps.reverse();
			break;
		default:
			break;
	}

	tree->clear();
	missing.clear();

	TreeItem *root = tree->create_item();

	Ref<Texture2D> folder = tree->get_theme_icon(SNAME("folder"), SNAME("FileDialog"));

	bool broken = false;

	for (const String &dep : deps) {
		TreeItem *item = tree->create_item(root);

		const String path = _get_resolved_dep_path(dep);
		if (FileAccess::exists(path)) {
			item->set_text((int)Column::NAME, path.get_file());
			item->set_text((int)Column::PATH, path);
		} else {
			const String &stored_path = _get_stored_dep_path(dep);
			item->set_text((int)Column::NAME, stored_path.get_file());
			item->set_text((int)Column::PATH, stored_path);
			item->set_custom_color((int)Column::PATH, Color(1, 0.4, 0.3));
			missing.push_back(stored_path);
			broken = true;
		}
Repository: godotengine/godot
File: editor/file_system/dependency_editor.cpp (C++)

Code before:
	if (p_dep.get_slice_count("::") < 3) {
		return p_dep.get_slice("::", 0); // No UID, just return the path.
	}

	const String uid_text = p_dep.get_slice("::", 0);
	ResourceUID::ID uid = ResourceUID::get_singleton()->text_to_id(uid_text);

	// Dependency is in UID format, obtain proper path.
	if (uid != ResourceUID::INVALID_ID && ResourceUID::get_singleton()->has_id(uid)) {
		return ResourceUID::get_singleton()->get_id_path(uid);
	}

	// UID fallback path.
	return p_dep.get_slice("::", 2);
}

static String _get_stored_dep_path(const String &p_dep) {
	if (p_dep.get_slice_count("::") > 2) {
		return p_dep.get_slice("::", 2);
	}
	return p_dep.get_slice("::", 0);
}

List<String> DependencyEditor::_filter_deps(const List<String> &p_deps) {
	String filter_text = filter->get_text();

	if (filter_text.is_empty()) {
		return p_deps;
	}

	List<String> filtered;

	for (const String &item : p_deps) {
		String path = item.contains("::") ? item.get_slice("::", 2) : item;

		if (item.containsn(filter_text)) {
			filtered.push_back(item);
		}
	}

	return filtered;
}

void DependencyEditor::_update_list() {
	filter->set_right_icon(get_editor_theme_icon(SNAME("Search")));
	menu_sort->set_button_icon(get_editor_theme_icon(SNAME("Sort")));
	List<String> deps;
	ResourceLoader::get_dependencies(editing, &deps, true);
	deps = _filter_deps(deps);

	switch (sort_by) {

Review comment (suggestion):
```suggestion
	const String filter_text = filter->get_text();
```

Code after:
	}

	return filtered;
}

void DependencyEditor::_update_list() {
	List<String> deps;
	ResourceLoader::get_dependencies(editing, &deps, true);
	deps = _filter_deps(deps);

	switch (sort_by) {
		case DependencyEditorSortBy::TYPE:
			deps.sort_custom<DependencyEditorSortByType>();
			break;
		case DependencyEditorSortBy::TYPE_REVERSE:
			deps.sort_custom<DependencyEditorSortByType>();
			deps.reverse();
			break;
		case DependencyEditorSortBy::PATH:
			deps.sort_custom<DependencyEditorSortByPath>();
			break;
		case DependencyEditorSortBy::PATH_REVERSE:
			deps.sort_custom<DependencyEditorSortByPath>();
			deps.reverse();
			break;
		case DependencyEditorSortBy::NAME:
			deps.sort_custom<DependencyEditorSortByFile>();
			break;
		case DependencyEditorSortBy::NAME_REVERSE:
			deps.sort_custom<DependencyEditorSortByFile>();
			deps.reverse();
			break;
		default:
			break;
	}

	tree->clear();
	missing.clear();

	TreeItem *root = tree->create_item();

	Ref<Texture2D> folder = tree->get_theme_icon(SNAME("folder"), SNAME("FileDialog"));

	bool broken = false;

	for (const String &dep : deps) {
		TreeItem *item = tree->create_item(root);

		const String path = _get_resolved_dep_path(dep);
		if (FileAccess::exists(path)) {
			item->set_text((int)Column::NAME, path.get_file());