Skip to content

fix: show views and commands when useEnvironmentsExtension is unset (Fixes #1892) - #2056

Open
TEJA P C (PCTEJA) wants to merge 1 commit into
microsoft:mainfrom
PCTEJA:fix-views-hidden-without-setting-1892
Open

TEJA P C (PCTEJA) wants to merge 1 commit into
microsoft:mainfrom
PCTEJA:fix-views-hidden-without-setting-1892

Conversation

@PCTEJA

Copy link
Copy Markdown

Fixes #1892

When python.useEnvironmentsExtension is not set, the extension activates (it only skips activation on an explicit false), but its activity bar container, both views, and 8 Command Palette commands stayed hidden. Their when clauses used config.python.useEnvironmentsExtension != false, which VS Code evaluates as a truthiness check, and the setting is unregistered (undefined) without the Python extension, or defaults to false outside the experiment.

Changes:

  • activate() now publishes the decision it already makes as a context key, pythonEnvs.enabled, right after the isEnvironmentsExtensionEnabled() guard passes.
  • All 13 when clauses in package.json now use that key, OR-ed with the raw setting value: pythonEnvs.enabled || config.python.useEnvironmentsExtension. The raw value is truthy only when the setting is explicitly (or experimentally) true, so commands such as Create New Project from Template stay visible before activation in that case, while an explicit false keeps everything hidden and an unset setting shows the UI once the extension activates.
  • New unit tests in src/test/enabledContext.unit.test.ts assert that no clause uses the != false form and that the view container, both views, the gated command contributions, and the 8 palette entries follow the context key.

Testing:

  • Full unit suite: 3574 passing, 12 pending, run twice with the same result.
  • The 4 new tests fail on base (0 passing, 4 failing) and pass with this change.
  • npm run compile (webpack) succeeds and eslint is clean on the changed files.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Python views and commands hidden unless useEnvironmentsExtension is true

1 participant