microsoft / microsoft/vscode-python-environments
Feature Request: Easily Add Folder to PYTHONPATH from VS Code UI
还没有人认领这个 Issue。
- 主要语言
- TypeScript
- 星标
- 138
- 派生
- 62
- 平均合并
- 1 天 4 小时
- 30 天内合并 PR
- 35
描述
Hi, I’m not sure if this belongs here or in [vscode-python](https://github.com/microsoft/vscode-python), but I’d like to request a more user-friendly way to add folders to the Python path in VS Code.
### Current Situation
- The `python.analysis.extraPaths` setting only affects IntelliSense, not the runtime `PYTHONPATH`.
- Using a `.env` file with `PYTHONPATH=path1;path2;path3` is unreliable (in my experience) and not user-friendly.
- **Creating a `.pth` file in `.venv/Lib/site-packages/` as below works, but is also tedious and not user-friendly.**
```
path1/src/
path2/src/
...
```
### Feature Proposal
It would be very helpful to have:
- A context menu command when right-clicking a folder (e.g., “Add to Python Path”)
- An accessible command in the Command Palette (`Ctrl+Shift+P`)
- A button in the python-environments extension UI (it would be very intuitive to have a small icon/button next to each venv in the list. Clicking this button could prompt the user to select a folder, and then automatically add that folder to the venv using the `.pth` method.)
This should add the folder to the Python path of the currently selected virtual environment in VS Code.
This would make managing the Python path much easier, especially for users coming from PyCharm, where this is a standard feature.
Thanks!
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
该 issue 未指定文件、测试或实现入口;首先确定这属于 vscode-python 还是 vscode-python-environments,并检查现有的环境 UI 和命令注册。要视为完成,需要确定范围,并提供一种面向用户的方式,将选定的文件夹添加到当前选定的虚拟环境的 Python 路径中。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python, vscode
- 领域
- developer-experience, tooling
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 25/100