Allow opening non-extant files (#9256)
Fixes #7400 Release Notes: - Improved the `zed` command to not create files until you save them in the editor ([#7400](https://github.com/zed-industries/zed/issues/7400)).
This commit is contained in:
parent
e792c1a5c5
commit
646f69583a
11 changed files with 242 additions and 152 deletions
|
@ -173,13 +173,16 @@ impl WorktreeState {
|
|||
let Some(entry) = worktree.entry_for_id(*entry_id) else {
|
||||
continue;
|
||||
};
|
||||
let Some(mtime) = entry.mtime else {
|
||||
continue;
|
||||
};
|
||||
if entry.is_ignored || entry.is_symlink || entry.is_external || entry.is_dir() {
|
||||
continue;
|
||||
}
|
||||
changed_paths.insert(
|
||||
path.clone(),
|
||||
ChangedPathInfo {
|
||||
mtime: entry.mtime,
|
||||
mtime,
|
||||
is_deleted: *change == PathChange::Removed,
|
||||
},
|
||||
);
|
||||
|
@ -594,18 +597,18 @@ impl SemanticIndex {
|
|||
{
|
||||
continue;
|
||||
}
|
||||
let Some(new_mtime) = file.mtime else {
|
||||
continue;
|
||||
};
|
||||
|
||||
let stored_mtime = file_mtimes.remove(&file.path.to_path_buf());
|
||||
let already_stored = stored_mtime
|
||||
.map_or(false, |existing_mtime| {
|
||||
existing_mtime == file.mtime
|
||||
});
|
||||
let already_stored = stored_mtime == Some(new_mtime);
|
||||
|
||||
if !already_stored {
|
||||
changed_paths.insert(
|
||||
file.path.clone(),
|
||||
ChangedPathInfo {
|
||||
mtime: file.mtime,
|
||||
mtime: new_mtime,
|
||||
is_deleted: false,
|
||||
},
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue