# workspace: Do not reuse window for sub directory \(only for root directory and sub files\) \(\#24560\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/5dc3c237eb59f6134420d909039da804fad3f78e)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 5dc3c237eb59f6134420d909039da804fad3f78e

Requested commit: 5dc3c237eb59f6134420d909039da804fad3f78e

Commit: 5dc3c237eb59f6134420d909039da804fad3f78e

Tree: e4da1296bfea8758b7bd93aa0d8acf28b86a494e

Author: smit

Committer: GitHub

## Message

```
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.
```

## Parents

- [c771ca49e1cead870ef651016006c1d966a6db7d](https://git.cafe/gitcafe/zed/commit/c771ca49e1cead870ef651016006c1d966a6db7d?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/5dc3c237eb59f6134420d909039da804fad3f78e?format=markdown)
