microsoft / microsoft/vscode-python-environments

`python-envs.terminal.autoActivationType` migration script incorrectly targets Workspace settings instead of User settings

未關閉
#1,608 0 則留言 1 個 reaction 已指派 2 人 在 GitHub 檢視

@StellaHuang95 已經在處理了。

開始於 2026年6月24日。

主要語言
TypeScript
星號
138
分支
62
平均合併
1 天 4 小時
30 天內合併 PR
35

描述

## Environment data

- Python Environments extension version: 1.37.2026062401
- Python extension (ms-python.python) version: 2026.4.0
- VS Code version (Help -> About): 1.126.0
- OS and version: Win 11
- Python version (& distribution if applicable, e.g. Anaconda): Different CPython versions managed with Pyenv.
- Environment manager in use (venv / conda / pyenv / poetry / pipenv / system / uv / other): pyenv, pipenv, uv, venv, poetry...
- Shell (bash / zsh / fish / pwsh / cmd / other): bash, pwshell
- Remote / container scenario (none / WSL / SSH Remote / Dev Container / Codespaces): none
- Workspace type (single folder / multi-root / mono-repo): single folder multi repo
- Is this a regression? If yes, last known working extension version: No afaik

## Repro Steps

1. Configure legacy Python terminal activation settings to be disabled (off or none).
* "python.terminal.activateEnvironment": false,
2. Open a project workspace folder.
3. Check Extension Host Output channel.

## Expected behavior

The settings migration logic should evaluate target permissions and write the updated `python-envs.terminal.autoActivationType` key directly to the global User Settings.

Extension setting *"Docstring"*:
> **Legacy Setting Support**: This setting takes precedence over the legacy `python.terminal.activateEnvironment` setting.
> **If this setting is not explicitly set and `python.terminal.activateEnvironment` is set to false, this setting will
> automatically be set to `off` to preserve your preference.**

## Actual behavior

The extension migration routine incorrectly targets the local workspace configuration scope rather than the user scope. Because VS Code explicitly bans this particular property from living inside local workspaces for security/stability profiles, it hard-blocks the save execution and triggers the following ERROR:

```log
CodeExpectedError: Unable to write python-envs.terminal.autoActivationType to Workspace Settings.
This setting can be written only into User settings.
```

## Logs

Logs from `Extension Host` output channel:
```log
2026-06-24 21:21:26.780 [error] CodeExpectedError: Unable to write python-envs.terminal.autoActivationType to Workspace Settings. This setting can be written only into User settings.
at M4e.toConfigurationEditingError (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:7060)
at M4e.validate (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:10319)
at M4e.doWriteConfiguration (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3453)
at Object.factory (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3309)
at dg.consume (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77539)
at vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77358
at new Promise ()
at dg.queue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77282)
at M4e.writeConfiguration (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3278)
at eoi.writeConfigurationValue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:60043)
at async Promise.all (index 0)
at async Object.a [as settled] (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:84659)
at async eoi.updateValue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:43135)
2026-06-24 21:21:26.780 [error] CodeExpectedError: Unable to write python-envs.terminal.autoActivationType to Workspace Settings. This setting can be written only into User settings.
at M4e.toConfigurationEditingError (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:7060)
at M4e.validate (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:10319)
at M4e.doWriteConfiguration (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3453)
at Object.factory (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3309)
at dg.consume (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77539)
at vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77358
at new Promise ()
at dg.queue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:77282)
at M4e.writeConfiguration (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:3278)
at eoi.writeConfigurationValue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:60043)
at async Promise.all (index 0)
at async Object.a [as settled] (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:434:84659)
at async eoi.updateValue (vscode-file://vscode-app/d:/Program%20Files/VS%20Code/7e7950df89/resources/app/out/vs/workbench/workbench.desktop.main.js:5136:43135)
```

## Additional context

Manual Fix:
The exception loop can be completely stopped by opening the global user configuration and adding the setting manually:

```json
"python-envs.terminal.autoActivationType": "off"
```

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。