All Products
Search
Document Center

AI Coding Assistant Lingma:Terminal execution exceptions

Last Updated:May 09, 2025

Introduction

Terminal execution depends heavily on your environment and configuration. VS Code and Jetbrains IDEs have certain limitations and compatibility issues with terminals on different operating systems. Therefore, you might encounter problems such as being unable to properly invoke terminal commands or obtain execution outputs when using the Lingma Agent mode.

VSCode

Common troubleshooting methods

The Lingma VSCode extension relies on the VSCode Shell integration API to invoke terminal commands and read their outputs. This API is a new feature provided in VSCode version 1.93 and currently only supports the following types of shells. Therefore, you need to ensure that your VSCode version is greater than 1.93 and that your default terminal is configured as one of the following types:

  • Linux/macOS: bash, fish, pwsh, zsh

  • Windows: Git Bash, pwsh

If you encounter terminal execution exceptions, you can try the following methods in sequence:

Method 1: Upgrade VSCode

Please check your VSCode version to ensure it is 1.93 or above:

  1. Open VSCode.

  2. Press Cmd + Shift + P (Mac) or Ctrl + Shift + P (Windows/Linux).

  3. Type Code: Check for Updates, then select it.

  4. Restart VSCode after the update is complete.

Method 2: Configure a supported VSCode Shell

  1. Open VSCode.

  2. Press Cmd + Shift + P (Mac) or Ctrl + Shift + P (Windows/Linux).

  3. Type Terminal: Select Default Profile, then select it.

  4. Choose a supported Shell:

    • Linux/macOS: bash, fish, pwsh, zsh

    • Windows: Git Bash, pwsh

  5. Completely exit VSCode, then reopen it.

Method 3: Manually install Shell integration

If you still encounter issues after trying the above troubleshooting steps, you can try to manually install Shell integration.

For example, if you use zsh:

  1. Add the following line to your ~/.zshrc file:

    [[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)"
  2. Save the file.

  3. Completely exit VSCode, then reopen it.

    If you use Bash (~/.bashrc):

[[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path bash)"

If you use PowerShell ($Profile):

if ($env:TERM_PROGRAM -eq "vscode") { . "$(code --locate-shell-integration-path pwsh)" }

If you use Fish (~/.config/fish/config.fish):

string match -q "$TERM_PROGRAM" "vscode"; and . (code --locate-shell-integration-path fish)

If you use other types of Shell, refer to the documentation: Manual installation of Shell integration.

Still having issues?

If you have tried the above methods and still occasionally encounter situations where you cannot obtain terminal output, you can try closing (click the Stop Terminal button) the terminal window that cannot obtain output, and then run the command again. This will refresh the terminal connection and is likely to solve the problem.

Windows

If you are using Windows and still encounter issues after trying the above steps, you can use the following methods:

Git Bash

You can try using Git Bash. Git Bash provides a Unix-like command line experience on Windows. To use Git Bash, you need to:

  1. Download and run the Git for Windows installer from https://git-scm.com/downloads/win.

  2. Exit and reopen VSCode.

  3. Press Ctrl + Shift + P to open the command palette.

  4. Type Terminal: Select Default Profile, then select it.

  5. Choose "Git Bash".

PowerShell

If you still want to use PowerShell, make sure you are using an updated version (at least v7+).

  • Check your current PowerShell version by running the following command: $PSVersionTable.PSVersion

  • If your version is lower than 7, please update PowerShell.

By default, PowerShell restricts script execution for security reasons. You may also need to adjust PowerShell's execution policy:

  1. Open PowerShell as an administrator: Press Win + X and select "Windows PowerShell (Administrator)" or "Windows Terminal (Administrator)".

  2. Check the current execution policy by running the following command:

    Get-ExecutionPolicy
    • If the output is already RemoteSigned, Unrestricted, or Bypass, you may not need to change the execution policy. These policies should allow Shell integration to work properly.

    • If the output is Restricted or AllSigned, you may need to change the policy to enable Shell integration.

  3. Change the execution policy by running the following command:

    Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

    This will set the RemoteSigned policy only for the current user, which is safer than a system-wide change.

  4. Confirm the change: Type Y at the prompt and press Enter.

  5. Verify the policy change: Run Get-ExecutionPolicy again to confirm the new setting.

  6. Restart VSCode and try Shell integration again.

WSL

If you use WSL, try adding . "$(code --locate-shell-integration-path bash)" to your ~/.bashrc, then restart and try again.

Other exceptional situations

Terminal output exceptions

If you see abnormal output with rectangles, lines, escape sequences, or control characters, this may be related to terminal customization tools. Common culprits include the following: Powerlevel10k (a zsh theme that adds visual elements to the prompt), Oh My Zsh, Fish shell themes, etc.

How to troubleshoot:

  1. Temporarily disable these tools in your Shell configuration file (for example, the ~/.zshrc file for Zsh).

  2. If the problem is resolved, gradually re-enable features to identify the conflicting tool.

For example, if you use Powerlevel10k in Zsh, you can disable it by commenting out the relevant lines in your ~/.zshrc file:

# Comment out the source line for Powerlevel10k
# source /path/to/powerlevel10k/powerlevel10k.zsh-theme

If disabling these customizations solves the problem, you may need to find alternative configurations that are compatible with the VSCode Shell integration feature.

Jetbrains IDEs

The new Beta version terminal is available in the new UI starting from IDE version 2024.1. The Lingma Jetbrains plugin does not currently support the new terminal mode.

image.png

You can disable the new terminal through the following methods:

Method 1: In Settings or Preferences, open Tools - Terminal - Enable New Terminal and uncheck the new terminal option.

Method 2: In the Terminal window title, click the image.svg icon and uncheck Enable New Terminal.

Contact us

If you are still unable to solve your problem after referring to the solutions provided in this document, you can contact us.