# Fix code action selection bug while using vim visual mode \(\#27817\) · gitcafe/zed

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

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

Visibility: public

Requested revision: dad33f7cc2f51d8c7f53fd12ef2a496cfd837ee2

Requested commit: dad33f7cc2f51d8c7f53fd12ef2a496cfd837ee2

Commit: dad33f7cc2f51d8c7f53fd12ef2a496cfd837ee2

Tree: 091b7e8d724e95c720972ceeed78852a257ce8fe

Author: Austin Merrick

Committer: GitHub

## Message

```
Fix code action selection bug while using vim visual mode (#27817)

## Problem

Code actions do not handle vim line mode correctly. See this video where
`Extract to function` doesn't extract both selected lines:


https://github.com/user-attachments/assets/8fa0fb28-0403-44f6-9e55-a59b6713dffd

## Solution

Use `selections.newest_adjusted` instead of `selections.newest_anchor`
so code actions consider the full selection.

Correct behavior:


https://github.com/user-attachments/assets/174d5a34-3873-4d20-b67d-103edec4cdbe

---

Release Notes:

- vim: Fixed code actions in visual line mode
```

## Parents

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

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