# When determining Python task context, do not consider worktree-less files as an error \(\#27183\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 5bef32f3ed6bca11e9824cae475a0b35f5c804c1

Requested commit: 5bef32f3ed6bca11e9824cae475a0b35f5c804c1

Commit: 5bef32f3ed6bca11e9824cae475a0b35f5c804c1

Tree: 4bfbc3951db2bb25166d5144180279eca0428922

Author: Kirill Bulatov

Committer: GitHub

## Message

```
When determining Python task context, do not consider worktree-less files as an error (#27183)

Makes Python plugin to output


![image](https://github.com/user-attachments/assets/4960bc48-21b7-4392-82b9-18bfd1dd9cd0)

for standalone Python files now, instead of nothing as now.

Before the change, no task context was created for the standalone file
due to `VariableName::RelativeFile` lookup considered as an error.
Now, Zed continues and constructs whatever possible context instead.

That `pytest` task seems odd, as the logic fixed here needs a relative
path (hence, a worktree) to consider unit tests.
We do not have variables at the moment the associated tasks are queried
for:


https://github.com/zed-industries/zed/blob/14920ab910c6d0208d23ce6b6e2ed644e6f20f2e/crates/languages/src/python.rs#L359-L363


https://github.com/zed-industries/zed/blob/14920ab910c6d0208d23ce6b6e2ed644e6f20f2e/crates/languages/src/python.rs#L417-L446

so we cannot filter this the same way the PR does.
Maybe, we can use a `VariableName::RelativeFile` instead of
`VariableName::File` there?

Release Notes:

- Show tasks from Python plugin for standalone files
```

## Parents

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

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