Skip to content

Commit

Permalink
fix test_restarted_server_reporting_invalid_buffer_version
Browse files Browse the repository at this point in the history
  • Loading branch information
JunkuiZhang committed Jan 19, 2025
1 parent db4bba8 commit 05c610a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions crates/project/src/project_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1550,25 +1550,26 @@ async fn test_restarted_server_reporting_invalid_buffer_version(cx: &mut gpui::T
init_test(cx);

let fs = FakeFs::new(cx.executor());
fs.insert_tree("/dir", json!({ "a.rs": "" })).await;
fs.insert_tree(add_root_for_windows("/dir"), json!({ "a.rs": "" }))
.await;

let project = Project::test(fs, ["/dir".as_ref()], cx).await;
let project = Project::test(fs, [add_root_for_windows("/dir").as_ref()], cx).await;
let language_registry = project.read_with(cx, |project, _| project.languages().clone());

language_registry.add(rust_lang());
let mut fake_servers = language_registry.register_fake_lsp("Rust", FakeLspAdapter::default());

let (buffer, _handle) = project
.update(cx, |project, cx| {
project.open_local_buffer_with_lsp("/dir/a.rs", cx)
project.open_local_buffer_with_lsp(add_root_for_windows("/dir/a.rs"), cx)
})
.await
.unwrap();

// Before restarting the server, report diagnostics with an unknown buffer version.
let fake_server = fake_servers.next().await.unwrap();
fake_server.notify::<lsp::notification::PublishDiagnostics>(&lsp::PublishDiagnosticsParams {
uri: lsp::Url::from_file_path("/dir/a.rs").unwrap(),
uri: lsp::Url::from_file_path(add_root_for_windows("/dir/a.rs")).unwrap(),
version: Some(10000),
diagnostics: Vec::new(),
});
Expand Down

0 comments on commit 05c610a

Please sign in to comment.