# project: Don't send context.only for generic code action requests \(\#50979\) · gitcafe/zed

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

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

Visibility: public

Requested revision: 783ec4456dc6aea5780a36c975038505110d1288

Requested commit: 783ec4456dc6aea5780a36c975038505110d1288

Commit: 783ec4456dc6aea5780a36c975038505110d1288

Tree: 0643fe745fa5281fe1a02d2fa66055e803d97cc2

Author: loadingalias

Committer: GitHub

## Message

```
project: Don't send context.only for generic code action requests (#50979)

Closes #48917

## Summary
- Stop sending `context.only` for generic `textDocument/codeAction`
requests.
 - Keep explicit kind filtered requests unchanged.
- Add regression coverage for generic code action requests so actions
like `source.addTest` remain visible.

## Root Cause
`GetCodeActions::to_lsp` populated `context.only` even when the caller
requested all code actions (`kinds == None`). That turned the normal
code actions menu into a filtered request. With `gopls`, this filtered
out `source.addTest`, so `Add test for ...` never appeared.

## Verification
 - `cargo fmt --all -- --check`
 - `./script/clippy -p project`
 - `cargo nextest run -p project --no-fail-fast --no-tests=warn`
- `cargo test -p editor
editor_tests::test_organize_imports_manual_trigger -- --exact`
- `cargo test -p editor
editor_tests::test_context_menus_hide_hover_popover -- --exact`

## Manual Testing
- Repro'd the protocol level behavior against `gopls`: unfiltered
requests return `source.addTest`, filtered requests excluding it do not.
 - Opened `zed_guild/testing_projects/act/pkg/artifactcache/handler.go`
 - Triggered `Show Code Actions` on `StartHandler`
 - Confirmed `Add test for StartHandler` appears


Release Notes:

- Fixed Go `gopls` code actions so `Add test for ...` appears in the
generic code actions menu.

Co-authored-by: Kirill Bulatov <kirill@zed.dev>
```

## Parents

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

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