diff --git a/crates/collab/src/tests/integration_tests.rs b/crates/collab/src/tests/integration_tests.rs index 3cf4d9a876094bfd3991e2302d973c57d4944a2e..b20844a065133539ba71ced8a03217b262c4a69b 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::() .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::(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 ffff4ef23144eb28b1c8f4a6c8690884080e26d3..c85bbddd582400fdc9fb9afef7de5a1275eb5dfb 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::() .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::() .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 { - let mut zz = editor + let mut hints = editor .visible_inlay_hints(cx) .into_iter() .map(|hint| hint.text.to_string()) .collect::>(); - zz.sort(); - zz + hints.sort(); + hints } } diff --git a/crates/editor/src/multi_buffer.rs b/crates/editor/src/multi_buffer.rs index c5070363eb7e2c4bc3910b4444c2195a584f8e4d..31af03f768ea549d04a8802623bbc364acd762a4 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 0896932e7b35ec9df75c9fb5170a69ae10251c0a..5bb3751043a61070ee79373681a669803144b70c 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -2827,23 +2827,23 @@ impl Project { }) .detach(); - language_server - .on_request::({ - 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::({ + 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 0950098738f09d08b13ef52efa2e402ed0e32de8..a0b98372b10f05248e1c49fc14844b9de61274f9 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 bfd3bd01382ca6a18700aab28363ae583b0520aa..c0d68e418e459687e1b9a73d5e98c25711625125 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,