fix(vscode): avoid interactive shell setup during VSCode shell resolving

When VSCode is started from normal non-terminal/CLI methods, it will start a interactive shell session in the background to dump the the env and get PATH.

Latest versions of VSCode do no play nice with Mise's dynamic PATH updating stuff, and understandably so.

Hence we now check VSCODE_RESOLVING_ENVIRONMENT and avoid all interactive shell setup when it is set.
This commit is contained in:
2025-06-28 16:10:19 +01:00
parent cf1c7de954
commit c2ae58077a
3 changed files with 16 additions and 1 deletions

View File

@@ -43,6 +43,7 @@ SYMLINKS=(
tmux tmux
tmux.conf tmux.conf
warp warp
zprofile
zshenv zshenv
zshrc zshrc
) )

7
zprofile Normal file
View File

@@ -0,0 +1,7 @@
#
# ZSH Non-Interactive Shell Setup
#
# We don't want anything beyond the zshenv file to be loaded in a
# non-interactive shell.
return

9
zshrc
View File

@@ -1,7 +1,14 @@
# #
# Z-Shell Init # ZSH Interactive Shell Setup
# #
# If we are in VSCode's environment resolution process, we should behave as if
# this is a non-interactive shell by bailing before we load any of our
# interactive shell setup.
if [[ -n $VSCODE_RESOLVING_ENVIRONMENT ]]; then
return
fi
# In our zshenv file we have on macOS disabled loading ZSH startup files from # In our zshenv file we have on macOS disabled loading ZSH startup files from
# /etc to avoid /etc/zprofile messing up our carefully constructed PATH. So we # /etc to avoid /etc/zprofile messing up our carefully constructed PATH. So we
# need to manually load the other files we care about. # need to manually load the other files we care about.