microsoft / microsoft/vscode-python-environments

Feature Request: Easily Add Folder to PYTHONPATH from VS Code UI

未關閉
#735 5 則留言 16 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

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

描述

Hi, I’m not sure if this belongs here or in 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!

貢獻指南

開啟貢獻指南

從這裡開始

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

研究方向

該 issue 未指定檔案、測試或實作進入點;首先確定這屬於 vscode-python 還是 vscode-python-environments,並檢查現有的環境 UI 和命令註冊。要視為完成,需要確定範圍,並提供一種面向使用者的方式,將選取的資料夾新增至目前選取的虛擬環境的 Python 路徑中。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
python, vscode
領域
developer-experience, tooling
Issue 類型
功能
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
需要釐清
新手友好度
25/100

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

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