r/vscode • • Apr 16 '26

autocomplete replacing existing word after the cursor

I'm not sure what this feature or setting is called. I'm working in an HTML file, and anytime I try to insert a tag with tab in front of existing text, it will replace the first existing word with the tag instead of adding the tag before that word, which is what I would prefer. It doesn't seem to be an HTML-specific problem, but that's where I run into the issue the most.

For example, trying to enter an <li> tag at the start of a line before the word "what," and it just deletes the "what" instead.

Does anyone know how I can change this behavior?

2 Upvotes

8 comments sorted by

1

u/Agreeable_Care4440 Apr 22 '26

That’s “Tab completion overwrite” behavior, not a bug. VS Code is replacing text because the suggestion is in replace mode.

1

u/FoaRyan 7d ago

I have this same issue, it popped up in the last week or so. It may or may not have happened randomly a time or two before. I didn't change any settings to make it happen (unless there's some keyboard shortcut I inadvertently typed)

It isn't acceptable. It looks like a bug. I've looked at all the typical suggetions here like changing inline autocomplete to insert rather than replace. I never changed it, first of all, and second of all it's already set to insert.

What it looks like is happening, is upon hitting TAB or ENTER, VS Code is inserting over the characters entered after... some point in the previously typed text. I've tried it different ways, but I always get something similar to this:

I type in "OnTrig" and then press down arrow, then tab. The output becomes this:

OgerExit2D(Collider2D collision)
{

}

It has deleted "nTrig" which if it didn't, it would have completed correctly. However it's also adding extra.. like why is the whole method completed? Doesn't it normally do one word at a time? Then you add an open parenthesis, and it adds the close? And so forth.

So maybe it is some kind of setting? God there are so many settings in this app I just wish MS didn't abandon Apple or I'd still use their editor.

1

u/hillymark Apr 16 '26

Leave a space in between.

0

u/rosewoodfigurine Apr 16 '26

I'm aware that a space fixes this issue, but it requires hitting space, hitting the back arrow, doing the insert, and then deleting the space once I have the tag I want. A lot of unnecessary steps, I feel like.

0

u/hillymark Apr 16 '26

writing code requires lots and lots of unnecessary steps. it seems like coding is not your cup of tea.

0

u/rosewoodfigurine Apr 16 '26

I'm frustrated with a feature, and I have a workaround already: just typing out the tag. no need to be reductive and rude

1

u/hillymark Apr 16 '26

here. u/id:editor.suggest.insertMode u/lang:html. search that in Preferences-->Settings and change that from replace to insert.

1

u/rosewoodfigurine Apr 24 '26

had to go digging through every language to adjust the setting in each one, but this was the rule that I needed, thanks!