Dot command doesn't work with tabs/spaces
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.2k
- Forks
- 1.5k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 6
Description
The dot command does not work with tabs and spaces at the beginning of the line.
To Reproduce
In the following piece of code, concentrate in line 4.
1 if(r.measureItem.type == MeasureMgr::eDistance && !p1 && !p2)
2 {
3 Ns::USD::Pencil3D pencil(w, p);
4 X pencil.setColor(const pxr::GfVec3f&); X
5. pencil.setLineWidth(const float&);
6 drawDimensionLine(r.measureResult.pos1, r.measureResult.pos2, false, pencil);
7 }
- Position the cursor at the "X" location (end of line 4)
- Press "I" (insert at the beginning of line) with the aim to properly indent the line
- Insert as many tabs as necessary to properly ident the line with respect to line 3
- Press escape key to finish the insert command
- Press the enter key to go to line 5
- Press the dot command to indent line 5 in the same manner as line 4
Expected behavior
1 if(r.measureItem.type == MeasureMgr::eDistance && !p1 && !p2)
2 {
3 Ns::USD::Pencil3D pencil(w, p);
4 pencil.setColor(const pxr::GfVec3f&);
5 pencil.setLineWidth(const float&);
6 drawDimensionLine(r.measureResult.pos1, r.measureResult.pos2, false, pencil);
7 }
** What we are really getting:
1 if(r.measureItem.type == MeasureMgr::eDistance && !p1 && !p2)
2 {
3 Ns::USD::Pencil3D pencil(w, p);
4 pencil.setColor(const pxr::GfVec3f&);
5 pencil.setLineWidth(const float&);
6 drawDimensionLine(r.measureResult.pos1, r.measureResult.pos2, false, pencil);
7 }
Line 5 doesn't get indented in the same way as vim would do it.
This behavior also happens when the cw (change word) command is used <<<----------
Environment:
Tested on two platforms:
-
Extension (VsCodeVim) version: v1.23.2
-
VSCode version: 1.70.2
-
OS: MacOS Bigsur 11.6.8
-
Extension (VsCodeVim) version: v1.23.2
-
VSCode version: 1.70.1
-
OS: Ubuntu 18.04.5 LTS
Additional context
No additional context, the issue seams consistent in two different platforms and it is a feature that vim supports.
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 by tracing the dot command's handling of leading tabs and spaces, using the provided line-4 reproduction. Compare its behavior with the cw command path and verify that repeating the insert preserves Vim-compatible indentation; the issue is done when both cases match the expected formatting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript, vscode
- Domain
- developer-experience
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100