From c2ae58077a2db0e768b4700781ed76f42250be3f Mon Sep 17 00:00:00 2001 From: Jim Myhrberg Date: Sat, 28 Jun 2025 16:10:19 +0100 Subject: [PATCH] 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. --- install.sh | 1 + zprofile | 7 +++++++ zshrc | 9 ++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 zprofile diff --git a/install.sh b/install.sh index a9083d4..72dd1aa 100755 --- a/install.sh +++ b/install.sh @@ -43,6 +43,7 @@ SYMLINKS=( tmux tmux.conf warp + zprofile zshenv zshrc ) diff --git a/zprofile b/zprofile new file mode 100644 index 0000000..e84601e --- /dev/null +++ b/zprofile @@ -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 diff --git a/zshrc b/zshrc index f3a5184..0393bd4 100644 --- a/zshrc +++ b/zshrc @@ -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 # /etc to avoid /etc/zprofile messing up our carefully constructed PATH. So we # need to manually load the other files we care about.