Tab key not working in Visual Studio Code issue [Solved]

avatar
Borislav Hadzhiev

Last updated: Apr 6, 2024
4 min

banner

# Table of Contents

  1. Tab key not working in Visual Studio Code issue [Solved]
  2. Remove the keyboard shortcut so you don't trigger the command by mistake
  3. Making sure your settings are correct
  4. Enabling the Tab auto-completion settings in VS Code
  5. Enabling Tab auto-completions in your settings.json file

# Tab key not working in Visual Studio Code issue [Solved]

The most common reason for the Tab key not working issue in VS Code is when you accidentally enable the Tab Moves Focus command.

The command can be toggled with the following keyboard shortcut:

  • on Windows and Linux: press Ctrl + M.
  • on macOS: press Cmd + Shift + M.

If the Tab Moves Focus command is active, pressing the tab key moves the focus in your editor instead of inserting a Tab character.

If the command is active, a Tab Moves Focus label is displayed at the bottom of the editor, in the Status Bar.

tab moves focus command

Make sure the label is not displayed, for you to be able to use the Tab key as intended.

You can also trigger the command via the Command Palette:

  1. Press:
  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.
Note: you can also press F1 to open the Command Palette.
  1. Type tab focus and select Toggle Tab Key Moves Focus.

toggle tab key moves focus

Make sure the label is not displayed, for you to be able to use the Tab key as intended.

Another way to disable the command is to click on the Tab Moves Focus label in your Status Bar.

disable tab key moves focus mode

# Remove the keyboard shortcut so you don't trigger the command by mistake

Another thing that you can do is remove the keyboard shortcut, so you don't trigger the Tab Moves Focus command by mistake.

  1. Press:
  • Ctrl + Shift + P on Windows and Linux.
  • Command + Shift + P on macOS.
Note: you can also press F1 to open the Command Palette.
  1. Type Keyboard Shortcuts and select Preferences: Open Keyboard Shortcuts.

preferences open keyboard shortcuts

  1. Search for Toggle Tab Focus and right-click on the Toggle Tab Key Moves Focus option.

remove tab key moves focus keybinding

  1. Click on Remove Keybinding to remove the keyboard shortcut.

# Making sure your settings are correct

Another thing you need to check is that your settings are correct.

  1. Press Ctrl + Shift + P (or Command + Shift + P on macOS).
Note: you can also press F1 to open the Command Palette.
  1. Type user settings and select Preferences: Open User Settings.

open user settings

You can also open the settings screen by pressing Ctrl + , on Windows and Linux or Cmd + , on macOS.

  1. Type tab focus and make sure the following two checkboxes are unchecked:
  • Editor: Tab Focus Mode
  • Terminal Integrated: Tab Focus Mode

make sure your settings are correct

# Enabling the Tab auto-completion setting in VS Code

If you are trying to enable tab auto-completions in VS Code, you have to enable the setting.

  1. Press Ctrl + Shift + P (or Command + Shift + P on macOS).
Note: you can also press F1 to open the Command Palette.
  1. Type user settings and select Preferences: Open User Settings.

open user settings

You can also open the settings screen by pressing Ctrl + , on Windows and Linux or Cmd + , on macOS.

  1. Type tab completion.

enable tab auto completions

  1. Make sure the Editor: Tab Completion setting is set to on.
  2. Make sure the Emmet: Trigger Expansion on Tab checkbox is checked.

The Editor: Tab Completion setting has 3 possible values:

  • on - Tab complete inserts the best matching suggestion when pressing Tab.
  • off - Tab completions are disabled.
  • onlySnippets - Tab complete snippets when their prefix matches.

When the Emmet: Trigger Expansion On Tab setting is enabled, Emmet abbreviations are expanded when pressing Tab.

# Enabling Tab auto-completions in your settings.json file

You can also enable tab auto-completions directly in your settings.json file.

  1. Press Ctrl + Shift + P (or Command + Shift + P on macOS).
Note: you can also press F1 to open the Command Palette.
  1. Type user settings json.

  2. Click on Preferences: Open User Settings (JSON)

preferences open user settings

  1. Paste the following 2 lines into your settings.json file
settings.json
"editor.tabCompletion": "on", "emmet.triggerExpansionOnTab": true,

Make sure to remove the trailing comma if the property comes last.

enable tab auto completions in settings json

# Restart VS Code

If the issue is not resolved, try to restart VS Code.

Press F1, type Reload Window and select Developer: Reload Window.

Or simply close VS Code completely and reopen it.

# Additional Resources

You can learn more about the related topics by checking out the following tutorials:

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.