skip to Main Content

I generally like having JavaScript autocomplete suggestions in VS Code, but it drives me nuts that it automatically selects the first option when I am writing functions.

For instance, I want to call a function named Setup which IntelliSense may or may not yet know about. So I type in Setup and autocomplete suggests SecurityPolicyViolationEvent. When I type ( it automatically takes SecurityPolicyViolationEvent and puts it in.

I have to type Setup then press Escape then press ( (opening parenthesis / round brace).

The auto suggestions are at times helpful but I want to choose to select them when I want them, not "by default". How can I set VS Code so that I still get the suggestions but it doesn’t select the first one automatically?

2

Answers


  1. Put the following in your settings.json file:

    "editor.acceptSuggestionOnCommitCharacter": false
    

    The setting’s description:

    Controls whether suggestions should be accepted on commit characters. For example, in JavaScript, the semi-colon (;) can be a commit character that accepts a suggestion and types that character.

    Login or Signup to reply.
  2. Have a look at this setting:

    Editor > Suggest: Selection Mode  
    
      // Controls whether a suggestion is selected when the widget shows.
      //  - always: Always select a suggestion when automatically triggering IntelliSense.
      //  - never: Never select a suggestion when automatically triggering IntelliSense.
      //  - whenTriggerCharacter: Select a suggestion only when triggering IntelliSense from a trigger character.
      //  - whenQuickSuggestion: Select a suggestion only when triggering IntelliSense as you type.
    
      "editor.suggest.selectionMode": "always",  // the default
    

    Setting it to never for example will not select anything in the suggestion box. Ctrl+Space would then select the top entry.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search