diff --git a/src/client/debugger/extension/configuration/dynamicdebugConfigurationService.ts b/src/client/debugger/extension/configuration/dynamicdebugConfigurationService.ts index 2d80f0e3d6e8..e79f201d9367 100644 --- a/src/client/debugger/extension/configuration/dynamicdebugConfigurationService.ts +++ b/src/client/debugger/extension/configuration/dynamicdebugConfigurationService.ts @@ -69,7 +69,7 @@ export class DynamicPythonDebugConfigurationService implements IDynamicDebugConf type: DebuggerTypeName, request: 'launch', module: 'uvicorn', - args: [`${fastApiPath}:app`], + args: [`${fastApiPath}:app`, '--reload'], jinja: true, justMyCode: true, }); diff --git a/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts b/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts index 25aaf3d25c08..38a9b7ccf1a2 100644 --- a/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts +++ b/src/client/debugger/extension/configuration/providers/fastapiLaunch.ts @@ -25,12 +25,12 @@ export async function buildFastAPILaunchDebugConfiguration( type: DebuggerTypeName, request: 'launch', module: 'uvicorn', - args: ['main:app'], + args: ['main:app', '--reload'], jinja: true, justMyCode: true, }; - if (!application) { + if (!application && config.args) { const selectedPath = await input.showInputBox({ title: DebugConfigStrings.fastapi.enterAppPathOrNamePath.title, value: 'main.py', @@ -44,7 +44,7 @@ export async function buildFastAPILaunchDebugConfiguration( }); if (selectedPath) { manuallyEnteredAValue = true; - config.args = [`${path.basename(selectedPath, '.py').replace('/', '.')}:app`]; + config.args[0] = `${path.basename(selectedPath, '.py').replace('/', '.')}:app`; } } diff --git a/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts b/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts index f6c20985e4da..80ce37167024 100644 --- a/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts @@ -53,7 +53,7 @@ suite('Debugging - Configuration Provider FastAPI', () => { type: DebuggerTypeName, request: 'launch', module: 'uvicorn', - args: ['main:app'], + args: ['main:app', '--reload'], jinja: true, justMyCode: true, }; @@ -73,7 +73,7 @@ suite('Debugging - Configuration Provider FastAPI', () => { type: DebuggerTypeName, request: 'launch', module: 'uvicorn', - args: ['main:app'], + args: ['main:app', '--reload'], jinja: true, justMyCode: true, };