Text cursor is moved to the start of the line after the indentation is done by another extension
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
Describe the bug
The other extension is Calva.
On Vim v1.21.5, whatever cursor position Calva set upon hitting Enter was preserved.
On Vim v1.21.6, the cursor is always moved to the start of the line.
To Reproduce
Steps to reproduce the behavior:
- Install Calva and Vim
- Open an empty directory in VSCode
- Create a new file there and type in
(ns a.b) - Put the text cursor on
), enter the Insert mode (the cursor should be before the)) - Hit Enter
Expected behavior
It should end up looking like this, with | representing the cursor position:
(ns a.b
|)
But instead it looks like this:
(ns a.b
| )
Screenshots

Environment (please complete the following information):
- Extension (VsCodeVim) version: v1.21.6
- VSCode version: 1.59.0
- OS: Ubuntu 20.04
Additional context
Perhaps it is related to how Calva does that indentation. Relevant lines in its code:
- https://github.com/BetterThanTomorrow/calva/blob/01b50b95214bd55809285a1fe9e099db8b9ac944/src/calva-fmt/src/extension.ts#L12
- https://github.com/BetterThanTomorrow/calva/blob/01b50b95214bd55809285a1fe9e099db8b9ac944/src/calva-fmt/src/format.ts#L82
If you know of a better way to indent the code and put the text cursor at the right position when editing Clojure files, regardless of any other extensions and VSCode settings, please do tell.
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
Reproduce the issue with Calva and VSCodeVim v1.21.6 using the listed steps, then inspect the interaction with Calva's src/calva-fmt/src/extension.ts and src/calva-fmt/src/format.ts references. Compare the cursor behavior with v1.21.5 and verify that pressing Enter preserves Calva's indentation and leaves the cursor before the closing parenthesis.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100