# Fix task modal fallback when LSP tasks are empty \(\#58090\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 7f4a99aa95dd3328e227dc25c6b747d63b3adb9f

Requested commit: 7f4a99aa95dd3328e227dc25c6b747d63b3adb9f

Commit: 7f4a99aa95dd3328e227dc25c6b747d63b3adb9f

Tree: 23f39fef923520299ce1cbd526680f29d7f873d9

Author: Anthony Eid

Committer: GitHub

## Message

````
Fix task modal fallback when LSP tasks are empty (#58090)

References
[FR-28](https://linear.app/zed-industries/issue/FR-28/task-modal-does-not-show-runnable-rust-test).

The bug this PR aims to fix is

> I can click the play button beside a rust test function, but it does
not show up in the task modal.

I wasn't able to reproduce it, but I suspect this was caused by the task
system preferring LSP code actions by default. It checked that an LSP
was queried for a task instead of checking if the queried LSP actually
returned any tasks. So the fix was just adding the below if statement as
a check.

```rust
if !new_lsp_tasks.is_empty() {
    lsp_tasks
        .entry(source_kind)
        .or_insert_with(Vec::new)
        .append(&mut new_lsp_tasks);
}
```

I also added a regression test for this

Self-Review Checklist:

- [x] I have reviewed my own diff for quality, security, and reliability
- [x] Unsafe blocks (if any) have justifying comments
- [x] The content is consistent with the UI/UX checklist
- [x] Tests cover the new/changed behavior
- [x] Performance impact has been considered and is acceptable


Release Notes:

- Fixed task modal failing to show language tasks in some cases
````

## Parents

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

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