zA (toggle fold recursively) does not work
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
Is your feature request related to a problem? Please describe.
In real Vim, zA toggles the fold under the cursor recursively. It closes an open fold (and all its nested folds), or opens a closed fold (and all its nested folds), depending on the current state. In VSCodeVim, za (single-level toggle), zO (recursive open), and zC (recursive close) all work as expected, but zA does nothing at all. It isn't implemented in src/actions/commands/fold.ts.
Describe the solution you'd like
Add a zA action that determines whether the fold under the cursor is currently closed (e.g. by checking whether the line right after the fold header is present in the editor's visibleRanges) and dispatches editor.unfoldRecursively or editor.foldRecursively accordingly, mirroring how zO/zC already dispatch their respective VS Code commands.
Describe alternatives you've considered
Binding zA to a fixed VS Code command (editor.foldRecursively or editor.unfoldRecursively) via vim.normalModeKeyBindingsNonRecursive was considered, but that only ever does one direction, not a real toggle, since VS Code has no built-in "toggle fold recursively" command to bind to directly.
Additional context
I have a small patch ready that implements this using the visibleRanges state-check approach above and will open a PR referencing this issue.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/actions/commands/fold.ts by reading the existing zO, zC, and za actions and checking how visibleRanges is accessed. Implement zA so it chooses recursive fold or unfold based on the fold's current visibility, then verify that it toggles both open and closed folds recursively.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 76/100