Remove dependencies from the Worktree crate and make it more focused (#12747)
The `worktree` crate mainly provides an in-memory model of a directory and its git repositories. But because it was originally extracted from the Project crate, it also contained lingering bits of code that were outside of that area: * it had a little bit of logic related to buffers (though most buffer management lives in `project`) * it had a *little* bit of logic for storing diagnostics (though the vast majority of LSP and diagnostic logic lives in `project`) * it had a little bit of logic for sending RPC message (though the *receiving* logic for those RPC messages lived in `project`) In this PR, I've moved those concerns entirely to the project crate (where they were already dealt with for the most part), so that the worktree crate can be more focused on its main job, and have fewer dependencies. Worktree no longer depends on `client` or `lsp`. It still depends on `language`, but only because of `impl language::File for worktree::File`. Release Notes: - N/A
This commit is contained in:
parent
00dfd217d8
commit
48581167b7
10 changed files with 554 additions and 689 deletions
|
@ -2955,7 +2955,6 @@ async fn test_rescan_and_remote_updates(cx: &mut gpui::TestAppContext) {
|
|||
}));
|
||||
|
||||
let project = Project::test(Arc::new(RealFs::default()), [dir.path()], cx).await;
|
||||
let rpc = project.update(cx, |p, _| p.client.clone());
|
||||
|
||||
let buffer_for_path = |path: &'static str, cx: &mut gpui::TestAppContext| {
|
||||
let buffer = project.update(cx, |p, cx| p.open_local_buffer(dir.path().join(path), cx));
|
||||
|
@ -2987,7 +2986,7 @@ async fn test_rescan_and_remote_updates(cx: &mut gpui::TestAppContext) {
|
|||
|
||||
let updates = Arc::new(Mutex::new(Vec::new()));
|
||||
tree.update(cx, |tree, cx| {
|
||||
let _ = tree.as_local_mut().unwrap().observe_updates(0, cx, {
|
||||
tree.as_local_mut().unwrap().observe_updates(0, cx, {
|
||||
let updates = updates.clone();
|
||||
move |update| {
|
||||
updates.lock().push(update);
|
||||
|
@ -2996,7 +2995,7 @@ async fn test_rescan_and_remote_updates(cx: &mut gpui::TestAppContext) {
|
|||
});
|
||||
});
|
||||
|
||||
let remote = cx.update(|cx| Worktree::remote(1, 1, metadata, rpc.clone(), cx));
|
||||
let remote = cx.update(|cx| Worktree::remote(1, metadata, cx));
|
||||
|
||||
cx.executor().run_until_parked();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue