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

Inserting Activate.ps1 command into extension contributed terminals #24061

Closed
paulober opened this issue Sep 6, 2024 · 4 comments
Closed

Inserting Activate.ps1 command into extension contributed terminals #24061

paulober opened this issue Sep 6, 2024 · 4 comments
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@paulober
Copy link

paulober commented Sep 6, 2024

Type: Bug

Behaviour

Currently I have selected a .venv in my project folder created by the Python extension.
The problem now is I have a custom PTY extension terminal profile contributed by a different extension. But if it opens the Python extension automatically inserts: & C:/mypath/Activate.ps1\r which is not good for my custom terminal profiles as they aren't even running in a local env.

Steps to reproduce:

  1. Install any extension that contributes a custom terminal profile (and has the Python extension as dependency) <- maybe also related. Like for example the MicroPico extension
  2. Open a python project that will trigger your other extension to automatically open it's terminal. (make sure before you have generated a venv in this folder with the python extesnion and selected it). The python extension will now automatically insert this Activate.ps1 into the terminal. (i guess you hook into the onDidTerminalOpen event in vscode and randomly insert these things)

Diagnostic data

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

XXX

Behaviour

XXX

Steps to reproduce:

  1. XXX

Diagnostic data

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

XXX

Extension version: 2024.14.0
VS Code version: Code 1.93.0 (4849ca9bdf9666755eb463db297b69e5385090e3, 2024-09-04T13:02:38.431Z)
OS version: Windows_NT x64 10.0.22631
Modes:

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


languageServer: "Pylance"

Installed Extensions
Extension Name Extension Id Version
.NET Install Tool ms-dotnettools.vscode-dotnet-runtime 2.1.5
.NET MAUI ms-dotnettools.dotnet-maui 1.2.15
Arm Assembly dan-c-underwood.arm 1.7.4
Atom One Dark Theme akamud.vscode-theme-onedark 2.3.0
autopep8 ms-python.autopep8 2024.0.0
Bedrock Definitions destruc7i0n.vscode-bedrock-definitions 2.0.8
C/C++ ms-vscode.cpptools 1.21.6
C/C++ Extension Pack ms-vscode.cpptools-extension-pack 1.3.0
C/C++ Themes ms-vscode.cpptools-themes 2.0.0
C# ms-dotnettools.csharp 2.45.17
C# Dev Kit ms-dotnettools.csdevkit 1.10.16
Cheetah jackguy.cheetah 0.0.1
CMake twxs.cmake 0.0.17
CodeLLDB vadimcn.vscode-lldb 1.10.0
Cortex-Debug marus25.cortex-debug 1.12.1
Dart Dart-Code.dart-code 3.96.0
debug-tracker-vscode mcu-debug.debug-tracker-vscode 0.0.15
Dev Containers ms-vscode-remote.remote-containers 0.384.0
DeviceTree plorefice.devicetree 0.1.1
Docker ms-azuretools.vscode-docker 1.29.2
Doxygen Documentation Generator cschlosser.doxdocgen 1.4.0
DupChecker jianbingfang.dupchecker 0.1.7
EditorConfig for VS Code EditorConfig.EditorConfig 0.16.4
ES7+ React/Redux/React-Native snippets dsznajder.es7-react-js-snippets 4.4.3
ESLint dbaeumer.vscode-eslint 3.0.10
Even Better TOML tamasfe.even-better-toml 0.19.2
file-icons file-icons.file-icons 1.1.0
Flipper Application Development paulober.flipper-app-dev 0.1.0
Flow Language Support flowtype.flow-for-vscode 2.2.1
German Language Pack for Visual Studio Code MS-CEINTL.vscode-language-pack-de 1.93.2024090409
GitHub Actions github.vscode-github-actions 0.26.3
GitHub Copilot GitHub.copilot 1.229.0
GitHub Copilot Chat GitHub.copilot-chat 0.20.0
GitHub Theme GitHub.github-vscode-theme 6.3.4
GitLens — Git supercharged eamodio.gitlens 15.4.0
GraphQL: Language Feature Support GraphQL.vscode-graphql 0.12.0
GraphQL: Syntax Highlighting GraphQL.vscode-graphql-syntax 1.3.6
Hex Editor ms-vscode.hexeditor 1.10.0
HTML CSS Support ecmel.vscode-html-css 2.0.10
IntelliCode VisualStudioExptTeam.vscodeintellicode 1.3.1
isort ms-python.isort 2023.10.1
JavaScript and TypeScript Nightly ms-vscode.vscode-typescript-next 5.7.20240904
JavaScript Debugger ms-vscode.js-debug 1.93.0
JavaScript Debugger Companion Extension ms-vscode.js-debug-companion 1.1.3
Jupyter Keymap ms-toolsai.jupyter-keymap 1.1.2
LaTeX Workshop James-Yu.latex-workshop 10.2.1
Live Share ms-vsliveshare.vsliveshare 1.0.5936
Makefile Tools ms-vscode.makefile-tools 0.11.7
Markdown Preview Mermaid Support bierner.markdown-mermaid 1.24.0
Material Icon Theme PKief.material-icon-theme 5.10.0
Material Theme Icons — Free equinusocio.vsc-material-theme-icons 3.8.8
MemoryView mcu-debug.memory-view 0.0.25
MicroPico paulober.pico-w-go 4.0.0
Monokai Pro monokai.theme-monokai-pro-vscode 1.3.2
One Dark Pro zhuangtongfa.material-theme 3.17.2
Peripheral Viewer mcu-debug.peripheral-viewer 1.4.6
PHP Debug xdebug.php-debug 1.35.0
PHP Extension Pack xdebug.php-pack 1.0.3
PowerShell ms-vscode.powershell 2024.2.2
Prettier - Code formatter esbenp.prettier-vscode 11.0.0
Pylance ms-python.vscode-pylance 2024.8.2
Python ms-python.python 2024.14.0
Python Debugger ms-python.debugpy 2024.10.0
Python MANIFEST.in benspaulding.python-manifest-template 1.0.1
Rainbow CSV mechatroner.rainbow-csv 3.12.0
Raspberry Pi Pico raspberry-pi.raspberry-pi-pico 0.15.2
Red Hat Commons redhat.vscode-commons 0.0.6
REDmodScript Lang alternaut-dev.redmodscript-lang 0.2.0
Redscript Syntax Highlighting jackhumbert.redscript-syntax-highlighting 0.0.3
REG ionutvmi.reg 1.1.0
Remote - SSH ms-vscode-remote.remote-ssh 0.114.1
Remote - SSH: Editing Configuration Files ms-vscode-remote.remote-ssh-edit 0.86.0
RISC-V Venus Simulator hm.riscv-venus 1.9.1
Rollup Problem Matcher paulober.rollup-problem-matcher 0.1.0
RTOS Views mcu-debug.rtos-views 0.0.7
Serial Monitor ms-vscode.vscode-serial-monitor 0.12.0
Shader languages support for VS Code slevesque.shader 1.1.5
Swift sswg.swift-lang 1.11.0
syntax-mcfunction MinecraftCommands.syntax-mcfunction 1.0.0
systemd-unit-file coolbear.systemd-unit-file 1.0.6
Table Visualizer for JavaScript Profiles ms-vscode.vscode-js-profile-table 1.0.9
Tailwind CSS IntelliSense bradlc.vscode-tailwindcss 0.12.10
Trigger Task on Save Gruntfuggly.triggertaskonsave 0.2.17
TypeScript + Webpack Problem Matchers amodio.tsl-problem-matcher 0.6.2
vscode-icons vscode-icons-team.vscode-icons 12.8.0
WebAssembly dtsvet.vscode-wasm 1.4.1
x86 and x86_64 Assembly 13xforever.language-x86-64-assembly 3.1.4
XML Tools DotJoshJohnson.xml 2.5.1
YAML redhat.vscode-yaml 1.15.0
ZipFS - a zip file system arcanis.vscode-zipfs 3.0.0
System Info
Item Value
CPUs 13th Gen Intel(R) Core(TM) i7-13620H (16 x 2918)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled
webnn: disabled_off
Load (avg) undefined
Memory (System) 15.68GB (1.16GB free)
Process Argv .
Screen Reader no
VM 0%
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Sep 6, 2024
@karthiknadig
Copy link
Member

@paulober You can disable activation, by setting these off:
image

There is no way to tell which extension created which terminal to filter things out. There are other extensions that expect that activations occur when a terminal is created, then there are extensions that expect that activations don't happen. So, the way we handle this is via the settings above, if you have them on, then any terminal created by extension would be activated.

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 6, 2024
@paulober
Copy link
Author

paulober commented Sep 6, 2024

Ok, thanks for the response, so my only option is to edit the users global setting to disable this "Activate in all environments" setting before automatically opening the terminal?

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Sep 6, 2024
@karthiknadig
Copy link
Member

You should be able to disable this at the workspace level, if there is a specific project that you need to do this with. But, if the common pattern in your workflow involves using custom terminals, then you can turn this off globally and activate environments via command line.

I think there is a good feature here to allow toggling the activation.

@paulober
Copy link
Author

paulober commented Sep 6, 2024

Ok thanks. Actually i'm the dev of this custom terminal. So i probably and the generated projects rely on the Python extension so I probably will add this setting like you suggested to every generated .vscode/settings.json so per workspace folder.

Thanks for the help.

@paulober paulober closed this as completed Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants