Rename 'project_core' crate to 'worktree', make it just about worktrees (#9189)

This is just a refactor. I noticed that we now have a `project_core`
crate, which mainly contains the `Worktree` type and its private
helpers, plus the project's settings.

In this PR, I've renamed that crate to `worktree` and did some minor
simplification to its module structure. I also extracted a new
`WorktreeSettings` settings type from the `ProjectSettings`, so that the
worktree settings could live in the worktree crate. This way, the crate
is now exclusively about worktree logic.

Release Notes:

- N/A
This commit is contained in:
Max Brunsfeld 2024-03-11 11:35:27 -07:00 committed by GitHub
parent 2b67bb27cf
commit dfcc143ead
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 215 additions and 190 deletions

View file

@ -2,6 +2,7 @@ pub mod debounced_delay;
pub mod lsp_command;
pub mod lsp_ext_command;
mod prettier_support;
pub mod project_settings;
pub mod search;
mod task_inventory;
pub mod terminals;
@ -56,9 +57,9 @@ use node_runtime::NodeRuntime;
use parking_lot::{Mutex, RwLock};
use postage::watch;
use prettier_support::{DefaultPrettier, PrettierInstance};
use project_core::project_settings::{LspSettings, ProjectSettings};
pub use project_core::{DiagnosticSummary, ProjectEntryId};
use project_settings::{LspSettings, ProjectSettings};
use rand::prelude::*;
use worktree::LocalSnapshot;
use rpc::{ErrorCode, ErrorExt as _};
use search::SearchQuery;
@ -96,16 +97,20 @@ use util::{
paths::{LOCAL_SETTINGS_RELATIVE_PATH, LOCAL_TASKS_RELATIVE_PATH},
post_inc, ResultExt, TryFutureExt as _,
};
use worktree::{Snapshot, Traversal};
pub use fs::*;
pub use language::Location;
#[cfg(any(test, feature = "test-support"))]
pub use prettier::FORMAT_SUFFIX as TEST_PRETTIER_FORMAT_SUFFIX;
pub use project_core::project_settings;
pub use project_core::worktree::{self, *};
#[cfg(feature = "test-support")]
pub use task_inventory::test_inventory::*;
pub use task_inventory::{Inventory, TaskSourceKind};
pub use worktree::{
DiagnosticSummary, Entry, EntryKind, File, LocalWorktree, PathChange, ProjectEntryId,
RepositoryEntry, UpdatedEntriesSet, UpdatedGitRepositoriesSet, Worktree, WorktreeId,
WorktreeSettings, FS_WATCH_LATENCY,
};
const MAX_SERVER_REINSTALL_ATTEMPT_COUNT: u64 = 4;
const SERVER_REINSTALL_DEBOUNCE_TIMEOUT: Duration = Duration::from_secs(1);
@ -492,6 +497,7 @@ impl SearchMatchCandidate {
impl Project {
pub fn init_settings(cx: &mut AppContext) {
WorktreeSettings::register(cx);
ProjectSettings::register(cx);
}