mcfly icon indicating copy to clipboard operation
mcfly copied to clipboard

VSCode 1.7 HISTFILE conflict

Open gzheng92 opened this issue 3 years ago • 14 comments
trafficstars

In the latest release version of VSCode, starting a terminal produces the following console output:

McFly: /var/folders/n6/k33n7qp50tsblm9wl5zqzvlr0000gn/T/vscode-zsh/.zsh_history does not exist or is not readable. Please fix this or set HISTFILE to something else before using McFly.

I tried adding

default_histfile="${HISTFILE:-$HOME/.zsh_history}"
export MCFLY_HISTFILE="${MCFLY_HISTFILE:-$default_histfile}"

to my ~/.zshrc, but that didn't help

gzheng92 avatar Aug 05 '22 17:08 gzheng92

Looks like this is the new VSCode setting that causes the issue: terminal.integrated.shellIntegration.enabled. Turning it off and starting a new shell resulted in no more error for me.

Screen Shot 2022-08-08 at 22 32 01

Tarpstone avatar Aug 09 '22 02:08 Tarpstone

Hopefully the injection script used by VSCode will eventually work with mcfly, but I guess this is a good enough solution

gzheng92 avatar Aug 09 '22 16:08 gzheng92

Manual shell integration (https://code.visualstudio.com/docs/terminal/shell-integration#_manual-installation) did not print this error for me. I was able to use the shell integration and McFly

daxmc99 avatar Aug 09 '22 17:08 daxmc99

Looks like this is the new VSCode setting that causes the issue: terminal.integrated.shellIntegration.enabled. Turning it off and starting a new shell resulted in no more error for me.

Screen Shot 2022-08-08 at 22 32 01

Thank you @Tarpstone This solved several problems for me, from poetry to pyenv, and of course mcfly.

emptymalei avatar Aug 13 '22 08:08 emptymalei

Re-opening so it's easier for folks to find this issue. I wonder if there's anything mcfly's init script can do to fix this.

cantino avatar Aug 16 '22 19:08 cantino

The claim is that this will be fixed in the next VSCode release: https://github.com/microsoft/vscode/issues/145296#issuecomment-1222465601

cantino avatar Aug 26 '22 02:08 cantino

I just updated and it is still not fixed, unable to comment on microsoft/vscode#145296 to let them know

gzheng92 avatar Sep 01 '22 20:09 gzheng92

Darn! I guess you could make a new issue.

cantino avatar Sep 04 '22 05:09 cantino

For whatever reason, the manual installation for shell integration is unable to set theHISTFILE, so I just set it manually.

Just put this in your .zshrc: [[ "$TERM_PROGRAM" == "vscode" ]] && . "$(codium --locate-shell-integration-path zsh)" && HISTFILE=$USER_ZDOTDIR/.zsh_history

pickx avatar Sep 04 '22 19:09 pickx

Is HISTFILE not set in the vscode shell by default?

cantino avatar Sep 23 '22 17:09 cantino

Ran into the same issue today. I can confirm that removing the shell integration feature seems to work.

For whatever reason, the manual installation for shell integration is unable to set theHISTFILE, so I just set it manually.

Just put this in your .zshrc: [[ "$TERM_PROGRAM" == "vscode" ]] && . "$(codium --locate-shell-integration-path zsh)" && HISTFILE=$USER_ZDOTDIR/.zsh_history

btw.: this only works with the editor codium as I see it rn.

PanadeEdu avatar Sep 29 '22 08:09 PanadeEdu

Ran into the same issue today. I can confirm that removing the shell integration feature seems to work.

For whatever reason, the manual installation for shell integration is unable to set theHISTFILE, so I just set it manually. Just put this in your .zshrc: [[ "$TERM_PROGRAM" == "vscode" ]] && . "$(codium --locate-shell-integration-path zsh)" && HISTFILE=$USER_ZDOTDIR/.zsh_history

btw.: this only works with the editor codium as I see it rn.

I substituted code for codium for my installation:

Version: 1.73.0 Commit: 8fa188b2b301d36553cbc9ce1b0a146ccb93351f Date: 2022-11-01T15:33:40.745Z Electron: 19.0.17 Chromium: 102.0.5005.167 Node.js: 16.14.2 V8: 10.2.154.15-electron.0 OS: Darwin arm64 22.1.0 Sandboxed: No

johndutchover avatar Nov 07 '22 02:11 johndutchover

Looks like it is still not fixed in VSCode, see e.g. https://github.com/microsoft/vscode/issues/164025

I'm still seeing this (/cc @Tyriar):

Version: 1.73.1
Commit: 6261075646f055b99068d3688932416f2346dd3b
Date: 2022-11-09T02:22:48.959Z
Electron: 19.0.17
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin arm64 22.1.0
Sandboxed: No

tisba avatar Nov 27 '22 17:11 tisba

Getting this error on a brand new machine, no VSCode, regular Terminal in Fedora 37.

kevinquillen avatar Dec 18 '22 15:12 kevinquillen