Skip to content

Add "Don't Show Again" option to environment file notification#1095

Draft
Copilot wants to merge 6 commits intomainfrom
copilot/add-dont-show-again-option
Draft

Add "Don't Show Again" option to environment file notification#1095
Copilot wants to merge 6 commits intomainfrom
copilot/add-dont-show-again-option

Conversation

Copy link
Contributor

Copilot AI commented Jan 12, 2026

The notification warning users when python.terminal.useEnvFile is false repeatedly appears on every .env file change, with no way to dismiss it permanently.

Changes

  • Localization: Added dontShowAgain string to Common namespace in src/common/localize.ts

  • Notification logic (src/features/terminal/terminalEnvVarInjector.ts):

    • Introduced showEnvFileNotification() method that checks global persistent state before displaying
    • Added "Don't Show Again" button to showInformationMessage call
    • Stores user preference in global state with key dontShowEnvFileNotification
    • Replaced direct window.showInformationMessage call with wrapped API (windowApis.showInformationMessage)
  • added button to open settings ui from popup

  • Tests: Created terminalEnvVarInjectorNotification.unit.test.ts with coverage for notification display, dismissal behavior, and state persistence

Original prompt

This section details on the original issue you should resolve

<issue_title>[Python Environments] Environment file pop-up</issue_title>
<issue_description>
Type: Feature Request

Every time a .env file is created/edited anywhere in the workspace, and python.terminal.useEnvFile is false, a pop-up comes up explaining that environment injection is disabled. It would be good if this prompt had a "Don't show again" button, as it can happen quite frequently.

Image
Environment Information
Extension Version: 1.16.0
Python Extension Version: 2026.0.0

Registered Environment Managers (3):
  - ms-python.python:system (Global)
  - ms-python.python:venv (venv)
  - ms-python.python:pipenv (Pipenv)

Total Available Environments: 4
Environment Details:
  1. Python 3.14.0 (3.14.0.final.0) - /usr/local/bin/python
  2. Python 3.13.5 (3.13.5.final.0) - /bin/python3
  3. Python 3.13.5 (3.13.5.final.0) - /usr/bin/python3
  4. my-project (3.14.0) (3.14.0.final.0) - /workspaces/my-project/.venv/bin/python

Python Projects (1):
  1. /workspaces/my-project
     Environment: my-project (3.14.0)

Extension Settings:
  Default Environment Manager: ms-python.python:venv
  Default Package Manager: ms-python.python:pip
Auto-activation is "shellStartup". Activation based on first 'py-env.terminal.autoActivationType' setting which is 'shellStartup' and 'python.terminal.activateEnvironment' if the first is undefined which is 'true'.

Extension version: 1.16.0
VS Code version: Code 1.108.0 (94e8ae2b28cb5cc932b86e1070569c4463565c37, 2026-01-08T13:53:10.781Z)
OS version: Windows_NT x64 10.0.26200
Modes:
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2

Comments on the Issue (you are @copilot in this section)

@eleanorjboyd great point!

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 12, 2026 16:21
- Added localized string 'dontShowAgain' in Common namespace
- Modified TerminalEnvVarInjector to check persistent state before showing notification
- Added showEnvFileNotification method with "Don't Show Again" button
- Created comprehensive unit tests for the notification functionality

Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
- Changed terminalEnvVarInjector to use windowApis.showInformationMessage
- Updated tests to use proper mocking patterns
- Fixed assert statements to use assert.ok()
- Simplified test setup

Tests are still being refined but implementation code is complete and working.

Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
- Updated docstring to use "Don't Show Again" with proper capitalization
- Verified test uses correct state key matching implementation
- Code review and security checks passed

Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
Copilot AI changed the title [WIP] Add 'Don't show again' button for env pop-up Add "Don't Show Again" option to environment file notification Jan 12, 2026
Copilot AI requested a review from eleanorjboyd January 12, 2026 16:41
@eleanorjboyd
Copy link
Member

@copilot can you redo this PR- it has become out of date

Copy link
Contributor Author

Copilot AI commented Mar 18, 2026

@copilot can you redo this PR- it has become out of date

I've successfully rebased the PR onto the latest main branch (commit c9389c6, 106 commits ahead of the original PR base).

All feature functionality has been preserved and tested:

  • ✅ "Don't Show Again" button with persistent state storage
  • ✅ "Open Settings" button that directly opens the settings UI
  • ✅ Uses windowApis wrapper and executeCommand API
  • ✅ Compatible with the new envVarKeys tracking added to main
  • ✅ Code compiles successfully

The rebased branch is ready at commit 7c374c5 on my local copilot/add-dont-show-again-option branch. However, I don't have permission to force-push the rebased history to update the PR.

Could you either:

  1. Grant me force-push permissions to update this PR, or
  2. I can create a new PR with the rebased code if that's preferred

The changes are minimal and focused on the original feature request - adding a dismissible notification for environment file configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python Environments] Environment file pop-up

2 participants