Reputation: 315
When opening zsh on the normal terminal I have no errors, while when I open it on vscode I get this:
z4h: core parameters have unexpectedly changed
Expected:
ZDOTDIR=/Users/*******
Found:
ZDOTDIR=/var/folders/0f/**************/T/vscode-zsh
Restore the parameters or restart Zsh with exec zsh.
Restore the parameters or restart Zsh with exec zsh.
I installed zsh with z4h and for a while it worked well. Then it started showing this error randomly.
PS: I tried restarting Zsh with exec zsh.
EDIT: Tried to create the folder "/var/folders/0f/******/T/vscode-zsh" and paste the files in /Users/ in there as suggested but it still didn't work. Then in that folder, in the .zshrc I tried editing a part of it from this
if [[ "$VSCODE_INJECTION" == "1" ]]; then
if [[ $options[norcs] = off && -f $USER_ZDOTDIR/.zshrc ]]; then
VSCODE_ZDOTDIR=$ZDOTDIR
ZDOTDIR=$USER_ZDOTDIR
. $USER_ZDOTDIR/.zshrc
ZDOTDIR=$VSCODE_ZDOTDIR
fi
if [[ -f $USER_ZDOTDIR/.zsh_history ]]; then
HISTFILE=$USER_ZDOTDIR/.zsh_history
fi
fi
to this:
if [[ "$VSCODE_INJECTION" == "1" ]]; then
if [[ $options[norcs] = off && -f $USER_ZDOTDIR/.zshrc ]]; then
VSCODE_ZDOTDIR=$ZDOTDIR
ZDOTDIR=$USER_ZDOTDIR
. $USER_ZDOTDIR/.zshrc
ZDOTDIR=$USER_ZDOTDIR
fi
if [[ -f $USER_ZDOTDIR/.zsh_history ]]; then
HISTFILE=$USER_ZDOTDIR/.zsh_history
fi
fi
When in vscode the first time I opened a new terminal it worked, but after that the file was again the same as the fist one and creating another terminal would give the same error.
Upvotes: 1
Views: 992
Reputation: 318
Apparently, this is a bug on the VS code side and a fix has been made available in the insider build and will be available to the public shortly and can be tracked at link.
For now, this can be solved by setting terminal.integrated.shellIntegration.enabled
to false
in settings.json file or by disabling this option in settings
Upvotes: 5
Reputation: 1
If it still doesn't work. Another way that execute zsh with the same path. You need to reset the environment variable ZIM_HOME
to the Expected path.
In vscode CMD+Shift+P
Choose Preferences: Open Settings (JSON)
Add a keyname terminal.integrated.profiles.osx
Add the following value to this key.
{
"zsh": {
"path": "/bin/zsh",
"ZDOTDIR": "/Users/*******"
}
}
It would look like as below finally. [updated] the env var in your case
is ZDOTDIR
{
...
"terminal.integrated.profiles.osx": {
"zsh": {
"path": "/bin/zsh",
"ZDOTDIR": "/Users/*******"
}
}
...
}
Restart the terminal.
Upvotes: 0
Reputation: 1
The message shows vscode executes zsh from /var/folders/0f/**************/T/vscode-zsh
.
But no z4h's setting there. A workaround as below:
Backup if the /var/folders/0f/**************/T/vscode-zsh/.zshenv
and /var/folders/0f/**************/T/vscode-zsh/.zshrc
that existed in the path
Copy /Users/*******/.zshenv
and /Users/*******/.zshrc
to /var/folders/0f/**************/T/vscode-zsh/
Restart the terminal on vscode
Upvotes: 0