file_finder: Add skip_focus_for_active_in_search setting (#27624)

Closes #27073

Currently, when searching for a file with Ctrl+P, and the first file
found is the active one, file_finder skips focus to the second file
automatically. This PR adds a setting to disable this and make the first
file always the focused one.

Default setting is still skipping the active file.

Release Notes: 

- Added the `skip_focus_for_active_in_search` setting for the file
finder, which allows turning off the default behavior of skipping focus
on the active file while searching in the file finder.

---------

Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
This commit is contained in:
Patrick 2025-04-30 14:28:33 -03:00 committed by GitHub
parent d03d8ccec1
commit 84e4891d54
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 107 additions and 9 deletions

View file

@ -7,6 +7,7 @@ use settings::{Settings, SettingsSources};
pub struct FileFinderSettings {
pub file_icons: bool,
pub modal_max_width: Option<FileFinderWidth>,
pub skip_focus_for_active_in_search: bool,
}
#[derive(Clone, Default, Serialize, Deserialize, JsonSchema, Debug)]
@ -19,6 +20,10 @@ pub struct FileFinderSettingsContent {
///
/// Default: small
pub modal_max_width: Option<FileFinderWidth>,
/// Determines whether the file finder should skip focus for the active file in search results.
///
/// Default: true
pub skip_focus_for_active_in_search: Option<bool>,
}
impl Settings for FileFinderSettings {