Move buffers from worktree to project
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
7de26302ec
commit
bd49a02c92
4 changed files with 1265 additions and 1564 deletions
|
@ -764,9 +764,9 @@ mod tests {
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
let (worktree, _) = project
|
let worktree = project
|
||||||
.update(&mut cx, |project, cx| {
|
.update(&mut cx, |project, cx| {
|
||||||
project.find_or_create_worktree_for_abs_path("/test", false, cx)
|
project.add_local_worktree("/test", false, cx)
|
||||||
})
|
})
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -777,9 +777,8 @@ mod tests {
|
||||||
worktree
|
worktree
|
||||||
.as_local_mut()
|
.as_local_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.update_diagnostic_entries(
|
.update_diagnostics(
|
||||||
Arc::from("/test/main.rs".as_ref()),
|
Arc::from("/test/main.rs".as_ref()),
|
||||||
None,
|
|
||||||
vec![
|
vec![
|
||||||
DiagnosticEntry {
|
DiagnosticEntry {
|
||||||
range: PointUtf16::new(1, 8)..PointUtf16::new(1, 9),
|
range: PointUtf16::new(1, 8)..PointUtf16::new(1, 9),
|
||||||
|
@ -930,9 +929,8 @@ mod tests {
|
||||||
worktree
|
worktree
|
||||||
.as_local_mut()
|
.as_local_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.update_diagnostic_entries(
|
.update_diagnostics(
|
||||||
Arc::from("/test/consts.rs".as_ref()),
|
Arc::from("/test/consts.rs".as_ref()),
|
||||||
None,
|
|
||||||
vec![DiagnosticEntry {
|
vec![DiagnosticEntry {
|
||||||
range: PointUtf16::new(0, 15)..PointUtf16::new(0, 15),
|
range: PointUtf16::new(0, 15)..PointUtf16::new(0, 15),
|
||||||
diagnostic: Diagnostic {
|
diagnostic: Diagnostic {
|
||||||
|
@ -1036,9 +1034,8 @@ mod tests {
|
||||||
worktree
|
worktree
|
||||||
.as_local_mut()
|
.as_local_mut()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
.update_diagnostic_entries(
|
.update_diagnostics(
|
||||||
Arc::from("/test/consts.rs".as_ref()),
|
Arc::from("/test/consts.rs".as_ref()),
|
||||||
None,
|
|
||||||
vec![
|
vec![
|
||||||
DiagnosticEntry {
|
DiagnosticEntry {
|
||||||
range: PointUtf16::new(0, 15)..PointUtf16::new(0, 15),
|
range: PointUtf16::new(0, 15)..PointUtf16::new(0, 15),
|
||||||
|
|
|
@ -856,7 +856,7 @@ impl Buffer {
|
||||||
version: Option<i32>,
|
version: Option<i32>,
|
||||||
mut diagnostics: Vec<DiagnosticEntry<T>>,
|
mut diagnostics: Vec<DiagnosticEntry<T>>,
|
||||||
cx: &mut ModelContext<Self>,
|
cx: &mut ModelContext<Self>,
|
||||||
) -> Result<Operation>
|
) -> Result<()>
|
||||||
where
|
where
|
||||||
T: Copy + Ord + TextDimension + Sub<Output = T> + Clip + ToPoint,
|
T: Copy + Ord + TextDimension + Sub<Output = T> + Clip + ToPoint,
|
||||||
{
|
{
|
||||||
|
@ -944,10 +944,13 @@ impl Buffer {
|
||||||
|
|
||||||
let set = DiagnosticSet::new(sanitized_diagnostics, content);
|
let set = DiagnosticSet::new(sanitized_diagnostics, content);
|
||||||
self.apply_diagnostic_update(set.clone(), cx);
|
self.apply_diagnostic_update(set.clone(), cx);
|
||||||
Ok(Operation::UpdateDiagnostics {
|
|
||||||
|
let op = Operation::UpdateDiagnostics {
|
||||||
diagnostics: set.iter().cloned().collect(),
|
diagnostics: set.iter().cloned().collect(),
|
||||||
lamport_timestamp: self.text.lamport_clock.tick(),
|
lamport_timestamp: self.text.lamport_clock.tick(),
|
||||||
})
|
};
|
||||||
|
self.send_operation(op, cx);
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn request_autoindent(&mut self, cx: &mut ModelContext<Self>) {
|
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
Loading…
Add table
Add a link
Reference in a new issue