Allow saving of all buffers contained in project diagnostics editor
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
f0fe346e15
commit
88d663a253
3 changed files with 64 additions and 36 deletions
|
@ -1,3 +1,4 @@
|
|||
use anyhow::Result;
|
||||
use editor::{
|
||||
context_header_renderer, diagnostic_block_renderer, diagnostic_header_renderer,
|
||||
display_map::{BlockDisposition, BlockProperties},
|
||||
|
@ -5,7 +6,7 @@ use editor::{
|
|||
};
|
||||
use gpui::{
|
||||
action, elements::*, keymap::Binding, AppContext, Entity, ModelHandle, MutableAppContext,
|
||||
RenderContext, View, ViewContext, ViewHandle,
|
||||
RenderContext, Task, View, ViewContext, ViewHandle,
|
||||
};
|
||||
use language::{Bias, Buffer, Point};
|
||||
use postage::watch;
|
||||
|
@ -207,7 +208,7 @@ impl workspace::Item for ProjectDiagnostics {
|
|||
.await?;
|
||||
view.update(&mut cx, |view, cx| view.populate_excerpts(buffer, cx))
|
||||
}
|
||||
Result::Ok::<_, anyhow::Error>(())
|
||||
Result::<_, anyhow::Error>::Ok(())
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
|
@ -229,11 +230,8 @@ impl workspace::ItemView for ProjectDiagnosticsEditor {
|
|||
None
|
||||
}
|
||||
|
||||
fn save(
|
||||
&mut self,
|
||||
_: &mut ViewContext<Self>,
|
||||
) -> anyhow::Result<gpui::Task<anyhow::Result<()>>> {
|
||||
todo!()
|
||||
fn save(&mut self, cx: &mut ViewContext<Self>) -> Result<Task<Result<()>>> {
|
||||
self.excerpts.update(cx, |excerpts, cx| excerpts.save(cx))
|
||||
}
|
||||
|
||||
fn save_as(
|
||||
|
@ -241,8 +239,8 @@ impl workspace::ItemView for ProjectDiagnosticsEditor {
|
|||
_: ModelHandle<project::Worktree>,
|
||||
_: &std::path::Path,
|
||||
_: &mut ViewContext<Self>,
|
||||
) -> gpui::Task<anyhow::Result<()>> {
|
||||
todo!()
|
||||
) -> Task<Result<()>> {
|
||||
unreachable!()
|
||||
}
|
||||
|
||||
fn is_dirty(&self, cx: &AppContext) -> bool {
|
||||
|
@ -259,6 +257,14 @@ impl workspace::ItemView for ProjectDiagnosticsEditor {
|
|||
Event::Saved | Event::Dirtied | Event::FileHandleChanged
|
||||
)
|
||||
}
|
||||
|
||||
fn can_save(&self, _: &AppContext) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn can_save_as(&self, _: &AppContext) -> bool {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue