Behemoth
Behemoth

Reputation: 9310

Why does VSCode not recognize the JavaScript spread operator and autocompletes instead?

I have been struggling with a really annoying behaviour of Visual Studio Code recently.

Whenever I try to use the JavaScript spread syntax VSCode automatically autocompletes the next piece of code (wrongly). Note I am NOT hitting TAB. Here's a demonstration of what I'm talking about:

Annoying autocomplete behaviour demonstration

Is there a way to disable this? This is really driving me mad... I am using Visual Studio Code 1.59.0 (which should be the latest release at the time of authoring this question).

Upvotes: 22

Views: 3552

Answers (6)

Abraham
Abraham

Reputation: 15700

Here is how to fix that

  • Press ctrl+, (control + comma)

  • Type editor.suggest.showWords in the search box

  • Uncheck the Setting, (It says When enabled intellisense shows text-suggestions)


Or to disable it specifically for javascript

Add the line "editor.suggest.showWords": false in settings.json, inside the [javascript] section.

You can open settings.json by pressing F1, and typing settings.json


More information about this issue and the temporary fix can be found here on the github issue on the official vscode repository

Upvotes: 0

Mark
Mark

Reputation: 181248

As I mentioned in my comment elsewhere, the github issue is Typing repeated dots in js expands to first suggestion.

In that issue a couple of temporary fixes are mentioned:

"editor.suggest.showWords": false

or

"editor.acceptSuggestionOnCommitCharacter": false

The .'s are commit characters in javascript and so one of the suggestions will be selected that you do not want.

[You might be able to increase the quick suggestions delay time as a possible fix, but I can't test that since I can't actually repro this bug on my setup.]

[If you still are facing this problem make sure to upgrade to v1.59.1, which included a fix. If that doesn't fix it for you, file an issue.]

Upvotes: 19

Chicago Dad
Chicago Dad

Reputation: 11

This appears to be fixed in the latest commit, which is 1.59.1.

Upvotes: 1

Cody
Cody

Reputation: 21

I made a user snippet to work around the issue for now:

  "Spread": {
    "scope": "javascript,typescript",
    "prefix": "spd",
    "body": ["...$1"],
    "description": "spread rest operator vs code fix"
  }

Basic but does the job. Just create a snippet and drop it in.

Upvotes: 2

Reid187
Reid187

Reputation: 63

It appears to be an issue introduced in the latest update to VSCode.

I have one laptop running the latest version that is exhibiting the issue. And another laptop that was running an older version and did not exhibit the issue. Upon updating the laptop with the older version to the latest it too now has this annoying bug...

EDIT:
As a temporary fix I just reinstalled version 1.58.2 on my laptops which has resolved the issue. https://code.visualstudio.com/updates/v1_58

Upvotes: 3

Thomas topuz
Thomas topuz

Reputation: 1

There could be many causes for this problem, try to: install js extentions If doesn't work try to delete the .vscode folder under your home dir and reinstall vscode, this should solve the problem.

Upvotes: 0

Related Questions