# Check if virtual environment is in worktree root \(\#37510\) · gitcafe/zed

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

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

Visibility: public

Requested revision: ee912366a39e9451b36fb5f9c8810da57b173af4

Requested commit: ee912366a39e9451b36fb5f9c8810da57b173af4

Commit: ee912366a39e9451b36fb5f9c8810da57b173af4

Tree: d5425ae4ff179ee64cae265f6f5d4bdc13521fcd

Author: George Waters

Committer: GitHub

## Message

```
Check if virtual environment is in worktree root (#37510)

The problem from issue #37509 comes from local virtual environments
created with certain approaches (including the 'simple' way of `python
-m venv`) not having a `.project` file with the path to the project's
root directory. When the toolchains are sorted, a virtual environment in
the project is not treated as being for that project and therefore is
not prioritized.

With this change, if a toolchain does not have a `project` associated
with it, we check to see if it is a virtual environment, and if it is we
use its parent directory as the `project`. This will make it the top
priority (i.e. the default) if there are no other virtual environments
for a project, which is what should be expected.

Closes #37509

Release Notes:

- Improved python toolchain prioritization of local virtual
environments.
```

## Parents

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

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