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>,
|
buffer: &ModelHandle<Buffer>,
|
||||||
cx: &AsyncAppContext,
|
cx: &AsyncAppContext,
|
||||||
) -> anyhow::Result<Diff> {
|
) -> 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) =
|
let (buffer_text, buffer_language) =
|
||||||
buffer.read_with(cx, |buffer, _| (buffer.text(), buffer.language().cloned()));
|
buffer.read_with(cx, |buffer, _| (buffer.text(), buffer.language().cloned()));
|
||||||
let response = self
|
let response = self
|
||||||
|
@ -198,8 +199,8 @@ impl Prettier {
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.context("prettier format request")?;
|
.context("prettier format request")?;
|
||||||
dbg!("Formatted text", response.text);
|
let diff_task = buffer.read_with(cx, |buffer, cx| buffer.diff(response.text, cx));
|
||||||
anyhow::bail!("TODO kb calculate the diff")
|
Ok(diff_task.await)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn clear_cache(&self) -> anyhow::Result<()> {
|
pub async fn clear_cache(&self) -> anyhow::Result<()> {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue