angry kiwi
angry kiwi

Reputation: 11485

vscode how to disable accepting suggestion on pressing tab

When type something, vscode show some suggestions, I press tab. the suggestion will autocomplete what I typing.

Now I want to disable that. I want when I press tab, it will not autocomplete.

I do not want to disable suggestion or autocomplete, I just want to disable the tab thing

This is what I've got in the setting

"editor.acceptSuggestionOnCommitCharacter": false,
"emmet.triggerExpansionOnTab": false,
"editor.tabCompletion": "off",
"editor.suggest.snippetsPreventQuickSuggestions": false

problem remains, the tab thing still working

Upvotes: 7

Views: 9404

Answers (6)

Anudeep Ananth
Anudeep Ananth

Reputation: 1123

What worked for me on a Mac was to change the Keyboard shortcut Command named "Accept Inline Suggestion" from Tab to whatever your desired custom keyboard shortcut.enter image description here

Upvotes: 0

starball
starball

Reputation: 52064

There is the editor.tabCompletion setting, but strangely, VS Code doesn't use it in all the places I'd expect in its default keybindings (you can see for yourself if you search for config.editor.tabCompletion)- namely, it doesn't use it in the when-clause for its default acceptSelectedSuggestion binding.

If you want to disable tab for acceptSelectedSuggestion, you can do that by putting this in your keybindings.json file (run Preferences: Open Keyboard Shortcuts (JSON) in the command palette):

{
    "key": "tab",
    "command": "-acceptSelectedSuggestion",
},

You could also add the when clause to exact match the default keybinding that this unbinds, but that's not necessary, and can be flaky (if the default keybinding's when-clause changes in a new update of VS Code, like it did for one of the other answer posts here).

You may also want the following:

{
    "key": "tab",
    "command": "-insertBestCompletion",
},
{
    "key": "tab",
    "command": "-insertNextSuggestion",
},
{
    "key": "tab",
    "command": "-editor.action.inlineSuggest.commit",
},

Basically, just open keybindings.json and search for ""tab"" and find the command IDs that you're not interested in having bound to tab.

Upvotes: 2

K.R
K.R

Reputation: 51

Open keyboard shortcuts -> search acceptSelectedSuggestion -> right click and remove command that has 'tab' as Key binding.

Upvotes: 5

Mehbub Rashid
Mehbub Rashid

Reputation: 663

The accepted answer used to work for a long time but now it's not working anymore. I had to modify that into the following to make it work:-

{
        "key"    : "tab",
        "command": "-acceptSelectedSuggestion",
        "when"   : "suggestWidgetHasFocusedSuggestion && suggestWidgetVisible && textInputFocus"
}

Upvotes: 1

Essexgit
Essexgit

Reputation: 27

You can press 'right arrow' > which accepts what you have written rather than accepting the suggestion

Upvotes: 0

Mark
Mark

Reputation: 182641

As @HolyBlackCat suggested, disable the command acceptSelectedSuggestion which is triggered with a tab key. You will end up with this in your keybindings.json:

{
    "key": "tab",
    "command": "-acceptSelectedSuggestion",
    "when": "suggestWidgetVisible && textInputFocus"
  },

Upvotes: 11

Related Questions