Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Post-rebase fixes

Kirill Bulatov652909cdba12
diff --git a/crates/collab/src/tests/integration_tests.rs b/crates/collab/src/tests/integration_tests.rs
index 3cf4d9a8760..b20844a0651 100644
--- a/crates/collab/src/tests/integration_tests.rs
+++ b/crates/collab/src/tests/integration_tests.rs
@@ -7895,6 +7895,14 @@ async fn test_mutual_editor_inlay_hint_cache_update(
let workspace_a = client_a.build_workspace(&project_a, cx_a);
cx_a.foreground().start_waiting();
+ let _buffer_a = project_a
+ .update(cx_a, |project, cx| {
+ project.open_local_buffer("/a/main.rs", cx)
+ })
+ .await
+ .unwrap();
+ let fake_language_server = fake_language_servers.next().await.unwrap();
+ let next_call_id = Arc::new(AtomicU32::new(0));
let editor_a = workspace_a
.update(cx_a, |workspace, cx| {
workspace.open_path((worktree_id, "main.rs"), None, true, cx)
@@ -7903,9 +7911,6 @@ async fn test_mutual_editor_inlay_hint_cache_update(
.unwrap()
.downcast::<Editor>()
.unwrap();
-
- let fake_language_server = fake_language_servers.next().await.unwrap();
- let next_call_id = Arc::new(AtomicU32::new(0));
fake_language_server
.handle_request::<lsp::request::InlayHintRequest, _, _>(move |params, _| {
let task_next_call_id = Arc::clone(&next_call_id);
@@ -7938,6 +7943,7 @@ async fn test_mutual_editor_inlay_hint_cache_update(
.next()
.await
.unwrap();
+
cx_a.foreground().finish_waiting();
cx_a.foreground().run_until_parked();
diff --git a/crates/editor/src/inlay_hint_cache.rs b/crates/editor/src/inlay_hint_cache.rs
index ffff4ef2314..c85bbddd582 100644
--- a/crates/editor/src/inlay_hint_cache.rs
+++ b/crates/editor/src/inlay_hint_cache.rs
@@ -851,7 +851,6 @@ mod tests {
})
});
- cx.foreground().start_waiting();
let (file_with_hints, editor, fake_server) = prepare_test_objects(cx).await;
let lsp_request_count = Arc::new(AtomicU32::new(0));
fake_server
@@ -890,7 +889,6 @@ mod tests {
})
.next()
.await;
- cx.foreground().finish_waiting();
cx.foreground().run_until_parked();
let mut edits_made = 1;
@@ -976,7 +974,6 @@ mod tests {
})
});
- cx.foreground().start_waiting();
let (file_with_hints, editor, fake_server) = prepare_test_objects(cx).await;
let lsp_request_count = Arc::new(AtomicU32::new(0));
let another_lsp_request_count = Arc::clone(&lsp_request_count);
@@ -1025,7 +1022,6 @@ mod tests {
})
.next()
.await;
- cx.foreground().finish_waiting();
cx.foreground().run_until_parked();
let mut edits_made = 1;
@@ -1311,7 +1307,6 @@ mod tests {
})
});
- cx.foreground().start_waiting();
let (file_with_hints, editor, fake_server) = prepare_test_objects(cx).await;
let fake_server = Arc::new(fake_server);
let lsp_request_count = Arc::new(AtomicU32::new(0));
@@ -1353,7 +1348,6 @@ mod tests {
expected_changes.push(change_after_opening);
}
- cx.foreground().finish_waiting();
cx.foreground().run_until_parked();
editor.update(cx, |editor, cx| {
@@ -1444,7 +1438,6 @@ mod tests {
})
});
- cx.foreground().start_waiting();
let (file_with_hints, editor, fake_server) = prepare_test_objects(cx).await;
let fake_server = Arc::new(fake_server);
let lsp_request_count = Arc::new(AtomicU32::new(0));
@@ -1488,7 +1481,6 @@ mod tests {
add_refresh_task(&mut initial_refresh_tasks);
let _ = futures::future::join_all(initial_refresh_tasks).await;
- cx.foreground().finish_waiting();
cx.foreground().run_until_parked();
editor.update(cx, |editor, cx| {
@@ -1546,8 +1538,8 @@ mod tests {
"Should apply all changes made"
);
}
- assert_eq!(lsp_request_count.load(Ordering::Relaxed), 11);
- let expected_hints = vec!["11".to_string()];
+ assert_eq!(lsp_request_count.load(Ordering::Relaxed), 10);
+ let expected_hints = vec!["10".to_string()];
assert_eq!(
expected_hints,
cached_hint_labels(editor),
@@ -1587,8 +1579,8 @@ mod tests {
"Should apply all changes made"
);
}
- assert_eq!(lsp_request_count.load(Ordering::Relaxed), 13);
- let expected_hints = vec!["13".to_string()];
+ assert_eq!(lsp_request_count.load(Ordering::Relaxed), 12);
+ let expected_hints = vec!["12".to_string()];
assert_eq!(
expected_hints,
cached_hint_labels(editor),
@@ -1641,14 +1633,22 @@ mod tests {
.await;
let project = Project::test(fs, ["/a".as_ref()], cx).await;
project.update(cx, |project, _| project.languages().add(Arc::new(language)));
- let (_, workspace) = cx.add_window(|cx| Workspace::test_new(project, cx));
+ let (_, workspace) = cx.add_window(|cx| Workspace::test_new(project.clone(), cx));
let worktree_id = workspace.update(cx, |workspace, cx| {
workspace.project().read_with(cx, |project, cx| {
project.worktrees(cx).next().unwrap().read(cx).id()
})
});
+ let _buffer = project
+ .update(cx, |project, cx| {
+ project.open_local_buffer("/a/main.rs", cx)
+ })
+ .await
+ .unwrap();
+ cx.foreground().run_until_parked();
cx.foreground().start_waiting();
+ let fake_server = fake_servers.next().await.unwrap();
let editor = workspace
.update(cx, |workspace, cx| {
workspace.open_path((worktree_id, "main.rs"), None, true, cx)
@@ -1657,7 +1657,6 @@ mod tests {
.unwrap()
.downcast::<Editor>()
.unwrap();
- let fake_server = fake_servers.next().await.unwrap();
let lsp_request_ranges = Arc::new(Mutex::new(Vec::new()));
let lsp_request_count = Arc::new(AtomicU32::new(0));
let closure_lsp_request_ranges = Arc::clone(&lsp_request_ranges);
@@ -1689,7 +1688,6 @@ mod tests {
})
.next()
.await;
- cx.foreground().finish_waiting();
cx.foreground().run_until_parked();
editor.update(cx, |editor, cx| {
@@ -1947,7 +1945,6 @@ mod tests {
.next()
.await;
- cx.foreground().finish_waiting();
cx.foreground().run_until_parked();
editor.update(cx, |editor, cx| {
@@ -2135,13 +2132,22 @@ unedited (2nd) buffer should have the same hint");
let project = Project::test(fs, ["/a".as_ref()], cx).await;
project.update(cx, |project, _| project.languages().add(Arc::new(language)));
- let (_, workspace) = cx.add_window(|cx| Workspace::test_new(project, cx));
+ let (_, workspace) = cx.add_window(|cx| Workspace::test_new(project.clone(), cx));
let worktree_id = workspace.update(cx, |workspace, cx| {
workspace.project().read_with(cx, |project, cx| {
project.worktrees(cx).next().unwrap().read(cx).id()
})
});
+ let _buffer = project
+ .update(cx, |project, cx| {
+ project.open_local_buffer("/a/main.rs", cx)
+ })
+ .await
+ .unwrap();
+ cx.foreground().run_until_parked();
+ cx.foreground().start_waiting();
+ let fake_server = fake_servers.next().await.unwrap();
let editor = workspace
.update(cx, |workspace, cx| {
workspace.open_path((worktree_id, "main.rs"), None, true, cx)
@@ -2151,8 +2157,6 @@ unedited (2nd) buffer should have the same hint");
.downcast::<Editor>()
.unwrap();
- let fake_server = fake_servers.next().await.unwrap();
-
("/a/main.rs", editor, fake_server)
}
@@ -2173,12 +2177,12 @@ unedited (2nd) buffer should have the same hint");
}
fn visible_hint_labels(editor: &Editor, cx: &ViewContext<'_, '_, Editor>) -> Vec<String> {
- let mut zz = editor
+ let mut hints = editor
.visible_inlay_hints(cx)
.into_iter()
.map(|hint| hint.text.to_string())
.collect::<Vec<_>>();
- zz.sort();
- zz
+ hints.sort();
+ hints
}
}
diff --git a/crates/editor/src/multi_buffer.rs b/crates/editor/src/multi_buffer.rs
index c5070363eb7..31af03f768e 100644
--- a/crates/editor/src/multi_buffer.rs
+++ b/crates/editor/src/multi_buffer.rs
@@ -2631,7 +2631,7 @@ impl MultiBufferSnapshot {
};
}
}
- panic!("excerpt not found")
+ panic!("excerpt not found");
}
pub fn can_resolve(&self, anchor: &Anchor) -> bool {
diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs
index 0896932e7b3..5bb3751043a 100644
--- a/crates/project/src/project.rs
+++ b/crates/project/src/project.rs
@@ -2827,23 +2827,23 @@ impl Project {
})
.detach();
- language_server
- .on_request::<lsp::request::InlayHintRefreshRequest, _, _>({
- move |(), mut cx| async move {
- let this = this
- .upgrade(&cx)
- .ok_or_else(|| anyhow!("project dropped"))?;
- this.update(&mut cx, |project, cx| {
- cx.emit(Event::RefreshInlays);
- project.remote_id().map(|project_id| {
- project.client.send(proto::RefreshInlayHints { project_id })
- })
+ language_server
+ .on_request::<lsp::request::InlayHintRefreshRequest, _, _>({
+ move |(), mut cx| async move {
+ let this = this
+ .upgrade(&cx)
+ .ok_or_else(|| anyhow!("project dropped"))?;
+ this.update(&mut cx, |project, cx| {
+ cx.emit(Event::RefreshInlays);
+ project.remote_id().map(|project_id| {
+ project.client.send(proto::RefreshInlayHints { project_id })
})
- .transpose()?;
- Ok(())
- }
- })
- .detach();
+ })
+ .transpose()?;
+ Ok(())
+ }
+ })
+ .detach();
let disk_based_diagnostics_progress_token =
adapter.disk_based_diagnostics_progress_token.clone();
diff --git a/crates/rpc/proto/zed.proto b/crates/rpc/proto/zed.proto
index 0950098738f..a0b98372b10 100644
--- a/crates/rpc/proto/zed.proto
+++ b/crates/rpc/proto/zed.proto
@@ -137,9 +137,9 @@ message Envelope {
UpdateWorktreeSettings update_worktree_settings = 113;
- InlayHints inlay_hints = 114;
- InlayHintsResponse inlay_hints_response = 115;
- RefreshInlayHints refresh_inlay_hints = 116;
+ InlayHints inlay_hints = 116;
+ InlayHintsResponse inlay_hints_response = 117;
+ RefreshInlayHints refresh_inlay_hints = 118;
}
}
diff --git a/styles/src/theme/syntax.ts b/styles/src/theme/syntax.ts
index bfd3bd01382..c0d68e418e4 100644
--- a/styles/src/theme/syntax.ts
+++ b/styles/src/theme/syntax.ts
@@ -198,7 +198,6 @@ function build_default_syntax(color_scheme: ColorScheme): Syntax {
hint: {
color: color.hint,
weight: font_weights.bold,
- // italic: true,
},
emphasis: {
color: color.emphasis,