Suggest unsaved buffer content text as the default filename (#35707)

Closes #24672

This PR complements a feature added earlier by @JosephTLyons (in
https://github.com/zed-industries/zed/pull/32353) where the text is
considered as the tab title in a new buffer. It piggybacks off that
change and sets the title as the suggested filename in the save dialog
(completely mirroring the same functionality in VSCode):

![2025-08-05 11 50
28](https://github.com/user-attachments/assets/49ad9e4a-5559-44b0-a4b0-ae19890e478e)

Release Notes:

- Text entered in a new untitled buffer is considered as the default
filename when saving
This commit is contained in:
Igal Tabachnik
2025-08-15 17:26:38 +02:00
committed by GitHub
parent 485802b9e5
commit 7993ee9c07
10 changed files with 75 additions and 18 deletions
+4
View File
@@ -654,6 +654,10 @@ impl Item for Editor {
}
}
fn suggested_filename(&self, cx: &App) -> SharedString {
self.buffer.read(cx).title(cx).to_string().into()
}
fn tab_icon(&self, _: &Window, cx: &App) -> Option<Icon> {
ItemSettings::get_global(cx)
.file_icons