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

venv: option to disable PS1 change on venv activation #22728

Closed
tonywu6 opened this issue Jan 9, 2024 · 5 comments
Closed

venv: option to disable PS1 change on venv activation #22728

tonywu6 opened this issue Jan 9, 2024 · 5 comments
Assignees
Labels
experimenting Feature is part of an experiment triage-needed Needs assignment to the proper sub-team

Comments

@tonywu6
Copy link

tonywu6 commented Jan 9, 2024

Type: Feature Request

This is a feedback for the pythonTerminalEnvVarActivation experiment.

Related: #22611, #11039, #22056

I like the new way of activating venvs. I do have a thing to nitpick about, which is that people may already have configured their terminal to display current venvs (like spaceship) and so it'd be great if there's an option to prevent VS Code from modifying that (in other words "don't mess with my beautiful PS1" 😅)

Diagnostic data

  • Python version (& distribution if applicable, e.g. Anaconda): 3.10.11
  • Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Venv
  • Value of the python.languageServer setting: Pylance
User Settings


languageServer: "Pylance"

testing
• pytestArgs: "<placeholder>"
• pytestEnabled: true

experiments
• optOutFrom: ["pythonTerminalEnvVarActivation"]

Extension version: 2023.22.1
VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:48:16.874Z)
OS version: Darwin arm64 23.2.0
Modes:

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jan 9, 2024
@karrtikr
Copy link

karrtikr commented Jan 9, 2024

Hi @tonywu6 , thanks for reaching out. Can you describe the issue with screenshots as to what exactly is different? We try setting PS1 only if VIRTUAL_ENV_DISABLE_PROMPT is not set. Maybe setting that variable could help disabling the prompt for you.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Jan 9, 2024
@tonywu6
Copy link
Author

tonywu6 commented Jan 10, 2024

Hi! Did some debugging:

How my shell is setup

Screenshot 2024-01-10 at 10 12 42 AM

How my shell normally behaves

venv

Screenshot 2024-01-10 at 10 01 44 AM

conda

Screenshot 2024-01-10 at 10 02 28 AM

How new VS Code terminals behave WITHOUT pythonTerminalEnvVarActivation

VIRTUAL_ENV_DISABLE_PROMPT and PS1

Screenshot 2024-01-10 at 10 15 52 AM

venv

Screenshot 2024-01-10 at 10 04 01 AM

conda

Screenshot 2024-01-10 at 10 04 49 AM

How new VS Code terminals behave WITH pythonTerminalEnvVarActivation

venv

Screenshot 2024-01-10 at 10 12 02 AM

conda

Screenshot 2024-01-10 at 10 05 31 AM

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Jan 10, 2024
@karrtikr karrtikr added the experimenting Feature is part of an experiment label Feb 1, 2024
@karrtikr
Copy link

karrtikr commented Feb 5, 2024

Thanks for all the details in the screenshots, I really appreciate it. Have a look at this:

function shouldPS1BeSet(type: PythonEnvType | undefined, env: EnvironmentVariables): boolean {
if (env.PS1) {
// Activated variables contain PS1, meaning it was supposed to be set.
return true;
}
if (type === PythonEnvType.Virtual) {
const promptDisabledVar = env.VIRTUAL_ENV_DISABLE_PROMPT;
const isPromptDisabled = promptDisabledVar && promptDisabledVar !== undefined;
return !isPromptDisabled;
}

where we avoid setting PS1 if VIRTUAL_ENV_DISABLE_PROMPT is set. If you can also provide the Python debug logs, I can dig down into what the issue is quickly:

  • Run Developer: Set log level command
  • Select Trace
  • Run Developer: Reload Window command
  • Once terminals are activated, provide the output:
Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

XXX

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Feb 5, 2024
@tonywu6
Copy link
Author

tonywu6 commented Feb 6, 2024

Python output
2024-02-06 11:08:37.287 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-02-06 11:08:37.287 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-02-06 11:08:37.287 [info] Experiment 'pythonREPLSmartSend' is active
2024-02-06 11:08:37.287 [info] Experiment 'pythonTestAdapter' is active
2024-02-06 11:08:37.287 [info] Default formatter is set to ms-python.black-formatter for workspace ${HOME}/developer/tmp/vscode-venv
2024-02-06 11:08:37.287 [info] Test server listening.
2024-02-06 11:08:37.418 [info] Send text to terminal: echo /opt/homebrew/bin/zsh
2024-02-06 11:08:39.538 [info] > ./.venv/bin/python -I ~/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/interpreterInfo.py
2024-02-06 11:08:39.619 [info] Python interpreter path: ./.venv/bin/python
2024-02-06 11:08:39.858 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2024-02-06 11:08:39.858 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2024-02-06 11:08:39.861 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2024-02-06 11:08:39.890 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/printEnvVariables.py
2024-02-06 11:08:39.890 [info] shell: zsh
2024-02-06 11:08:40.035 [info] > /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/printEnvVariables.py
2024-02-06 11:08:40.035 [info] shell: zsh
2024-02-06 11:08:40.067 [info] Send text to terminal: /usr/bin/python3 ${HOME}/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/printEnvVariablesToFile.py ${HOME}/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/deactivate/zsh/envVars.txt
2024-02-06 11:08:40.882 [info] Starting Pylance language server.
2024-02-06 11:08:44.663 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2024-02-06 11:08:44.664 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:44.665 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:50.729 [info] Experiment 'pythonTerminalEnvVarActivation' is active
2024-02-06 11:08:50.729 [info] Experiment 'pythonRecommendTensorboardExt' is active
2024-02-06 11:08:50.729 [info] Experiment 'pythonREPLSmartSend' is active
2024-02-06 11:08:50.729 [info] Experiment 'pythonTestAdapter' is active
2024-02-06 11:08:50.729 [debug] Getting roots
2024-02-06 11:08:50.729 [debug] Getting roots
2024-02-06 11:08:50.729 [debug] Found roots
2024-02-06 11:08:50.729 [debug] Start watching file for changes ${HOME}/.conda/environments.txt
2024-02-06 11:08:50.729 [debug] Start watching: ${HOME}/.conda with pattern environments.txt using VSCode API
2024-02-06 11:08:50.729 [debug] Found roots
2024-02-06 11:08:50.729 [debug] Start watching root ${HOME}/developer/tmp/vscode-venv for globs ["python","*/python","*/bin/python"]
2024-02-06 11:08:50.729 [debug] Start watching: ${HOME}/developer/tmp/vscode-venv with pattern python using VSCode API
2024-02-06 11:08:50.729 [debug] Start watching: ${HOME}/developer/tmp/vscode-venv with pattern */python using VSCode API
2024-02-06 11:08:50.729 [debug] Start watching: ${HOME}/developer/tmp/vscode-venv with pattern */bin/python using VSCode API
2024-02-06 11:08:50.729 [info] Default formatter is set to ms-python.black-formatter for workspace ${HOME}/developer/tmp/vscode-venv
2024-02-06 11:08:50.729 [debug] Waiting for test server to start...
2024-02-06 11:08:50.729 [debug] VS Code was not launched from the command line
2024-02-06 11:08:50.729 [debug] No cached env found for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:50.729 [info] Test server listening.
2024-02-06 11:08:50.729 [debug] Test server started.
2024-02-06 11:08:50.729 [debug] Testing: Setting up watcher for ${HOME}/developer/tmp/vscode-venv
2024-02-06 11:08:50.748 [debug] Dump environment variables {
    "BUN_INSTALL": "${HOME}/.bun",
    "COLORFGBG": "15;0",
    "COLORTERM": "truecolor",
    "COMMAND_MODE": "unix2003",
    "CONDA_EXE": "/opt/homebrew/Caskroom/miniforge/base/bin/conda",
    "CONDA_PYTHON_EXE": "/opt/homebrew/Caskroom/miniforge/base/bin/python",
    "CONDA_SHLVL": "0",
    "DISABLE_MAGIC_FUNCTIONS": "true",
    "EDITOR": "nano",
    "ELECTRON_NO_ATTACH_CONSOLE": "1",
    "FNM_ARCH": "arm64",
    "FNM_COREPACK_ENABLED": "false",
    "FNM_DIR": "${HOME}/Library/Application Support/fnm",
    "FNM_LOGLEVEL": "info",
    "FNM_MULTISHELL_PATH": "${HOME}/Library/Caches/fnm_multishells/15791_1707188592629",
    "FNM_NODE_DIST_MIRROR": "https://nodejs.org/dist",
    "FNM_RESOLVE_ENGINES": "false",
    "FNM_VERSION_FILE_STRATEGY": "local",
    "HOME": "${HOME}",
    "HOMEBREW_CELLAR": "/opt/homebrew/Cellar",
    "HOMEBREW_PREFIX": "/opt/homebrew",
    "HOMEBREW_REPOSITORY": "/opt/homebrew",
    "INFOPATH": "/opt/homebrew/share/info:",
    "ITERM_PROFILE": "zsh",
    "ITERM_SESSION_ID": "w0t0p0:F418C2EF-2C20-432B-9454-54BD33E147EA",
    "LANG": "en_US.UTF-8",
    "LC_TERMINAL": "iTerm2",
    "LC_TERMINAL_VERSION": "3.4.20",
    "LESS": "-R",
    "LOCAL_DEV": "${HOME}/developer",
    "LOGNAME": "tony",
    "LSCOLORS": "Gxfxcxdxbxegedabagacad",
    "MAGICK_HOME": "/opt/homebrew/opt/imagemagick",
    "MANPATH": "/opt/homebrew/share/man::",
    "MallocNanoZone": "0",
    "OLDPWD": "${HOME}",
    "ORIGINAL_XDG_CURRENT_DESKTOP": "undefined",
    "PAGER": "less",
    "PNPM_HOME": "${HOME}/Library/pnpm",
    "PWD": "${HOME}",
    "PYTHONIOENCODING": "utf_8",
    "RBENV_SHELL": "zsh",
    "SHELL": "/bin/zsh",
    "SHLVL": "2",
    "SPACESHIP_ROOT": "${HOME}/.oh-my-zsh/custom/themes/spaceship-prompt",
    "SPACESHIP_VERSION": "3.16.1",
    "SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.7rS1kU3SzN/Listeners",
    "TERM": "xterm-256color",
    "TERM_PROGRAM": "iTerm.app",
    "TERM_PROGRAM_VERSION": "3.4.20",
    "TERM_SESSION_ID": "w0t0p0:F418C2EF-2C20-432B-9454-54BD33E147EA",
    "TMPDIR": "/var/folders/bp/mqdbmgl90rg9vgs6l1_hbd6r0000gn/T/",
    "UNCRUSTIFY_CONFIG": "${HOME}/.uncrustify.cfg",
    "USER": "tony",
    "VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
    "VSCODE_CLI": "1",
    "VSCODE_CODE_CACHE_PATH": "${HOME}/Library/Application Support/Code/CachedData/05047486b6df5eb8d44b2ecd70ea3bdf775fd937",
    "VSCODE_CRASH_REPORTER_PROCESS_TYPE": "extensionHost",
    "VSCODE_CWD": "${HOME}",
    "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
    "VSCODE_IPC_HOOK": "${HOME}/Library/Application Support/Code/1.86-main.sock",
    "VSCODE_NLS_CONFIG": "{\"locale\":\"en-us\",\"osLocale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
    "VSCODE_PID": "31514",
    "XPC_FLAGS": "0x0",
    "XPC_SERVICE_NAME": "application.com.microsoft.VSCode.183353380.183353386.862DB8F7-BCC1-47F1-BE50-6C261C7FCB17",
    "ZSH": "${HOME}/.oh-my-zsh",
    "ZSH_COMPDUMP": "${HOME}/.zcompdump",
    "__CFBundleIdentifier": "com.microsoft.VSCode",
    "__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0",
    "ELECTRON_RUN_AS_NODE": "1",
    "PATH": "${HOME}/.bun/bin:${HOME}/.rye/shims:${HOME}/Library/pnpm:/opt/homebrew/opt/curl/bin:/usr/local/opt/curl/bin:${HOME}/Library/Caches/fnm_multishells/15791_1707188592629/bin:/opt/homebrew/Caskroom/miniforge/base/condabin:${HOME}/.rbenv/shims:${HOME}/developer/bin:${HOME}/go/bin:${HOME}/.local/bin:/usr/local/opt/openssl/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Library/TeX/texbin:${HOME}/.cargo/bin:${HOME}/.cabal/bin:${HOME}/.ghcup/bin:${HOME}/.orbstack/bin"
}
2024-02-06 11:08:50.750 [info] > ./.venv/bin/python -I ~/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/get_output_via_markers.py ~/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/interpreterInfo.py
2024-02-06 11:08:50.777 [debug] No cached env found for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:50.779 [info] Send text to terminal: echo /opt/homebrew/bin/zsh
2024-02-06 11:08:50.780 [debug] No cached env found for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:50.780 [debug] No cached env found for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:50.780 [debug] Found interpreter for >> ${HOME}/developer/tmp/vscode-venv/.venv/bin/python -I ${HOME}/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/get_output_via_markers.py ${HOME}/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/interpreterInfo.py <<: {"versionInfo":[3,10,13,"final",0],"sysPrefix":"${HOME}/developer/tmp/vscode-venv/.venv","sysVersion":"3.10.13 (main, Aug 26 2023, 08:27:17) [Clang 16.0.3 ]","is64Bit":true}
2024-02-06 11:08:50.781 [debug] Environment resolver resolved ${HOME}/developer/tmp/vscode-venv/.venv/bin/python for {"name":".venv","location":"${HOME}/developer/tmp/vscode-venv/.venv","kind":"virt-venv","executable":{"filename":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","sysPrefix":"","ctime":1707188641705,"mtime":1707188641705},"searchLocation":{"$mid":1,"path":"${HOME}/developer/tmp/vscode-venv/.venv","scheme":"file"},"display":"Python 3.10.13 ('.venv': venv)","version":{"major":3,"minor":10,"micro":13},"arch":1,"distro":{"org":""},"source":[],"type":"Virtual","id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","detailedDisplayName":"Python 3.10.13 ('.venv': venv)"} to {"arch":3,"executable":{"filename":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","sysPrefix":"${HOME}/developer/tmp/vscode-venv/.venv","mtime":-1,"ctime":-1},"version":{"major":3,"minor":10,"micro":13,"release":{"level":"final","serial":0},"sysVersion":"3.10.13 (main, Aug 26 2023, 08:27:17) [Clang 16.0.3 ]"}}
2024-02-06 11:08:50.783 [debug] Resolved ${HOME}/developer/tmp/vscode-venv/.venv/bin/python using downstream locator
2024-02-06 11:08:50.783 [debug] Python API env change detected ${HOME}/developer/tmp/vscode-venv/.venv/bin/python add
2024-02-06 11:08:50.783 [debug] Flushing env to cache ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:50.783 [info] Python interpreter path: ./.venv/bin/python
2024-02-06 11:08:50.783 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:50.855 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:50.856 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:50.857 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:50.858 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:51.880 [debug] Delay Trigger[Test Configuration Change]: triggered=2, called=1
2024-02-06 11:08:51.881 [debug] Extension ms-python.black-formatter accessed onDidChangeActiveEnvironmentPath with args: undefined
2024-02-06 11:08:51.881 [debug] Extension ms-python.black-formatter accessed resolveEnvironment with args: {"id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","path":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python"}
2024-02-06 11:08:51.881 [debug] Extension ms-python.black-formatter accessed getActiveEnvironmentPath with args: undefined
2024-02-06 11:08:51.891 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:51.902 [debug] Dump environment variables {
    "BUN_INSTALL": "${HOME}/.bun",
    "COLORFGBG": "15;0",
    "COLORTERM": "truecolor",
    "COMMAND_MODE": "unix2003",
    "CONDA_EXE": "/opt/homebrew/Caskroom/miniforge/base/bin/conda",
    "CONDA_PYTHON_EXE": "/opt/homebrew/Caskroom/miniforge/base/bin/python",
    "CONDA_SHLVL": "0",
    "DISABLE_MAGIC_FUNCTIONS": "true",
    "EDITOR": "nano",
    "ELECTRON_NO_ATTACH_CONSOLE": "1",
    "FNM_ARCH": "arm64",
    "FNM_COREPACK_ENABLED": "false",
    "FNM_DIR": "${HOME}/Library/Application Support/fnm",
    "FNM_LOGLEVEL": "info",
    "FNM_MULTISHELL_PATH": "${HOME}/Library/Caches/fnm_multishells/15791_1707188592629",
    "FNM_NODE_DIST_MIRROR": "https://nodejs.org/dist",
    "FNM_RESOLVE_ENGINES": "false",
    "FNM_VERSION_FILE_STRATEGY": "local",
    "HOME": "${HOME}",
    "HOMEBREW_CELLAR": "/opt/homebrew/Cellar",
    "HOMEBREW_PREFIX": "/opt/homebrew",
    "HOMEBREW_REPOSITORY": "/opt/homebrew",
    "INFOPATH": "/opt/homebrew/share/info:",
    "ITERM_PROFILE": "zsh",
    "ITERM_SESSION_ID": "w0t0p0:F418C2EF-2C20-432B-9454-54BD33E147EA",
    "LANG": "en_US.UTF-8",
    "LC_TERMINAL": "iTerm2",
    "LC_TERMINAL_VERSION": "3.4.20",
    "LESS": "-R",
    "LOCAL_DEV": "${HOME}/developer",
    "LOGNAME": "tony",
    "LSCOLORS": "Gxfxcxdxbxegedabagacad",
    "MAGICK_HOME": "/opt/homebrew/opt/imagemagick",
    "MANPATH": "/opt/homebrew/share/man::",
    "MallocNanoZone": "0",
    "OLDPWD": "${HOME}",
    "ORIGINAL_XDG_CURRENT_DESKTOP": "undefined",
    "PAGER": "less",
    "PNPM_HOME": "${HOME}/Library/pnpm",
    "PWD": "${HOME}",
    "PYTHONIOENCODING": "utf_8",
    "RBENV_SHELL": "zsh",
    "SHELL": "/bin/zsh",
    "SHLVL": "2",
    "SPACESHIP_ROOT": "${HOME}/.oh-my-zsh/custom/themes/spaceship-prompt",
    "SPACESHIP_VERSION": "3.16.1",
    "SSH_AUTH_SOCK": "/private/tmp/com.apple.launchd.7rS1kU3SzN/Listeners",
    "TERM": "xterm-256color",
    "TERM_PROGRAM": "iTerm.app",
    "TERM_PROGRAM_VERSION": "3.4.20",
    "TERM_SESSION_ID": "w0t0p0:F418C2EF-2C20-432B-9454-54BD33E147EA",
    "TMPDIR": "/var/folders/bp/mqdbmgl90rg9vgs6l1_hbd6r0000gn/T/",
    "UNCRUSTIFY_CONFIG": "${HOME}/.uncrustify.cfg",
    "USER": "tony",
    "VSCODE_AMD_ENTRYPOINT": "vs/workbench/api/node/extensionHostProcess",
    "VSCODE_CLI": "1",
    "VSCODE_CODE_CACHE_PATH": "${HOME}/Library/Application Support/Code/CachedData/05047486b6df5eb8d44b2ecd70ea3bdf775fd937",
    "VSCODE_CRASH_REPORTER_PROCESS_TYPE": "extensionHost",
    "VSCODE_CWD": "${HOME}",
    "VSCODE_HANDLES_UNCAUGHT_ERRORS": "true",
    "VSCODE_IPC_HOOK": "${HOME}/Library/Application Support/Code/1.86-main.sock",
    "VSCODE_NLS_CONFIG": "{\"locale\":\"en-us\",\"osLocale\":\"en-us\",\"availableLanguages\":{},\"_languagePackSupport\":true}",
    "VSCODE_PID": "31514",
    "XPC_FLAGS": "0x0",
    "XPC_SERVICE_NAME": "application.com.microsoft.VSCode.183353380.183353386.862DB8F7-BCC1-47F1-BE50-6C261C7FCB17",
    "ZSH": "${HOME}/.oh-my-zsh",
    "ZSH_COMPDUMP": "${HOME}/.zcompdump",
    "__CFBundleIdentifier": "com.microsoft.VSCode",
    "__CF_USER_TEXT_ENCODING": "0x1F5:0x0:0x0",
    "ELECTRON_RUN_AS_NODE": "1",
    "APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL": "1",
    "PATH": "${HOME}/.bun/bin:${HOME}/.rye/shims:${HOME}/Library/pnpm:/opt/homebrew/opt/curl/bin:/usr/local/opt/curl/bin:${HOME}/Library/Caches/fnm_multishells/15791_1707188592629/bin:/opt/homebrew/Caskroom/miniforge/base/condabin:${HOME}/.rbenv/shims:${HOME}/developer/bin:${HOME}/go/bin:${HOME}/.local/bin:/usr/local/opt/openssl/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Library/TeX/texbin:${HOME}/.cargo/bin:${HOME}/.cabal/bin:${HOME}/.ghcup/bin:${HOME}/.orbstack/bin"
}
2024-02-06 11:08:51.936 [debug] Extension charliermarsh.ruff accessed getActiveEnvironmentPath with args: undefined
2024-02-06 11:08:51.936 [debug] Extension charliermarsh.ruff accessed resolveEnvironment with args: {"id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","path":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python"}
2024-02-06 11:08:51.936 [debug] Extension charliermarsh.ruff accessed onDidChangeActiveEnvironmentPath with args: undefined
2024-02-06 11:08:51.938 [debug] Extension charliermarsh.ruff accessed getActiveEnvironmentPath with args: undefined
2024-02-06 11:08:51.939 [debug] Extension charliermarsh.ruff accessed resolveEnvironment with args: {"id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","path":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python"}
2024-02-06 11:08:51.939 [debug] Extension charliermarsh.ruff accessed getActiveEnvironmentPath with args: undefined
2024-02-06 11:08:51.939 [debug] Extension charliermarsh.ruff accessed resolveEnvironment with args: {"id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","path":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python"}
2024-02-06 11:08:51.939 [debug] Extension charliermarsh.ruff accessed resolveEnvironment with args: {"id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","path":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python"}
2024-02-06 11:08:51.940 [debug] Extension charliermarsh.ruff accessed getActiveEnvironmentPath with args: undefined
2024-02-06 11:08:52.046 [debug] Activation Commands received source ${HOME}/developer/tmp/vscode-venv/.venv/bin/activate for shell /opt/homebrew/bin/zsh, resource ${HOME}/developer/tmp/vscode-venv and interpreter ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:52.047 [debug] Activating Environment to capture Environment variables, . ${HOME}/developer/tmp/vscode-venv/.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ${HOME}/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/printEnvVariables.py
2024-02-06 11:08:52.047 [info] > . ./.venv/bin/activate && echo 'e8b39361-0157-4923-80e1-22d70d46dee6' && python ~/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/printEnvVariables.py
2024-02-06 11:08:52.047 [info] shell: zsh
2024-02-06 11:08:52.124 [debug] Activated environment variables for ${HOME}/developer/tmp/vscode-venv {
  BUN_INSTALL: '${HOME}/.bun',
  COLORFGBG: '15;0',
  COLORTERM: 'truecolor',
  COMMAND_MODE: 'unix2003',
  CONDA_EXE: '/opt/homebrew/Caskroom/miniforge/base/bin/conda',
  CONDA_PYTHON_EXE: '/opt/homebrew/Caskroom/miniforge/base/bin/python',
  CONDA_SHLVL: '0',
  DISABLE_MAGIC_FUNCTIONS: 'true',
  EDITOR: 'nano',
  ELECTRON_NO_ATTACH_CONSOLE: '1',
  FNM_ARCH: 'arm64',
  FNM_COREPACK_ENABLED: 'false',
  FNM_DIR: '${HOME}/Library/Application Support/fnm',
  FNM_LOGLEVEL: 'info',
  FNM_MULTISHELL_PATH: '${HOME}/Library/Caches/fnm_multishells/15791_1707188592629',
  FNM_NODE_DIST_MIRROR: 'https://nodejs.org/dist',
  FNM_RESOLVE_ENGINES: 'false',
  FNM_VERSION_FILE_STRATEGY: 'local',
  HOME: '${HOME}',
  HOMEBREW_CELLAR: '/opt/homebrew/Cellar',
  HOMEBREW_PREFIX: '/opt/homebrew',
  HOMEBREW_REPOSITORY: '/opt/homebrew',
  INFOPATH: '/opt/homebrew/share/info:',
  ITERM_PROFILE: 'zsh',
  ITERM_SESSION_ID: 'w0t0p0:F418C2EF-2C20-432B-9454-54BD33E147EA',
  LANG: 'en_US.UTF-8',
  LC_TERMINAL: 'iTerm2',
  LC_TERMINAL_VERSION: '3.4.20',
  LESS: '-R',
  LOCAL_DEV: '${HOME}/developer',
  LOGNAME: 'tony',
  LSCOLORS: 'Gxfxcxdxbxegedabagacad',
  MAGICK_HOME: '/opt/homebrew/opt/imagemagick',
  MANPATH: '/opt/homebrew/share/man::',
  MallocNanoZone: '0',
  OLDPWD: '/',
  ORIGINAL_XDG_CURRENT_DESKTOP: 'undefined',
  PAGER: 'less',
  PNPM_HOME: '${HOME}/Library/pnpm',
  PWD: '/',
  PYTHONIOENCODING: 'utf_8',
  RBENV_SHELL: 'zsh',
  SHELL: '/bin/zsh',
  SHLVL: '2',
  SPACESHIP_ROOT: '${HOME}/.oh-my-zsh/custom/themes/spaceship-prompt',
  SPACESHIP_VERSION: '3.16.1',
  SSH_AUTH_SOCK: '/private/tmp/com.apple.launchd.7rS1kU3SzN/Listeners',
  TERM: 'xterm-256color',
  TERM_PROGRAM: 'iTerm.app',
  TERM_PROGRAM_VERSION: '3.4.20',
  TERM_SESSION_ID: 'w0t0p0:F418C2EF-2C20-432B-9454-54BD33E147EA',
  TMPDIR: '/var/folders/bp/mqdbmgl90rg9vgs6l1_hbd6r0000gn/T/',
  UNCRUSTIFY_CONFIG: '${HOME}/.uncrustify.cfg',
  USER: 'tony',
  VSCODE_AMD_ENTRYPOINT: 'vs/workbench/api/node/extensionHostProcess',
  VSCODE_CLI: '1',
  VSCODE_CODE_CACHE_PATH: '${HOME}/Library/Application Support/Code/CachedData/05047486b6df5eb8d44b2ecd70ea3bdf775fd937',
  VSCODE_CRASH_REPORTER_PROCESS_TYPE: 'extensionHost',
  VSCODE_CWD: '${HOME}',
  VSCODE_HANDLES_UNCAUGHT_ERRORS: 'true',
  VSCODE_IPC_HOOK: '${HOME}/Library/Application Support/Code/1.86-main.sock',
  VSCODE_NLS_CONFIG: '{"locale":"en-us","osLocale":"en-us","availableLanguages":{},"_languagePackSupport":true}',
  VSCODE_PID: '31514',
  XPC_FLAGS: '0x0',
  XPC_SERVICE_NAME: 'application.com.microsoft.VSCode.183353380.183353386.862DB8F7-BCC1-47F1-BE50-6C261C7FCB17',
  ZSH: '${HOME}/.oh-my-zsh',
  ZSH_COMPDUMP: '${HOME}/.zcompdump',
  __CFBundleIdentifier: 'com.microsoft.VSCode',
  __CF_USER_TEXT_ENCODING: '0x1F5:0x0:0x0',
  ELECTRON_RUN_AS_NODE: '1',
  APPLICATION_INSIGHTS_NO_DIAGNOSTIC_CHANNEL: '1',
  PATH: '${HOME}/developer/tmp/vscode-venv/.venv/bin:${HOME}/.bun/bin:${HOME}/.rye/shims:${HOME}/Library/pnpm:/opt/homebrew/opt/curl/bin:/usr/local/opt/curl/bin:${HOME}/Library/Caches/fnm_multishells/15791_1707188592629/bin:/opt/homebrew/Caskroom/miniforge/base/condabin:${HOME}/.rbenv/shims:${HOME}/developer/bin:${HOME}/go/bin:${HOME}/.local/bin:/usr/local/opt/openssl/bin:/usr/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Library/TeX/texbin:${HOME}/.cargo/bin:${HOME}/.cabal/bin:${HOME}/.ghcup/bin:${HOME}/.orbstack/bin',
  PYTHONUNBUFFERED: '1',
  VIRTUAL_ENV: '${HOME}/developer/tmp/vscode-venv/.venv',
  PS1: '(.venv) ',
  VIRTUAL_ENV_PROMPT: '(.venv) ',
  _: '${HOME}/developer/tmp/vscode-venv/.venv/bin/python'
}
2024-02-06 11:08:52.124 [info] > /usr/bin/python3 ~/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/printEnvVariables.py
2024-02-06 11:08:52.124 [info] shell: zsh
2024-02-06 11:08:53.022 [debug] Environment resolver resolved ${HOME}/developer/tmp/vscode-venv/.venv/bin/python for {"name":".venv","location":"${HOME}/developer/tmp/vscode-venv/.venv","kind":"virt-venv","executable":{"filename":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","sysPrefix":"","ctime":1707188641705,"mtime":1707188641705},"searchLocation":{"$mid":1,"path":"${HOME}/developer/tmp/vscode-venv/.venv","scheme":"file"},"display":"Python 3.10.13 ('.venv': venv)","version":{"major":3,"minor":10,"micro":13},"arch":1,"distro":{"org":""},"source":[],"type":"Virtual","id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","detailedDisplayName":"Python 3.10.13 ('.venv': venv)"} to {"arch":3,"executable":{"filename":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","sysPrefix":"${HOME}/developer/tmp/vscode-venv/.venv","mtime":-1,"ctime":-1},"version":{"major":3,"minor":10,"micro":13,"release":{"level":"final","serial":0},"sysVersion":"3.10.13 (main, Aug 26 2023, 08:27:17) [Clang 16.0.3 ]"}}
2024-02-06 11:08:53.024 [debug] Resolved ${HOME}/developer/tmp/vscode-venv/.venv/bin/python using downstream locator
2024-02-06 11:08:53.024 [debug] Flushing env to cache ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:53.026 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:53.027 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:53.029 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:53.029 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:53.030 [debug] Setting environment variable MANPATH in collection to /opt/homebrew/share/man::
2024-02-06 11:08:53.030 [debug] Prepending environment variable PATH in collection with ${HOME}/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/deactivate/zsh:${HOME}/developer/tmp/vscode-venv/.venv/bin:
2024-02-06 11:08:53.030 [debug] Setting environment variable VIRTUAL_ENV in collection to ${HOME}/developer/tmp/vscode-venv/.venv
2024-02-06 11:08:53.030 [debug] Prepending environment variable PS1 in collection with (.venv) 
2024-02-06 11:08:53.030 [debug] Setting environment variable VIRTUAL_ENV_PROMPT in collection to (.venv) 
2024-02-06 11:08:53.031 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:53.031 [info] Send text to terminal: /usr/bin/python3 ${HOME}/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/printEnvVariablesToFile.py ${HOME}/.vscode/extensions/ms-python.python-2024.0.0/pythonFiles/deactivate/zsh/envVars.txt
2024-02-06 11:08:53.071 [debug] Environment resolver resolved ${HOME}/developer/tmp/vscode-venv/.venv/bin/python for {"name":".venv","location":"${HOME}/developer/tmp/vscode-venv/.venv","kind":"virt-venv","executable":{"filename":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","sysPrefix":"","ctime":1707188641705,"mtime":1707188641705},"searchLocation":{"$mid":1,"path":"${HOME}/developer/tmp/vscode-venv/.venv","scheme":"file"},"display":"Python 3.10.13 ('.venv': venv)","version":{"major":3,"minor":10,"micro":13},"arch":1,"distro":{"org":""},"source":[],"type":"Virtual","id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","detailedDisplayName":"Python 3.10.13 ('.venv': venv)"} to {"arch":3,"executable":{"filename":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","sysPrefix":"${HOME}/developer/tmp/vscode-venv/.venv","mtime":-1,"ctime":-1},"version":{"major":3,"minor":10,"micro":13,"release":{"level":"final","serial":0},"sysVersion":"3.10.13 (main, Aug 26 2023, 08:27:17) [Clang 16.0.3 ]"}}
2024-02-06 11:08:53.072 [debug] Resolved ${HOME}/developer/tmp/vscode-venv/.venv/bin/python using downstream locator
2024-02-06 11:08:53.072 [debug] Flushing env to cache ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:53.073 [debug] Environment resolver resolved ${HOME}/developer/tmp/vscode-venv/.venv/bin/python for {"name":".venv","location":"${HOME}/developer/tmp/vscode-venv/.venv","kind":"virt-venv","executable":{"filename":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","sysPrefix":"","ctime":1707188641705,"mtime":1707188641705},"searchLocation":{"$mid":1,"path":"${HOME}/developer/tmp/vscode-venv/.venv","scheme":"file"},"display":"Python 3.10.13 ('.venv': venv)","version":{"major":3,"minor":10,"micro":13},"arch":1,"distro":{"org":""},"source":[],"type":"Virtual","id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","detailedDisplayName":"Python 3.10.13 ('.venv': venv)"} to {"arch":3,"executable":{"filename":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","sysPrefix":"${HOME}/developer/tmp/vscode-venv/.venv","mtime":-1,"ctime":-1},"version":{"major":3,"minor":10,"micro":13,"release":{"level":"final","serial":0},"sysVersion":"3.10.13 (main, Aug 26 2023, 08:27:17) [Clang 16.0.3 ]"}}
2024-02-06 11:08:53.074 [debug] Resolved ${HOME}/developer/tmp/vscode-venv/.venv/bin/python using downstream locator
2024-02-06 11:08:53.074 [debug] Flushing env to cache ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:53.088 [debug] Time taken to get env vars using terminal is 57ms
2024-02-06 11:08:53.089 [debug] Storage update failed for key PYTHON_ENV_INFO_CACHE  retrying by resetting first
2024-02-06 11:08:53.235 [debug] Storage update failed for key PYTHON_ENV_INFO_CACHE  retrying by resetting first
2024-02-06 11:08:53.235 [debug] Storage update failed for key PYTHON_ENV_INFO_CACHE  retrying by resetting first
2024-02-06 11:08:53.238 [debug] Extension ms-python.black-formatter accessed getActiveEnvironmentPath with args: undefined
2024-02-06 11:08:53.238 [debug] Extension ms-python.black-formatter accessed getActiveEnvironmentPath with args: undefined
2024-02-06 11:08:53.239 [debug] Extension ms-python.black-formatter accessed resolveEnvironment with args: {"id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","path":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python"}
2024-02-06 11:08:53.239 [debug] Extension ms-python.black-formatter accessed resolveEnvironment with args: {"id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","path":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python"}
2024-02-06 11:08:53.393 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2024-02-06 11:08:53.393 [warning] Retry failed, storage update failed for key PYTHON_ENV_INFO_CACHE
2024-02-06 11:08:53.432 [debug] Extension ms-python.vscode-pylance accessed onDidEnvironmentVariablesChange with args: undefined
2024-02-06 11:08:53.432 [debug] Extension ms-python.vscode-pylance accessed onDidChangeActiveEnvironmentPath with args: undefined
2024-02-06 11:08:54.444 [info] Starting Pylance language server.
2024-02-06 11:08:54.445 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:54.449 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:54.450 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:08:54.456 [debug] Extension ms-python.vscode-pylance accessed resolveEnvironment with args: {"id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","path":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python"}
2024-02-06 11:08:54.457 [debug] Extension ms-python.vscode-pylance accessed getActiveEnvironmentPath with args: undefined
2024-02-06 11:08:54.457 [debug] Extension ms-python.vscode-pylance accessed getEnvironmentVariables with args: undefined
2024-02-06 11:08:54.458 [debug] Extension ms-python.vscode-pylance accessed getActiveEnvironmentPath with args: undefined
2024-02-06 11:08:54.461 [debug] Extension ms-python.vscode-pylance accessed resolveEnvironment with args: {"id":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python","path":"${HOME}/developer/tmp/vscode-venv/.venv/bin/python"}
2024-02-06 11:08:54.876 [debug] Clearing context for python dependencies not installed: undefined
2024-02-06 11:08:56.730 [debug] Terminal shell path '/opt/homebrew/bin/zsh' identified as shell 'zsh'
2024-02-06 11:08:56.730 [debug] Shell identified as zsh 
2024-02-06 11:08:56.730 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:09:00.898 [debug] Clearing context for python dependencies not installed: undefined
2024-02-06 11:09:02.737 [debug] Clearing context for python dependencies not installed: ms-python.python.Python
2024-02-06 11:09:02.737 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python
2024-02-06 11:09:02.738 [debug] Found cached env for ${HOME}/developer/tmp/vscode-venv/.venv/bin/python

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Feb 6, 2024
@tonywu6
Copy link
Author

tonywu6 commented Feb 6, 2024

I think I got it ... VIRTUAL_ENV_DISABLE_PROMPT was never an environment variable, it was only set as a variable in Zsh which is why VSCode can't see it. Oops 😅

11:33:32 ~
> echo $VIRTUAL_ENV_DISABLE_PROMPT
true
11:33:34 ~
> bash -c 'echo $VIRTUAL_ENV_DISABLE_PROMPT'

https://github.com/spaceship-prompt/spaceship-prompt/blob/be826cbe2bb11a0675dd71f548ff1396608da7ea/spaceship.zsh#L202-L203

I manually set it in my .zshrc and the feature is working as expected now. Sorry and thanks 😅

@tonywu6 tonywu6 closed this as completed Feb 6, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
experimenting Feature is part of an experiment triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants