Recently, I updated VS Code to the version 1.93.0-1725459079_amd64 (now 1.93.1-1726079302_amd64, but didn't fix the problem). I think I skipped some versions, but since the update, VS Code automatically inserts an empty line below the line I am coding in after accepting an auto-complete suggestion. The problem does not only occure when pressing enter, but also when pressing tab or when I click on the suggestion. (when coding in JavaScript, so I think the suggestions come from IntelliSense). Here is an demonstration video
I searched the web a bit and tried changing a few settings like setting editor.suggest.insertMode
to "replace", setting editor.acceptSuggestionOnEnter
to false, setting editor.suggestSelection
to first, editor.tabCompletion
to off and setting editor.suggest.snippetsPreventQuickSuggestions
to false. I also started VS Code without extensions using the command code --disable-extensions
, but nothing seems to work. (some of it is advice from AI, so maybe it's not really fitting)
Maybe there is a new setting I don't know of?
I am happy to hear about every answer that could help :)
The newline is part of the snippet. The snippet configuration is
"Log to the console":{"prefix":"log","body":["console.log($1);","$0"],"description":"Log to the console"}
inside
/usr/share/code/resources/app/extensions/javascript/snippets
on Linux. Each element in the body
array is a separate line. $1
is the first tabstop and $0
is the final tabstop. That means, you can't configure this behavior globally in the configuration. You could modify this snippet
"Log to the console":{"prefix":"log","body":["console.log($0);"],"description":"Log to the console"}
or try to overwrite it.
You can easily define your own snippets without any extension. To create or edit your own snippets, select Configure User Snippets under File > Preferences (Code > Preferences or Code > Settings on macOS) , and then select the language (by language identifier) for which the snippets should appear, or the New Global Snippets file option if they should appear for all languages. VS Code manages the creation and refreshing of the underlying snippets file(s) for you.
More details and the syntax can be found at: https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax