microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.35k stars 28.91k forks source link

Extra Space Added When Inserting New Line in HTML Document with Ctrl+Enter #227594

Open unicornflax opened 1 month ago

unicornflax commented 1 month ago

Does this issue occur when all extensions are disabled?: Yes

VS Code Version: 1.92.2 OS Version: Windows 11 Pro 10.0.22631, Build 22631

Steps to Reproduce:

  1. Open an HTML document.
  2. Write some text and comment it out.
  3. Press Ctrl+Enter to insert a new line without modifying the current line.

Actual Behavior: The new line is inserted with an extra space (also happens when the line is indented).

Expected Behavior: The new line should be inserted without any extra spaces.

https://github.com/user-attachments/assets/a55f0653-d5fc-492c-b9b8-1383ccd299b8

jcripley1992 commented 2 weeks ago

Think this happens without using just Enter also after a html comment when making a new line

unicornflax commented 1 week ago

https://github.com/user-attachments/assets/cd53c45a-41f9-4768-b2b2-d0e727bf872d

It seems to copy the whitespace prior to the comment text over to the next line. The whitespace only gets carried over when there is text present.