VSCodeVim / VSCodeVim/Vim

When within a comment block, with formatOnType enabled, new line with `o` has different behavior than with Enter key

Open
#7,707 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

When typing inside a multi-line comment, like for instance C#, where each comment line starts with "//" or "///", inserting a new line by pressing the "Enter" key will, if you have "formatOnType" enabled, create a new line with the "//" characters already inserted. But if you create a new line by pressing "o" you just get a new blank line.

To Reproduce
Steps to reproduce the behavior:

  1. Create a C# file
  2. Have "editor.formatOnType" set to "true".
  3. Create a new comment block on top of a function or class by typing "///" and then "enter".
  4. Inside the comment block, create a new line by pressing o in normal mode.
  5. You get a new blank line, with no "//" on the start of the line.

Expected behavior
I would expect that, like when creating a new line by pressing the Enter key, the new line would be created with the comments' "//" already inserted.

Screenshots
Initially:
Screen Shot 2022-05-17 at 09 22 06

When pressing enter in insert mode:
Screen Shot 2022-05-17 at 09 22 24

When pressing o in normal mode:
Screen Shot 2022-05-17 at 09 22 32

Environment (please complete the following information):

  • Extension (VsCodeVim) version: v1.22.2
  • VSCode version: 1.67.1
  • OS: MacOS 12.3.1

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

No source file or test is named. Reproduce the C# multiline-comment case in VSCodeVim with editor.formatOnType enabled, comparing Enter in insert mode with o in normal mode. Done means opening a new line with o preserves the comment prefix consistently with Enter.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.