project_panel: Add auto_open settings (#40435)
- Based on #40234, and improvement of #40331 Release Notes: - Added granular settings to control when files auto-open in the project panel (project_panel.auto_open.on_create, on_paste, on_drop) <img width="662" height="367" alt="Screenshot_2025-10-16_17-28-31" src="https://github.com/user-attachments/assets/930a0a50-fc89-4c5d-8d05-b1fa2279de8b" /> --------- Co-authored-by: Smit Barmase <heysmitbarmase@gmail.com>
This commit is contained in:
co-authored by
Smit Barmase
parent
854c6873c7
commit
2ad7ecbcf0
@@ -510,6 +510,23 @@ impl OnLastWindowClosed {
|
||||
}
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom, Debug)]
|
||||
pub struct ProjectPanelAutoOpenSettings {
|
||||
/// Whether to automatically open newly created files in the editor.
|
||||
///
|
||||
/// Default: true
|
||||
pub on_create: Option<bool>,
|
||||
/// Whether to automatically open files after pasting or duplicating them.
|
||||
///
|
||||
/// Default: true
|
||||
pub on_paste: Option<bool>,
|
||||
/// Whether to automatically open files dropped from external sources.
|
||||
///
|
||||
/// Default: true
|
||||
pub on_drop: Option<bool>,
|
||||
}
|
||||
|
||||
#[skip_serializing_none]
|
||||
#[derive(Clone, PartialEq, Default, Serialize, Deserialize, JsonSchema, MergeFrom, Debug)]
|
||||
pub struct ProjectPanelSettingsContent {
|
||||
@@ -590,10 +607,8 @@ pub struct ProjectPanelSettingsContent {
|
||||
///
|
||||
/// Default: true
|
||||
pub drag_and_drop: Option<bool>,
|
||||
/// Whether to automatically open files when pasting them in the project panel.
|
||||
///
|
||||
/// Default: true
|
||||
pub open_file_on_paste: Option<bool>,
|
||||
/// Settings for automatically opening files.
|
||||
pub auto_open: Option<ProjectPanelAutoOpenSettings>,
|
||||
}
|
||||
|
||||
#[derive(
|
||||
|
||||
@@ -664,13 +664,13 @@ impl VsCodeSettings {
|
||||
hide_root: None,
|
||||
indent_guides: None,
|
||||
indent_size: None,
|
||||
open_file_on_paste: None,
|
||||
scrollbar: None,
|
||||
show_diagnostics: self
|
||||
.read_bool("problems.decorations.enabled")
|
||||
.and_then(|b| if b { Some(ShowDiagnostics::Off) } else { None }),
|
||||
starts_open: None,
|
||||
sticky_scroll: None,
|
||||
auto_open: None,
|
||||
};
|
||||
|
||||
if let (Some(false), Some(false)) = (
|
||||
|
||||
Reference in New Issue
Block a user