Ben
Ben

Reputation: 636

Stop VSCode triggering suggestion when pressing "enter" key

I am editing JSX code in .js files, and since two days (i don't know why), each time I press ENTER key in VS Code to add a new empty line, then VS Code display this:

This is what VS code do

If I press ENTER again, then VS Code add "//#endregion" in my code.

But the point is, I don't want this, I just want to jump a line, I don't want VS Code to write this for me.

Do you know why VS Code has this behavior now, and how I can avoid VS Code doing this ?

PS: this is my Trigger Suggest config enter image description here

Thank you very much

Upvotes: 11

Views: 6905

Answers (4)

whoami Assassin
whoami Assassin

Reputation: 21

Open settings.json file (Ctrl + Shift + P => User Settings json). Then within curly braces {} put this line:

"editor.acceptSuggestionOnEnter": "off",

and then save the file. Now you should be able to go to new line when pressing Enter key.

Upvotes: 1

Amin Vzd
Amin Vzd

Reputation: 1

I recommend to put the suggestions in user/text editor/suggestions/Editor: Accept Suggestion On Enter => smart. This way you can have both suggestions and jumping to new lines by pressing enter.

Upvotes: 0

Ben
Ben

Reputation: 636

As Rajesh and Malte said, go in Key Binding preferences (Preferences > Keyboard Shortcuts) and remove the key binding on "ENTER" key related to "suggestWidgetVisible" solved the problem.

But you actually have to restart VS Code to make this changes being took in account.

You can also go here if you want to keep suggestion but if you don't want them to apply on pressing "ENTER": enter image description here

Settings > Text editor > Suggestions > Accept suggestion on Enter > off

Upvotes: 6

rex
rex

Reputation: 359

Go to File > Preferences > Keyboard Shortcuts

In the search bar select the Recording keys option and press Enter.

For all the results, right click and click on Remove Keybinding as shown below.

enter image description here

Upvotes: 2

Related Questions