microsoft / microsoft/vscode-python-debugger

Debug launch configuration doesn't override Python interpreter

Đang mở
#873 1 bình luận 1 reaction 1 người được giao Xem trên GitHub

@eleanorjboyd đang làm issue này rồi.

Từ ngày 10/11/2025.

triage-needed
Ngôn ngữ chính
TypeScript
Star
181
Fork
126
Merge trung bình
2 ngày 3 giờ
Pull request đã merge (30 ngày)
3

Mô tả

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.105.1 (Universal)
  • OS Version: macOS 26.0.1

Issue:

I am using a multi-root workspace for my monorepo. I am using a monorepo.code-workspace file that roughly looks like the following:

{
  "folders": [
    {
      "name": "root",
      "path": "."
    },
    {
      "name": "service_A",
      "path": "service_A"
    },
    {
      "name": "service_B",
      "path": "service_B"
    },
    {
      "name": "company_python",
      "path": "company_python"
    },
  ],
  "launch": {
    "version": "0.2.0",
    "configurations": [
      {
        "name": "service_A",
        "consoleName": "service_A",
        "type": "debugpy",
        "request": "launch",
        "module": "uvicorn",
        "args": [
          "app.main:app",
          "--reload",
          "--reload-dir",
          "${workspaceFolder:service_A}",
          "--reload-dir",
          "${workspaceFolder:root}/company_python",
        ],
        "justMyCode": true,
        "console": "integratedTerminal",
        "env": {
          "POETRY_ACTIVE": "1",
          "PYTHONPATH": "${workspaceFolder:service_A}:${workspaceFolder:root}/company_python"
        },
        "cwd": "${workspaceFolder:service_A}",
        "python": "${workspaceFolder:service_A}/.venv/bin/python",
        "windows": {
          "python": "${workspaceFolder:service_A}\\.venv\\Scripts\\python.exe"
        }
      },
      {
        "name": "service_B",
        "consoleName": "service_B",
        "type": "debugpy",
        "request": "launch",
        "module": "uvicorn",
        "args": [
          "app.main:app",
          "--port",
          "8001",
          "--reload",
          "--reload-dir",
          "${workspaceFolder:service_B}",
          "--reload-dir",
          "${workspaceFolder:root}/company_python",
        ],
        "justMyCode": true,
        "console": "integratedTerminal",
        "env": {
          "POETRY_ACTIVE": "1",
          "PYTHONPATH": "${workspaceFolder:service_B}:${workspaceFolder:root}/company_python"
        },
        "cwd": "${workspaceFolder:service_B}",
        "python": "${workspaceFolder:service_B}/.venv/bin/python",
        "windows": {
          "python": "${workspaceFolder:service_B}\\.venv\\Scripts\\python.exe"
        }
      }
    ]
  },
  "settings": {
    "files.exclude": {
      "service_A": true,
      "service_B": true
      // "company_python": true,
    },
    "search.exclude": {
      "service_A": true,
      "service_B": true
      // "company_python": true,
    },
    "python.analysis.extraPaths": [
      "${workspaceFolder:root}/company_python"
    ],
    "python.autoComplete.extraPaths": [
      "${workspaceFolder:root}/company_python"
    ]
  }
}

The lines that are important are:

"python": "${workspaceFolder:service_A}/.venv/bin/python",

When I hover over this, it hints at the following:
Image

However, when I launch the debug configuration for either service_A or service_B, it does not use the path I configured in monorepo.code-workspace. Instead, VS Code look at which file is currently open, and checks which interpreter is configured 'locally'.

Image

Even when I clear all settings regarding the interpreters, it still does not use the interpreter that I have configured in the debug launch config.

Steps to Reproduce:

  1. Use the monorepo.code-workspace that I provided above.
  2. Create a .venv for both service_A and service_B.
  3. To make sure this bug occurs, select the correct interpreters for both folders using the command Python: Select Interpreter as shown in the screenshot above.
  4. Have a .py file open that lives in the folder of service_B.
  5. Start the debug configuration for service_A.
  6. Check the integrated terminal to see that the debugger looks at the .venv of service_B.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.