How to Fix VSCode Terminal Hanging with Copilot, MCP and Powerlevel10k

Share this:

If you’re using VSCode with Copilot and Powerlevel10k, you might have encountered a frustrating issue where terminal commands just hang indefinitely. The terminal sits there with a spinning wheel, waiting for command output that never seems to arrive. In my case, I was using the runcommand MCP tool when I ran into this exact problem with a simple chmod command getting stuck.

VSCode terminal showing MCP runcommand tool stuck executing chmod command with spinning loader

Here’s how to fix the terminal hanging issue with VSCode, especially if you’re using zsh with Powerlevel10k.

Update: The latest version of powerlevel10k supposedly works well with VSCode @terminal feature now. However, to keep things simple and stable I decided to keep zsh lean and clean within VSCode. To do so, check out the following post to see how to skip loading powerlevel10k in VSCode. [Source]

If you want to keep using powerlevel10k in VSCode

#Update OMZ
omz update

#Update to the latest powerlevel10k
git -C ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k pull
Updating powerlevel10k using git pull

The alternate solution: Keep VSCode terminal simple

The root cause of this issue is related to VSCode’s shell integration feature. Shell integration is how VSCode tracks command execution in the terminal – it knows when commands start, when they finish, and what their output is. This is crucial for AI agents like Github Copilot that need to read terminal output.

The problem? Powerlevel10k and other custom shell configurations can interfere with VSCode’s shell integration, causing it to fail entirely. When this happens, VSCode has to guess when commands are finished by waiting for idle timeouts, which leads to hanging or missed output.

Skip powerlevel10k entirely in VSCode.

I found that this is the most stable way to get the issue fixed. So here’s what we need to do to skip powerlevel10k when zsh loads in VSCode.

  1. Update VSCode to the latest version anyway
  2. Set a simple prompt for VSCode at the very top
  3. Skip P10k instant prompt when in VSCode using the VSCODE_SKIP_P10K flag
  4. Don’t load P10k theme in VSCode
  5. Don’t source .p10k.zsh config when in VSCode
  6. Finally,

Step 1: Update VSCode to the Latest Version

First things first, make sure you’re running the latest version of VSCode. The fixes were released in version 1.102 and later.

Check your current version:

code --version

Update VSCode through the built-in updater: Help β†’ Check for Updates

Enable Shell Integration in VSCode Settings

Open your VSCode settings and ensure shell integration is enabled. You can do this through the GUI or by editing your settings.json file directly.

Via Settings GUI:

  1. Press Cmd + ,
  2. Search for “shell integration”
  3. Make sure “Terminal β€Ί Integrated β€Ί Shell Integration: Enabled” is checked

Via settings.json:

{
    "terminal.integrated.shellIntegration.enabled": true
}

Step 2: Set a simple prompt for VSCode at the very top

Load VSCode’s shell integration script in your .zshrc file.

code ~/.zshrc

Copy and add the following right at the top of the file.

# Skip P10k entirely in VSCode
if [[ "$TERM_PROGRAM" == "vscode" ]]; then
  # Use a simple, clean prompt for VSCode
  PROMPT='%F{cyan}%~%f %F{green}❯%f '
  VSCODE_SKIP_P10K=1
fi

Step 3: Skip P10k instant prompt when in VSCode

Look near the top of the file where instant prompt is enabled. Search for p10k-instant-prompt. Edit and replace the 3 lines with the following. Feel free to simplify the comment too.

# Enable Powerlevel10k instant prompt only if not in VSCode
if [[ -z "$VSCODE_SKIP_P10K" ]] && [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
  source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi

Step 4: Don’t load P10k theme in VSCode

Now, search for the ZSH_THEME="powerlevel10k/powerlevel10k" line. Replace it with the following instead.

# Theme: use Powerlevel10k unless in VSCode
if [[ -z "$VSCODE_SKIP_P10K" ]]; then
  ZSH_THEME="powerlevel10k/powerlevel10k"
else
  ZSH_THEME=""
fi

Step 5: Don’t source .p10k.zsh config when in VSCode

Next, search for the source ~/.p10k.zsh line and replace it with the following instead.

# Only source P10k config if not in VSCode
if [[ -z "$VSCODE_SKIP_P10K" ]]; then
  [[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh
fi

Step 6: Set the VSCode shell integration

Lastly, add the following line to load the shell integration script. This must come after all your other shell configurations.

# VSCode shell integration - ADD THIS AT THE END
[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)"

Step 4: Reload VSCode

After making these changes, reload your VSCode window:

  1. Press Cmd+Shift+P (or Ctrl+Shift+P on Windows/Linux)
  2. Type “Developer: Reload Window”
  3. Press Enter

Alternatively, just restart VSCode entirely.

Verifying the Fix Works

Now let’s make sure everything is working properly.

Check Shell Integration Status

Hover over your terminal tab in VSCode. You should see a tooltip that shows the shell integration status. Look for:

VSCode terminal tab tooltip showing Shell Integration: Rich status
  • Shell Integration: Rich – Perfect! This means everything is working as it should.
  • Shell Integration: Basic – Not ideal, but the July 2025 fix should handle this for Powerlevel10k users.
  • Shell Integration: None – Something’s wrong. Double-check your .zshrc configuration.

Test Copilot integration with the Terminal

Open VSCode Copilot chat and test it with a simple prompt to run echo "test". If shell integration is working, you should see Copilot now able to check the terminal output again.

Wrapping Up

The terminal hanging issue with VSCode, MCP, and powerlevel10k is frustrating, but thankfully both VSCode and powerlevel10k has addressed it. However, this episode has also taught me to keep things as simple as possible when it comes to critical workflows. As such, I’ve kept zsh clean and simple within VSCode. There’s no need for me to see the info I’ve configured for regular terminal use. VSCode itself already provides me those context when I need it.

Once you’ve done this, your terminal commands should execute smoothly without any hanging, and AI tools will be able to read the output properly.

Hopefully this guide has helped you fix your VSCode terminal hanging issues too. πŸ™‚



If this post has been useful, support me by buying me a latte or two πŸ™‚
Buy Me A Coffee
Share this:

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.