microsoft / microsoft/vscode-python-debugger
Autoreload in VS Code Python Debugger Does Not Reflect Code Changes After Breakpoint
@eleanorjboyd 已经在做这个了。
开始于 2025年10月16日。
- 主要语言
- TypeScript
- 星标
- 181
- 派生
- 126
- 平均合并
- 2 天 3 小时
- 30 天内合并 PR
- 3
描述
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
- Enable autoreload in the VS Code Python debugger. This is my
launch.jsonin.vscode.
{
"version": "0.2.0",
"configurations": [
{
"name": "Moo: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"autoReload": {
"enable": true
}
}
]
}
- 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?
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
评估
这个 Issue 还没有评估数据。