Skip to content

Commit b4a47bb

Browse files
Add reload flag on fastApi provider (#21241)
1 parent fcfc54c commit b4a47bb

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/client/debugger/extension/configuration/dynamicdebugConfigurationService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ export class DynamicPythonDebugConfigurationService implements IDynamicDebugConf
6969
type: DebuggerTypeName,
7070
request: 'launch',
7171
module: 'uvicorn',
72-
args: [`${fastApiPath}:app`],
72+
args: [`${fastApiPath}:app`, '--reload'],
7373
jinja: true,
7474
justMyCode: true,
7575
});

src/client/debugger/extension/configuration/providers/fastapiLaunch.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ export async function buildFastAPILaunchDebugConfiguration(
2525
type: DebuggerTypeName,
2626
request: 'launch',
2727
module: 'uvicorn',
28-
args: ['main:app'],
28+
args: ['main:app', '--reload'],
2929
jinja: true,
3030
justMyCode: true,
3131
};
3232

33-
if (!application) {
33+
if (!application && config.args) {
3434
const selectedPath = await input.showInputBox({
3535
title: DebugConfigStrings.fastapi.enterAppPathOrNamePath.title,
3636
value: 'main.py',
@@ -44,7 +44,7 @@ export async function buildFastAPILaunchDebugConfiguration(
4444
});
4545
if (selectedPath) {
4646
manuallyEnteredAValue = true;
47-
config.args = [`${path.basename(selectedPath, '.py').replace('/', '.')}:app`];
47+
config.args[0] = `${path.basename(selectedPath, '.py').replace('/', '.')}:app`;
4848
}
4949
}
5050

src/test/debugger/extension/configuration/providers/fastapiLaunch.unit.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ suite('Debugging - Configuration Provider FastAPI', () => {
5353
type: DebuggerTypeName,
5454
request: 'launch',
5555
module: 'uvicorn',
56-
args: ['main:app'],
56+
args: ['main:app', '--reload'],
5757
jinja: true,
5858
justMyCode: true,
5959
};
@@ -73,7 +73,7 @@ suite('Debugging - Configuration Provider FastAPI', () => {
7373
type: DebuggerTypeName,
7474
request: 'launch',
7575
module: 'uvicorn',
76-
args: ['main:app'],
76+
args: ['main:app', '--reload'],
7777
jinja: true,
7878
justMyCode: true,
7979
};

0 commit comments

Comments
 (0)