microsoft / microsoft/vscode-python-debugger

Autoreload in VS Code Python Debugger Does Not Reflect Code Changes After Breakpoint

Aberta
#821 1 comentário 0 reações 1 responsável Ver no GitHub

@eleanorjboyd já está trabalhando nisso.

Desde 16/10/2025.

triage-needed
Linguagem predominante
TypeScript
Estrelas
181
Forks
126
Merge médio
2d 3h
PRs com merge (30d)
3

Descrição

Description

I’m trying to use the autoreload feature described in here to enable a dynamic, interactive debugging experience.

Goal:

Allow users to modify code after hitting a breakpoint—before those lines have executed—and have those changes reflected in the debugger as if they were present from the start.
Based on the documentation, I believe autoreload should support this behavior.

Steps to Reproduce

  1. Enable autoreload in the VS Code Python debugger. This is my launch.json in .vscode.
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Moo: Current File",
            "type": "debugpy",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "autoReload": {
            "enable": true
            }
        }
    ]
}
  1. Start a debugging script in the VS Code editor debugger (via the Run and Debug panel), not the Debug Console with the following sequence:
if __name__=="__main__"
    print('Moo') # Breakpoint here at the start
    print('Baa') # Breakpoint here at the start
    
    #print('Roar') # Uncomment these two lines when at the 'Baa' breakpoint, but before executing 'Baa'
    #print('Woof') # Uncomment these two lines when at the 'Baa' breakpoint, but before executing 'Baa'
    
    print('Quack') # Breakpoint here at the start
    print('Meow') # Breakpoint here at the start
    print('Done') # Breakpoint here at the start

Expected Behavior

The newly added lines should execute as if they were part of the original script when the debugger resumes.

Moo
Baa
Roar
Woof
Quack
Meow
Done

Actual Behavior

The output is

Moo
Baa
Quack
Meow
Done

The two added lines during debugging are ignored.

Environment

VS Code Version: 1.104.3
Python extension for VS Code: 2025.14.0
Python Debugger extension for VS Code:
2025.10.0
Python version: 3.12.10
OS: Windows_NT x64 10.0.26100

Question

Am I using autoreload incorrectly, or is this a bug in the debugger?

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.