DEV Community

Anton
Anton

Posted on

1 2

VScode completes things I don't want it to complete.

This upon hitting the enter key >

VScode completes the syntax

turns into this >

VScode completed the syntax

It should actually start a new line with indentation instead.


Let In expression in VScode

When I hit enter it becomes this >

weird VScode behavior

Again it should start a new line with indentation.


How do I make VScode not make a new line?

From this >

The red line indicates where the cursor is.

Into this >

The green line indicates where I want the cursor to be so I can type code like this >


The solution to the enter problem:

The solution to the enter problem with VScode

Go to the setting. Type "enter" in the search and turn off "Accept Suggestion On Enter".

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

Top comments (6)

Collapse
 
foresthoffman profile image
Forest Hoffman • Edited

That is an interesting problem. Because of the general scope of the problem, I don't know how helpful it would be, but with snippets, you can control where the cursor lands.

code.visualstudio.com/docs/editor/...

EDIT: I use snippets to avoid VSCode's auto-completion suggestions when writing Jest tests in TypeScript.

Collapse
 
antonrich profile image
Anton

I looked into snippets they explain how to work with prefixes at the end they have something about keybinding. But I need somehow to explain vscode that when I hit enter key inside curly braces open them in a certain way. It's a hard.

As I understand putting the cursor in a certain place is an easy part.

Collapse
 
mattnmoore profile image
Matt Moore

I've been having this issue too and haven't gotten around to solving it so I'll be following this thread closely. For now I just use shift+enter instead which is honestly pretty annoying.

Collapse
 
antonrich profile image
Anton

I have made an update, because I found the solution. I have a question though: When I made an update did you receive a notification?

Collapse
 
mattnmoore profile image
Matt Moore

Nope! I only got notified from this reply.

Collapse
 
antonrich profile image
Anton

I do the same thing with shift+enter.

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay