mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-24 17:28:40 +00:00
Calculate the diff
This commit is contained in:
parent
6a8e3fd02d
commit
e2056756ef
1 changed files with 3 additions and 2 deletions
|
@ -187,6 +187,7 @@ impl Prettier {
|
|||
buffer: &ModelHandle<Buffer>,
|
||||
cx: &AsyncAppContext,
|
||||
) -> anyhow::Result<Diff> {
|
||||
// TODO kb prettier needs either a path or a `parser` (depends on a language) option to format
|
||||
let (buffer_text, buffer_language) =
|
||||
buffer.read_with(cx, |buffer, _| (buffer.text(), buffer.language().cloned()));
|
||||
let response = self
|
||||
|
@ -198,8 +199,8 @@ impl Prettier {
|
|||
})
|
||||
.await
|
||||
.context("prettier format request")?;
|
||||
dbg!("Formatted text", response.text);
|
||||
anyhow::bail!("TODO kb calculate the diff")
|
||||
let diff_task = buffer.read_with(cx, |buffer, cx| buffer.diff(response.text, cx));
|
||||
Ok(diff_task.await)
|
||||
}
|
||||
|
||||
pub async fn clear_cache(&self) -> anyhow::Result<()> {
|
||||
|
|
Loading…
Reference in a new issue