file_finder: Put collab channel inclusion behind a setting (#51505)

Lukas Wirth created

Release Notes:

- N/A *or* Added/Fixed/Improved ...

Change summary

assets/settings/default.json                        | 2 ++
crates/file_finder/src/file_finder.rs               | 6 +++++-
crates/open_path_prompt/src/file_finder_settings.rs | 2 ++
crates/settings_content/src/settings_content.rs     | 4 ++++
4 files changed, 13 insertions(+), 1 deletion(-)

Detailed changes

assets/settings/default.json 🔗

@@ -1285,6 +1285,8 @@
     //   * "indexed": Use only the files Zed had indexed
     //   * "smart": Be smart and search for ignored when called from a gitignored worktree
     "include_ignored": "smart",
+    // Whether to include text channels in file finder results.
+    "include_channels": false,
   },
   // Whether or not to remove any trailing whitespace from lines of a buffer
   // before saving it.

crates/file_finder/src/file_finder.rs 🔗

@@ -844,7 +844,11 @@ impl FileFinderDelegate {
         cx: &mut Context<FileFinder>,
     ) -> Self {
         Self::subscribe_to_updates(&project, window, cx);
-        let channel_store = ChannelStore::try_global(cx);
+        let channel_store = if FileFinderSettings::get_global(cx).include_channels {
+            ChannelStore::try_global(cx)
+        } else {
+            None
+        };
         Self {
             file_finder,
             workspace,

crates/open_path_prompt/src/file_finder_settings.rs 🔗

@@ -8,6 +8,7 @@ pub struct FileFinderSettings {
     pub modal_max_width: FileFinderWidth,
     pub skip_focus_for_active_in_search: bool,
     pub include_ignored: Option<bool>,
+    pub include_channels: bool,
 }
 
 impl Settings for FileFinderSettings {
@@ -23,6 +24,7 @@ impl Settings for FileFinderSettings {
                 settings::IncludeIgnoredContent::Indexed => Some(false),
                 settings::IncludeIgnoredContent::Smart => None,
             },
+            include_channels: file_finder.include_channels.unwrap(),
         }
     }
 }

crates/settings_content/src/settings_content.rs 🔗

@@ -721,6 +721,10 @@ pub struct FileFinderSettingsContent {
     ///
     /// Default: Smart
     pub include_ignored: Option<IncludeIgnoredContent>,
+    /// Whether to include text channels in file finder results.
+    ///
+    /// Default: false
+    pub include_channels: Option<bool>,
 }
 
 #[derive(