Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Autoswitch not silent when terminal opened directly in a directory where a venv exists #151

Open
andrenasturas opened this issue Mar 24, 2021 · 0 comments

Comments

@andrenasturas
Copy link

andrenasturas commented Mar 24, 2021

Issue Details

The variable AUTOSWITCH_SILENT, when set to a true value, prevents the "Switching virtualenv: ..." message to be prompted when entering into a directory where a .venv is available.

This behavior does not work if the terminal is opened directly into a directory where a .venv is available, and the message is prompted.

It causes ugly outputs when used with Powerlevel10k which shows a heavy warning message when it detects any message prompted before the first console prompt.

Operating System (uname -a)

Arch Linux
Linux 5.11.7-arch1-1 #1 SMP PREEMPT Wed, 17 Mar 2021 16:59:58 +0000 x86_64 GNU/Linux

zsh version (zsh --version)

zsh 5.8 (x86_64-pc-linux-gnu)

autoswitch-virtualenv version

3.1.1

How is zsh-autoswitch-virtualenv installed?

Loaded directly into .zshrc without plugin framework other than Powerlevel10k

Steps to reproduce the issue

  1. Set AUTOSWITCH_SILENT to a true value : echo "export AUTOSWITCH_SILENT=1" >> ~/.zshrc
  2. Open a new terminal directly into a directory where a .venv is available (Right-click > "Open Termianl here" in Dolphin, or Ctrl+P > "> Toggle integrated terminal" in VSCode)

gist link to your zshrc

.zshrc

Workaround

As I post this message, I just thought of a simple workaround : putting the export AUTOSWITCH_SILENT=1 line before the source ~/.zsh/zsh-autoswitch-virtualenv/autoswitch_virtualenv.plugin.zsh, which effectively prevent the message to be prompted at console initialization. But I'm not sure if it nullify the issue (not tested with plugins frameworks) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant