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

Don't activate environments in terminals created by other extensions #11963

Closed
andycraig opened this issue May 23, 2020 · 3 comments
Closed

Don't activate environments in terminals created by other extensions #11963

andycraig opened this issue May 23, 2020 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug

Comments

@andycraig
Copy link

Hello,

An R extension has a command to create an R console. If the Python extension is also active and using a virtualenv/conda/etc. environment then text like 'source .../env/bin/activate' is sent to the already running R console. This is confusing because it looks like an R bug. Is there a way to avoid sending Python environment activation commands to terminals created by other extensions?

Related but not the same: #4959

Thank you!

Environment data

  • VS Code version: 1.45.0
  • Extension version (available under the Extensions sidebar): 2020.5.80290
  • OS and version: Ubuntu 18.04
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.6.9
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): venv (but same issue has been observed with conda)
  • Relevant/affected Python packages and their versions: None
  • Relevant/affected Python-related VS Code extensions and their versions: R (Yuki Ueda) 1.3.0
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): Enabled
  • Value of the python.languageServer setting: Microsoft

Expected behaviour

New R console does not contain text like

> source [LOCATION]/python-R-test/env/bin/activate
Error: object 'home' not found'

Actual behaviour

New R console contains text like

> source [LOCATION]/python-R-test/env/bin/activate
Error: object 'home' not found'

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. Install VS Code extension 'R' by Yuki Ueda
  2. Create a folder 'python-R-test' containing empty files 'temp.R' and 'temp.py'.
  3. Create a virtual environment in this folder:
python3 -m venv env
  1. File -> Open Folder..., select 'python-R-test'
  2. Make sure selected Python interpreter is 'env': venv
  3. Use command R: Create R terminal
  4. Observe new R terminal contains text ending in
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[1] TRUE
> source [LOCATION]/python-R-test/env/bin/activate
Error: object 'home' not found
> 

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

output.txt


Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)

console.log

@andycraig andycraig added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels May 23, 2020
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label May 26, 2020
@karrtikr
Copy link

Hi @andycraig 👋
Unfortunately there's VSCode doesn't provide anyway for us to know if terminal is created by another extension, so I've to close this. Feel free to file it as a feature request at https://github.com/microsoft/vscode

You can switch off the extension sending activation commands by using the setting "python.terminal.activateEnvironment": false.

@andycraig
Copy link
Author

@karrtikr Thank you for considering. I have created a feature request for this capability at the VS Code repo: microsoft/vscode#98888

@Tyriar
Copy link
Member

Tyriar commented Jun 3, 2020

The activation should not be done by sending commands, still waiting on adopting of the environment variable collection API which will let the Python extension activate the environment without sending text. #11039

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug
Projects
None yet
Development

No branches or pull requests

4 participants