4

The problem is after I've installed the Angular extension in Visual Studio Code, I constantly get across all files (.ts, .html, and .css) auto new-line after typing single letters or multiple lines of code. It's frustrating. I disabled prettier, word-wrap, and intellisense, but the problem still remains.

Is there a way I can disable it?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
ahsibob
  • 41
  • 1
  • 1
  • 2
  • Can you give an example of what you type and when/where it adds the newline? – T.J. Crowder Jan 17 '21 at 09:10
  • is the typed line is the last line in VS code? – Onkar Jan 17 '21 at 09:13
  • 1
    I type 'e' it goes new line...i type 'export' it goes new line...it's doing it in every file type. 'Insert New Line At the End Of File' is disabled – ahsibob Jan 17 '21 at 10:25
  • Possible duplicate: *[Visual Studio Code — Insert New Line at the End of Files](https://stackoverflow.com/questions/44704968/visual-studio-code-insert-new-line-at-the-end-of-files)* – Peter Mortensen May 11 '22 at 00:06

3 Answers3

7

I had the same problem.

After going through my extensions, I noticed that the "EditorConfig for VS Code" extension I installed was inserting auto new-line after typing single or multiple lines of code.

If the problem is still not solved, try disabling some extensions and see if that works.

Jasperan
  • 2,154
  • 1
  • 16
  • 40
Akki
  • 71
  • 2
  • 5
  • 2
    Making insert_final_newline = false in .editorconfig file should fix the behavior of automatic inserting of new line after typing single or multiple lines of code. – 9paradox Jun 05 '22 at 15:01
3

I had a similar issue and the solution provided by 9paradox solved my problem.

When I was saving my code (Python, JSON, JS, etc...) I got always a new line inserted at the end of the file.

Solution: if, e.g. on Mac, you are editing any file in your project, then go to the root directory of your project, let's say /Users/<username>/git/<project> then search for .editorconfig in that folder, then open that file with any text editor like vi or TextEdit and make insert_final_newline = false. VS Code takes over the settings changes immediately. No restart needed.

Tony
  • 7,767
  • 2
  • 22
  • 51
  • You are awesome man. Thanks a trillion. After lots of failed tries I got this awesome solution. – Mahbub May 23 '23 at 17:00
-6

Just disable the auto save option in VSC.

  • *How* is that achieved? Please respond by [editing (changing) your answer](https://stackoverflow.com/posts/68210989/edit), not here in comments (***without*** "Edit:", "Update:", or similar - the answer should appear as if it was written today). – Peter Mortensen May 11 '22 at 00:08
  • what if you *need* the auto save option?.. – idkwhatsgoingon Aug 15 '22 at 10:57