Fix compile errors

This commit is contained in:
Antonio Scandurra 2023-01-18 13:53:48 +01:00
parent a653e87658
commit 8ca0f9ac99
3 changed files with 23 additions and 16 deletions

View File

@ -410,10 +410,10 @@ async fn test_random_collaboration(
guest_buffer.read_with(client_cx, |b, _| b.saved_version().clone());
assert_eq!(guest_saved_version, host_saved_version);
let host_saved_version_fingerprint = host_buffer
.read_with(host_cx, |b, _| b.saved_version_fingerprint().to_string());
let guest_saved_version_fingerprint = guest_buffer
.read_with(client_cx, |b, _| b.saved_version_fingerprint().to_string());
let host_saved_version_fingerprint =
host_buffer.read_with(host_cx, |b, _| b.saved_version_fingerprint());
let guest_saved_version_fingerprint =
guest_buffer.read_with(client_cx, |b, _| b.saved_version_fingerprint());
assert_eq!(
guest_saved_version_fingerprint,
host_saved_version_fingerprint

View File

@ -13,8 +13,10 @@ use gpui::{
elements::*, geometry::vector::vec2f, AppContext, Entity, ModelHandle, MutableAppContext,
RenderContext, Subscription, Task, View, ViewContext, ViewHandle, WeakViewHandle,
};
use language::proto::serialize_anchor as serialize_text_anchor;
use language::{Bias, Buffer, File as _, OffsetRangeExt, Point, SelectionGoal};
use language::{
proto::serialize_anchor as serialize_text_anchor, Bias, Buffer, File as _, OffsetRangeExt,
Point, SelectionGoal,
};
use project::{File, FormatTrigger, Project, ProjectEntryId, ProjectPath};
use rpc::proto::{self, update_view};
use settings::Settings;
@ -1165,9 +1167,11 @@ fn path_for_file<'a>(
mod tests {
use super::*;
use gpui::MutableAppContext;
use language::RopeFingerprint;
use std::{
path::{Path, PathBuf},
sync::Arc,
time::SystemTime,
};
#[gpui::test]
@ -1197,7 +1201,7 @@ mod tests {
todo!()
}
fn mtime(&self) -> std::time::SystemTime {
fn mtime(&self) -> SystemTime {
todo!()
}
@ -1216,7 +1220,7 @@ mod tests {
_: clock::Global,
_: project::LineEnding,
_: &mut MutableAppContext,
) -> gpui::Task<anyhow::Result<(clock::Global, String, std::time::SystemTime)>> {
) -> gpui::Task<anyhow::Result<(clock::Global, RopeFingerprint, SystemTime)>> {
todo!()
}

View File

@ -20,10 +20,12 @@ use gpui::{
executor, AppContext, AsyncAppContext, Entity, ModelContext, ModelHandle, MutableAppContext,
Task,
};
use language::Unclipped;
use language::{
proto::{deserialize_version, serialize_line_ending, serialize_version},
Buffer, DiagnosticEntry, PointUtf16, Rope,
proto::{
deserialize_fingerprint, deserialize_version, serialize_fingerprint, serialize_line_ending,
serialize_version,
},
Buffer, DiagnosticEntry, PointUtf16, Rope, RopeFingerprint, Unclipped,
};
use parking_lot::Mutex;
use postage::{
@ -1863,7 +1865,7 @@ impl language::File for File {
version: clock::Global,
line_ending: LineEnding,
cx: &mut MutableAppContext,
) -> Task<Result<(clock::Global, String, SystemTime)>> {
) -> Task<Result<(clock::Global, RopeFingerprint, SystemTime)>> {
self.worktree.update(cx, |worktree, cx| match worktree {
Worktree::Local(worktree) => {
let rpc = worktree.client.clone();
@ -1878,7 +1880,7 @@ impl language::File for File {
buffer_id,
version: serialize_version(&version),
mtime: Some(entry.mtime.into()),
fingerprint: fingerprint.clone(),
fingerprint: serialize_fingerprint(fingerprint),
})?;
}
Ok((version, fingerprint, entry.mtime))
@ -1896,11 +1898,12 @@ impl language::File for File {
})
.await?;
let version = deserialize_version(response.version);
let fingerprint = deserialize_fingerprint(&response.fingerprint)?;
let mtime = response
.mtime
.ok_or_else(|| anyhow!("missing mtime"))?
.into();
Ok((version, response.fingerprint, mtime))
Ok((version, fingerprint, mtime))
})
}
})
@ -1943,7 +1946,7 @@ impl language::LocalFile for File {
&self,
buffer_id: u64,
version: &clock::Global,
fingerprint: String,
fingerprint: RopeFingerprint,
line_ending: LineEnding,
mtime: SystemTime,
cx: &mut MutableAppContext,
@ -1957,7 +1960,7 @@ impl language::LocalFile for File {
buffer_id,
version: serialize_version(version),
mtime: Some(mtime.into()),
fingerprint,
fingerprint: serialize_fingerprint(fingerprint),
line_ending: serialize_line_ending(line_ending) as i32,
})
.log_err();