VSCodeVim / VSCodeVim/Vim

]p and [p don't respect editor.detectIndentation

Open
#8,094 0 comments 0 reactions 0 assignees View on GitHub

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 commands [p and ]p always indent with tabs even if the file uses spaces and editor.detectIndentation is enabled.

To Reproduce
Steps to reproduce the behavior:

  1. Open a files that uses spaces for indentation
  2. Yank a line via yy
  3. Move cursor to a line with indentation
  4. Put the yanked line at same indentation as the current line via ]p or [p

Expected behavior
If editor.detectIndentation is enabled, [p and ]p should always use the same indentation characters as the current file. This matches the behavior of other commands such as o.

Environment (please complete the following information):

Extension version: 1.24.3
VS Code version: Code 1.73.1 (Universal) (6261075646f055b99068d3688932416f2346dd3b, 2022-11-09T02:08:38.961Z)
OS version: Darwin x64 21.6.0
Modes:
Sandboxed: No

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the [p and ]p command handlers and compare their indentation behavior with o when editor.detectIndentation is enabled. Reproduce the reported steps with a spaces-indented file, then verify that [p and ]p preserve the file's indentation characters while placing the yanked line at the current indentation.

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
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.