Remove worktree-specific methods from language::File trait

Use downcasting instead for accessing worktree-specific state of the Files.

This will allow us to introduce a WorktreeId type and use that everywhere
for identifying worktrees. It also just removes some unnecessary coupling
between the language crate and the worktree.
This commit is contained in:
Max Brunsfeld 2022-01-03 17:57:26 -08:00 committed by Antonio Scandurra
parent 8270e8e758
commit 7f8e76e0f1
3 changed files with 23 additions and 31 deletions

View file

@ -149,10 +149,6 @@ pub enum Event {
}
pub trait File {
fn worktree_id(&self) -> usize;
fn entry_id(&self) -> Option<usize>;
fn mtime(&self) -> SystemTime;
/// Returns the path of this file relative to the worktree's root directory.
@ -185,8 +181,6 @@ pub trait File {
fn buffer_removed(&self, buffer_id: u64, cx: &mut MutableAppContext);
fn boxed_clone(&self) -> Box<dyn File>;
fn as_any(&self) -> &dyn Any;
}