Distinguish between singleton and non-singleton workspace items

* Prompt to save singleton items before non-singleton ones
* Don't prompt to save multi-buffers if they contain excerpts to items that are open elsewhere and not being closed.

Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-05-23 16:03:00 -07:00
parent fbd589b589
commit 0becbe482a
6 changed files with 190 additions and 115 deletions

View file

@ -484,6 +484,10 @@ impl workspace::Item for ProjectDiagnosticsEditor {
self.editor.project_entry_ids(cx)
}
fn is_singleton(&self, _: &AppContext) -> bool {
false
}
fn navigate(&mut self, data: Box<dyn Any>, cx: &mut ViewContext<Self>) -> bool {
self.editor
.update(cx, |editor, cx| editor.navigate(data, cx))
@ -517,10 +521,6 @@ impl workspace::Item for ProjectDiagnosticsEditor {
self.editor.reload(project, cx)
}
fn can_save_as(&self, _: &AppContext) -> bool {
false
}
fn save_as(
&mut self,
_: ModelHandle<Project>,