Skip to content

Commit

Permalink
feat: added test_explorer.auto_focus config option
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-kulik committed Feb 10, 2024
1 parent d8fd789 commit 856d87d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ return {
test_explorer = {
enabled = true, -- enable Test Explorer
auto_open = true, -- open Test Explorer when tests are started
auto_focus = true, -- focus Test Explorer when opened
open_command = "botright 42vsplit Test Explorer", -- command used to open Test Explorer
open_expanded = true, -- open Test Explorer with expanded classes
success_sign = "", -- passed test icon
Expand Down Expand Up @@ -626,11 +627,6 @@ Coverage Report Keys:
| `enter` or `tab` | Expand or collapse the current node |
| `o` | Open source file |

> [!CAUTION]
> From time to time, the code coverage may fail or some targets may be missing (Xcode's bug). Try running tests again then.
>
> If you run tests, modify file and toggle code coverage AFTER that, the placement of marks will be incorrect (because it doesn't know about changes that you made). However, if you show code coverage and after that you modify the code, marks will be moving while you are editing the file.
</details>

### 📸 Snapshot Tests Preview
Expand Down
1 change: 1 addition & 0 deletions lua/xcodebuild/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ local defaults = {
test_explorer = {
enabled = true, -- enable Test Explorer
auto_open = true, -- open Test Explorer when tests are started
auto_focus = true, -- focus Test Explorer when opened
open_command = "botright 42vsplit Test Explorer", -- command used to open Test Explorer
open_expanded = true, -- open Test Explorer with expanded classes
success_sign = "", -- passed test icon
Expand Down
4 changes: 4 additions & 0 deletions lua/xcodebuild/test_explorer.lua
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,10 @@ function M.show()
M.bufnr = vim.api.nvim_get_current_buf()
setup_buffer()
events.toggled_test_explorer(true, M.bufnr, vim.api.nvim_get_current_win())

if not config.auto_focus then
vim.cmd("wincmd p")
end
end

refresh_explorer()
Expand Down

0 comments on commit 856d87d

Please sign in to comment.