Repository: godotengine/godot
File: editor/docks/filesystem_dock.cpp (C++)

Code before:
		}
		imports.push_back(fpath);
	}

	if (imports.is_empty()) {
		ImportDock::get_singleton()->clear();
	} else if (imports.size() == 1) {
		ImportDock::get_singleton()->set_edit_path(imports[0]);
	} else {
		ImportDock::get_singleton()->set_edit_multiple_paths(imports);
	}

	import_dock_needs_update = false;
}

void FileSystemDock::_feature_profile_changed() {
	_update_display_mode(true);
}

void FileSystemDock::_project_settings_changed() {
	assigned_folder_colors = ProjectSettings::get_singleton()->get_setting("file_customization/folder_colors");
}

void FileSystemDock::_editor_settings_changed() {
	bool prev_value = auto_nav_on_tab_changed;
	auto_nav_on_tab_changed = EditorSettings::get_singleton()->get_setting("interface/scene_tabs/auto_nav_in_file_system");
	if (prev_value == auto_nav_on_tab_changed) {
		return;
	}

	if (auto_nav_on_tab_changed) {
		EditorSceneTabs::get_singleton()->connect("tab_changed", callable_mp(this, &FileSystemDock::_editor_scene_tab_changed));
		_editor_scene_tab_changed(EditorSceneTabs::get_singleton()->get_current_tab());
	} else {
		EditorSceneTabs::get_singleton()->disconnect("tab_changed", callable_mp(this, &FileSystemDock::_editor_scene_tab_changed));
	}
}

void FileSystemDock::_editor_scene_tab_changed(int p_tab) {
	EditorData &ed = EditorNode::get_editor_data();
	String path = ed.get_scene_path(p_tab);
	if (!path.is_empty()) {
		navigate_to_path(path);
	}
}

void FileSystemDock::set_file_sort(FileSortOption p_file_sort) {
	for (int i = 0; i != (int)FileSortOption::FILE_SORT_MAX; i++) {
		tree_button_sort->get_popup()->set_item_checked(i, (i == (int)p_file_sort));
		file_list_button_sort->get_popup()->set_item_checked(i, (i == (int)p_file_sort));
	}

Review comment (suggestion):
```suggestion
	auto_nav_on_tab_changed = EDITOR_GET("interface/scene_tabs/auto_nav_in_file_system");
```

Code after:

	import_dock_needs_update = false;
}

void FileSystemDock::_feature_profile_changed() {
	_update_display_mode(true);
}

void FileSystemDock::_project_settings_changed() {
	assigned_folder_colors = ProjectSettings::get_singleton()->get_setting("file_customization/folder_colors");
}

void FileSystemDock::set_file_sort(FileSortOption p_file_sort) {
	for (int i = 0; i != (int)FileSortOption::FILE_SORT_MAX; i++) {
		tree_button_sort->get_popup()->set_item_checked(i, (i == (int)p_file_sort));
		file_list_button_sort->get_popup()->set_item_checked(i, (i == (int)p_file_sort));
	}
	file_sort = p_file_sort;

	// Update everything needed.
	update_all();
}

void FileSystemDock::_file_sort_popup(int p_id) {
	set_file_sort((FileSortOption)p_id);
}

// TODO: Could use a unit test.
Color FileSystemDock::get_dir_icon_color(const String &p_dir_path, const Color &p_default) {
	if (!singleton) { // This method can be called from the project manager.
		return p_default;
	}
	Color folder_icon_color = p_default;

	// Check for a folder color to inherit (if one is assigned).
	String parent_dir = ProjectSettings::get_singleton()->localize_path(p_dir_path);
	while (!parent_dir.is_empty() && parent_dir != "res://") {
		if (!parent_dir.ends_with("/")) {
			parent_dir += "/";
		}

		const String color_name = singleton->assigned_folder_colors.get(parent_dir, String());
		if (!color_name.is_empty()) {
			folder_icon_color = singleton->folder_colors[color_name];
			break;
		}
		parent_dir = parent_dir.trim_suffix("/").get_base_dir();
	}
	return folder_icon_color;
}