13

I'm using VS Code on Mac. I frequently use integrated terminal in VS Code for performing command line operations relevant to my workspace/project [instead of using Terminal or iTerm].

I am able to use autocomplete for basic shell commands via Integrated terminal in VS Code. For example doing cd followed by a Tab automatically suggests possible directory options for me [just like Terminal or iTerm would].

However, this automatic suggestion doesn't work for git commands. For example, doing git br followed by a Tab should complete to git branch but that's not working.

I looked at User Settings in VS Code [by invoking Cmd + Shift + P -> User Settings -> User -> Extensions -> Git I verified my default terminal for Mac is "Terminal". But however, it's not picking Git commands for autocomplete.

What's missing?

Related issue: https://github.com/Microsoft/vscode/issues/17748

Chaitanya Bapat
  • 2,345
  • 3
  • 27
  • 50
  • 1
    For Bash, see https://stackoverflow.com/questions/12399002/how-to-configure-git-bash-command-line-completion – phil294 Jul 13 '21 at 00:40

3 Answers3

1

If you're using zsh shell, there is a good and quick solution for it right in this discussion. Git tab completion not working in zsh on mac

Then in VSCode, choose zsh as your default terminal.

Manu
  • 83
  • 10
0

I had same issues with VSCode and Windows 10. The default terminal was set to Powershell. After i installed poshgit https://github.com/dahlbyk/posh-git autocompletion works fine.

0

If you're using zsh, you can configure vscode terminal by default with zsh terminal. Go to preferences -> Settings and click on the top right icon to open the json view. Then add the following settings

"terminal.integrated.shell.osx": "/bin/zsh"

This assumes you already have git autocomplete in your zsh terminal but not within vscode. If you don't have git autocomplete in your terminal, I'd suggest using Oh my zsh which already has nice plugins for git and more.

Peter T.
  • 7,940
  • 3
  • 33
  • 30