Avoid adding commands to shell history
See original GitHub issuehttps://github.com/microsoft/vscode/issues/85887 is indicating that the Python extension sets the environment of the terminal by using sendText
still which has a number of drawbacks including: it’s slower (you might need a timeout), less reliable (you don’t know what the rc script will do), may end up in shell history and it’s ugly as the env command is shown to the user.
This related issue was created in the past but it’s locked https://github.com/microsoft/vscode-python/issues/7041, I believe this discussion belongs in this extension rather than in the VS Code repo. I suggest also unlocking that issue as it’s requesting to prefix the command with a space to avoid it being added to shell history (I can’t seem to get that to work though? set HISTCONTROL
to enable this).
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (5 by maintainers)
The current mechanism is definitely flawed, the Python team (which I’m not on) is actively working on improving how environments are activated by leveraging process environment vs running a command.
May I resurface this issue? I’m using fish shell and the history pollution for virtualenv’s
venv/bin/activate.fish
is very annoying.One issue is the absolute path used for the
source
command since a manual subsequent history lookup (aiming forsource ./venv/bin/activate.fish
) in any project will yield most likely a command issued by vscode-python for a random project.One issue is that there seems to be a delay between opening a new shell and the
source
command being issued by vscode-python. It happens casually (under high system load) that I’m opening a shell to issue agit ...
command and vscode-python interferes with my typing resulting in some of the garbled commands shown below: