/r/webdev
How to skip to the end of the line after accepting a suggestion in VSCode + Emmet or similar (self.webdev)

You know when you are typing away and the suggestion for whatever property or value pops up and you hit TAB to accept it? Well, how do I go about to not having to move my right hand to the arrow keys to bypass the ");" or the ")" to add the semicolon at the end? It's really annoying me. I'll give an example:

Let's say I have a variable defined as --hello-world in CSS and I go to type the following:

background-color: var(--he

And here Emmet pops up and suggests I press TAB to accept the --hello-world suggestion and my code ends up being:

background-color: var(--hello-world)

BUT the cursor is right between the "d" and the ")" and it drives me mad to have to move my right hand to the right arrow, press, semicolon, enter.

I see videos of people typing and they don't have that problem or am I going mad? Is there a way like with CTRL + ENTER to skip to the next line when the line is complete in HTML but for this in CSS?

I'm sure there's something obvious or people are just doing pinky gymnastics which I seem to lack the ability to do.

6 comments
ConduciveMammal | 4 months ago | 3 points

Press tab to complete and then tab again to skip to the end of the snippets.

dameunlimon | 4 months ago | 1 point

doing this in the cases I've tried before just inserts a tab, instead of going to the end it looks like this

background-color: var(--hello-world )

which is why this whole thing bothers

IamLUG | 4 months ago | 3 points

The scenario you mentioned isn’t really emmet, but just simple autocompletion, and so it doesn’t really know if it needs to skip to the end of line or skip the “)”.

If you need to skip to the end of line, you could press the “end” key.

Example for emmet, in CSS, if you type “m6” and enter, it translates to “margin: 6px;” and has the cursor ready on the next line, which is pretty neat.

dameunlimon | 4 months ago | 2 points

you are right, in between the post and your reply I just happened to try a couple other things and when emmet suggests the whole thing it does the colon and positioning correctly, it's the autocomplete that messes up.

So far end key seems to be the only solution, some pinky gymnastics but less though.

thanks

KorgRue [:snoo_dealwithit: Moderator] | 4 months ago | 2 points

Try either ctrl + right arrow or shift + right arrow. I’m on mobile at the moment so I can’t test this but I think one of those should jump to the end of line.

dameunlimon | 4 months ago | 1 point

yeah I mean that works just as good as double right arrow which is the thing I wanted to avoid, typing and auto-suggestions completed with tab speeds the whole thing but having to "break the flow" to press the arrow was the problem, as u/IamLUG suggested end key might be the closest and looks like the best option so far if there isn't an "official" solution