iTranslated by AI

The content below is an AI-generated translation. This is an experimental feature, and may contain errors. View original article
😊

VSCode Integrated Terminal fails to open

に公開

There have been times when VS Code's Integrated Terminal wouldn't open, perhaps due to an update or something.
In my case, I usually use zsh, and the symptom was that the zsh prompt would never appear no matter how long I waited.

Since my main workspace is on a group of servers via NFS, I thought the issue might be occurring there. I tried deleting the remote ~/.vscode-server shared over NFS, but the problem was not resolved.

I'm not sure of the specific conditions, but the behavior seemed as though the shell itself wasn't even starting.
While searching through the official VS Code website for information, I came across the following page:

https://code.visualstudio.com/docs/terminal/shell-integration#_manual-installation

It seems that the shell used for the Integrated Terminal can not only be left to VS Code but can also be explicitly installed (?) manually.

So, first, add the following to your .zshrc.

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

Furthermore, add the following to your VS Code settings file.

settings.json
"terminal.integrated.shellIntegration.enabled": false,

After applying these settings and restarting VS Code, the issue was resolved for me.

I'm sorry I don't know the exact cause, but I hope this is helpful (if you have any ideas or guesses about the cause, I'd appreciate it if you could let me know in the comments).

Discussion