workspace: Do not reuse window for sub directory (only for root directory and sub files) (#24560)
Closes #10232 Context: We have three ways to open files or dirs in Zed: `zed`, `zed --new`, and `zed --add`. `--new` forces the project to open in a new window, while `--add` forces it to open in an existing window (even if the dir isn’t a subdir of an existing project or the file isn’t part of it). Using just `zed` tries to open it in an existing window based on similar logic of `--add`, but if no related project is found the dir, opens in a new window. Problem: Right now, subdirs that are part of an existing project open in the existing window when using `zed`. By default, subdirs should open in a new window instead. If someone wants to open it in the existing window, they can explicitly use `--add`. After this PR, only root dir and files will focus on existing window, when `zed ` is used. Fix: For the `zed` case, we’ve filtered out subdirs in the logic that assigns them to an existing window. Release Notes: - Fixed an issue where subdirectories of an already opened project, when opened via the terminal, would open in the existing project instead of a new window.
This commit is contained in:
parent
c771ca49e1
commit
5dc3c237eb
3 changed files with 77 additions and 58 deletions
|
@ -1335,11 +1335,6 @@ impl LocalWorktree {
|
|||
&self.fs
|
||||
}
|
||||
|
||||
pub fn contains_abs_path(&self, path: &Path) -> bool {
|
||||
let path = SanitizedPath::from(path);
|
||||
path.starts_with(&self.abs_path)
|
||||
}
|
||||
|
||||
pub fn is_path_private(&self, path: &Path) -> bool {
|
||||
!self.share_private_files && self.settings.is_path_private(path)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue