Move buffers from worktree to project

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Max Brunsfeld 2022-01-21 15:46:27 -08:00
parent 7de26302ec
commit bd49a02c92
4 changed files with 1265 additions and 1564 deletions

View File

@ -764,9 +764,9 @@ mod tests {
)
.await;
let (worktree, _) = project
let worktree = project
.update(&mut cx, |project, cx| {
project.find_or_create_worktree_for_abs_path("/test", false, cx)
project.add_local_worktree("/test", false, cx)
})
.await
.unwrap();
@ -777,9 +777,8 @@ mod tests {
worktree
.as_local_mut()
.unwrap()
.update_diagnostic_entries(
.update_diagnostics(
Arc::from("/test/main.rs".as_ref()),
None,
vec![
DiagnosticEntry {
range: PointUtf16::new(1, 8)..PointUtf16::new(1, 9),
@ -930,9 +929,8 @@ mod tests {
worktree
.as_local_mut()
.unwrap()
.update_diagnostic_entries(
.update_diagnostics(
Arc::from("/test/consts.rs".as_ref()),
None,
vec![DiagnosticEntry {
range: PointUtf16::new(0, 15)..PointUtf16::new(0, 15),
diagnostic: Diagnostic {
@ -1036,9 +1034,8 @@ mod tests {
worktree
.as_local_mut()
.unwrap()
.update_diagnostic_entries(
.update_diagnostics(
Arc::from("/test/consts.rs".as_ref()),
None,
vec![
DiagnosticEntry {
range: PointUtf16::new(0, 15)..PointUtf16::new(0, 15),

View File

@ -856,7 +856,7 @@ impl Buffer {
version: Option<i32>,
mut diagnostics: Vec<DiagnosticEntry<T>>,
cx: &mut ModelContext<Self>,
) -> Result<Operation>
) -> Result<()>
where
T: Copy + Ord + TextDimension + Sub<Output = T> + Clip + ToPoint,
{
@ -944,10 +944,13 @@ impl Buffer {
let set = DiagnosticSet::new(sanitized_diagnostics, content);
self.apply_diagnostic_update(set.clone(), cx);
Ok(Operation::UpdateDiagnostics {
let op = Operation::UpdateDiagnostics {
diagnostics: set.iter().cloned().collect(),
lamport_timestamp: self.text.lamport_clock.tick(),
})
};
self.send_operation(op, cx);
Ok(())
}
fn request_autoindent(&mut self, cx: &mut ModelContext<Self>) {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff