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

Shell integration isn't enabled for Task terminals #205177

Open
Tracked by #22879
karrtikr opened this issue Feb 14, 2024 · 1 comment
Open
Tracked by #22879

Shell integration isn't enabled for Task terminals #205177

karrtikr opened this issue Feb 14, 2024 · 1 comment
Assignees
Labels
feature-request Request for new features or functionality tasks Task system issues terminal-shell-integration Shell integration, command decorations, etc.

Comments

@karrtikr
Copy link
Contributor

karrtikr commented Feb 14, 2024

Creating based on #204694 (comment).

Context: Python extension uses environment collection to activate all terminals, via shell integration.

Some users launch certain apps via tasks microsoft/vscode-python#22880, expecting environment to be activated, and hence are failing because shell integration isn't active for such terminals.

A couple of solutions we could go with:

  • Enable shell integration for task terminals, similar to how we're doing for debug terminals: Shell integration isn't enabled for Debug terminals #204694
  • If shell integration isn't available for a terminal type, fallback on applying environment collection using process creation instead. That is, if both "applyAtShellIntegration" and "applyAtProcessCreation" are set to true and shell integration is working, we only apply it at shell integration, otherwise we fallback to only apply it at process creation.
@meganrogge meganrogge added feature-request Request for new features or functionality tasks Task system issues terminal-shell-integration Shell integration, command decorations, etc. labels Feb 14, 2024
@Jean7667
Copy link

Jean7667 commented May 6, 2024

I have the same problem

I tried that with no success:
{
"version": "2.0.0",
"tasks": [
{
"label": "Activate Virtual Environment",
"type": "process",
"command": "/usr/bin/zsh",
"args": [
"-c",
"source /mypathtomy/.virtualenvs/abc_app_3.12_virt_env/bin/activate && echo 'Virtual environment activated.'"
],
"problemMatcher": [],
"runOptions": {
"runOn": "folderOpen"
},
"presentation": {
"reveal": "always",
"panel": "shared",
"showReuseMessage": false
}
}
]
}
I tried with Type set to process or shell and I had the same result the tasks is triggered on startup, a new terminal is running with the task but the virtualenv is not activated in this terminal.
I would expect that the task runs in the current terminal and that the virtual env is activated at the end of the execution.
Looking at the documentation it does not seem to have a setting for that.

https://stackoverflow.com/questions/78430426/automating-activate-python-virtualenv-with-visual-studio-task-does-not-work

Problem with
VSCODE Version: 1.89.0
Commit: b58957e
Date: 2024-05-01T02:08:25.066Z
Electron: 28.2.8
ElectronBuildId: 27744544
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Linux x64 6.5.0-28-generic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality tasks Task system issues terminal-shell-integration Shell integration, command decorations, etc.
Projects
None yet
Development

No branches or pull requests

3 participants