ohmyzsh / ohmyzsh

🙃 A delightful community-driven (with 2,300+ contributors) framework for managing your zsh configuration. Includes 300+ optional plugins (rails, git, macOS, hub, docker, homebrew, node, php, python, etc), 140+ themes to spice up your morning, and an auto-update tool so that makes it easy to keep up with the latest updates from the community.

Home Page:https://ohmyz.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Update prompt conflicts with VSCode python venv functionality

marcospgp opened this issue · comments

Describe the bug

VSCode python venv functionality runs source venv/bin/activate on terminal startup

Update prompt from oh my zsh captures the first character

image

Steps to reproduce

See above

Expected behavior

See above

Screenshots and recordings

No response

OS / Linux distribution

MacOS

Zsh version

5.8.1

Terminal emulator

VSCode

If using WSL on Windows, which version of WSL

None

Additional context

No response

Hi! That's an unfortunate corner case. I think changing the way omz updates in vscode could be counterproductive for users that don't use the venv integration. Instead of using vscode python venv, you could try our python plugin or disable the whole upgrade system if the terminal where zsh is running is vscode, as follows (before sourcing oh-my-zsh.sh):

[[ $TERM_PROGRAM == vscode ]] && zstyle ':omz:update' mode disabled

Could a simple check for incoming input on shell startup suffice? I assume VSCode sends its command right away, faster than a human would, so a simple check for input before prompting user to update could solve the issue for VSCode and any other automated shell-creating programs that could interfere with ohmyzsh and have ohmyzsh interfere with them

The problem is that the input comes after the shell is initialized, that's why the first char gets cached by the update system.
If the input comes before the question, it already catches it and skips update.

what if the update prompt simply tells the user to run an update command and doesn't directly ask/listen for a y/n input?

You can choose that as well by setting the update mode reminder. You can read about it in the README!

But given the wide adoption of VSCode as an editor is there a chance we could make the case for having that as a default?

I think that's an idea in the short run, let's add the check ourselves, but ideally in the long run I'd like to have a better solution for delayed initial input.

I experienced the same issue with cat > <newfile> and touch <newfile> in IntelliJ terminal when propted for the update.

Ok imediatelly after update

I'm not able to reproduce this in VS Code (tried following [1] to no avail), and I don't have IntelliJ installed to reproduce this. Could you write a bullet point list of the steps to set this up, and confirm that you're in the latest OMZ version?

Why not just avoid capturing initial terminal output, which anecdotally conflicts with more than one application? I think a prompt that asks the user to run a command to update would work just as well in all instances, no?

Is there a big advantage in capturing input? Forcing the user to decide immediately whether they want to update (seems a bit intrusive)?

I appreciate all your effort here, just an idea of what I would do here 🙏