From 61229b85ebb48972b1e0faee662b99d4b59db8eb Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Thu, 21 Mar 2024 14:45:38 -0700 Subject: [PATCH 1/6] Add flask config --- src/extension/common/utils/localize.ts | 8 +- .../configuration/providers/flaskLaunch.ts | 74 +++++++---------- .../flaskProviderQuickPick.ts | 82 +++++++++++++++++++ .../configuration/utils/configuration.ts | 4 +- 4 files changed, 122 insertions(+), 46 deletions(-) create mode 100644 src/extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick.ts diff --git a/src/extension/common/utils/localize.ts b/src/extension/common/utils/localize.ts index 5ed37ca7..409d9b2d 100644 --- a/src/extension/common/utils/localize.ts +++ b/src/extension/common/utils/localize.ts @@ -101,7 +101,7 @@ export namespace DebugConfigStrings { export const djangoConfigPromp = { title: l10n.t('Debug Django'), prompt: l10n.t( - "Enter the path to manage.py or select a file from the list ('${workspaceFolderToken}' points to the root of the current workspace folder)", + "Enter the path to manage.py or select a file from the list.", ), }; } @@ -132,6 +132,12 @@ export namespace DebugConfigStrings { prompt: l10n.t('Python Debugger: Flask'), invalid: l10n.t('Enter a valid name'), }; + export const flaskConfigPromp = { + title: l10n.t('Debug Flask'), + prompt: l10n.t( + "Enter the path to app.py or select a file from the list", + ), + }; } export namespace pyramid { export const snippet = { diff --git a/src/extension/debugger/configuration/providers/flaskLaunch.ts b/src/extension/debugger/configuration/providers/flaskLaunch.ts index bd64bdc0..f3882dbd 100644 --- a/src/extension/debugger/configuration/providers/flaskLaunch.ts +++ b/src/extension/debugger/configuration/providers/flaskLaunch.ts @@ -5,29 +5,34 @@ 'use strict'; import * as path from 'path'; -import * as fs from 'fs-extra'; -import { WorkspaceFolder } from 'vscode'; +import { Uri } from 'vscode'; import { DebugConfigStrings } from '../../../common/utils/localize'; import { MultiStepInput } from '../../../common/multiStepInput'; -import { sendTelemetryEvent } from '../../../telemetry'; -import { EventName } from '../../../telemetry/constants'; import { DebuggerTypeName } from '../../../constants'; import { LaunchRequestArguments } from '../../../types'; -import { DebugConfigurationState, DebugConfigurationType } from '../../types'; +import { DebugConfigurationState } from '../../types'; +import { getFlaskPaths } from '../utils/configuration'; +import { QuickPickType } from './providerQuickPick/types'; +import { goToFileButton } from './providerQuickPick/providerQuickPick'; +import { parseFlaskPath, pickFlaskPrompt } from './providerQuickPick/flaskProviderQuickPick'; export async function buildFlaskLaunchDebugConfiguration( input: MultiStepInput, state: DebugConfigurationState, ): Promise { - const application = await getApplicationPath(state.folder); - let manuallyEnteredAValue: boolean | undefined; + + let flaskPaths = await getFlaskPaths(state.folder); + let options: QuickPickType[] = []; + + // const application = await getApplicationPath(state.folder); + // let manuallyEnteredAValue: boolean | undefined; const config: Partial = { name: DebugConfigStrings.flask.snippet.name, type: DebuggerTypeName, request: 'launch', module: 'flask', env: { - FLASK_APP: application || 'app.py', + FLASK_APP: 'app.py', FLASK_DEBUG: '1', }, args: ['run', '--no-debugger', '--no-reload'], @@ -35,40 +40,23 @@ export async function buildFlaskLaunchDebugConfiguration( autoStartBrowser: false, }; - if (!application) { - const selectedApp = await input.showInputBox({ - title: DebugConfigStrings.flask.enterAppPathOrNamePath.title, - value: 'app.py', - prompt: DebugConfigStrings.flask.enterAppPathOrNamePath.prompt, - validate: (value) => - Promise.resolve( - value && value.trim().length > 0 - ? undefined - : DebugConfigStrings.flask.enterAppPathOrNamePath.invalid, - ), + //add found paths to options + if (flaskPaths.length > 0) { + options.push( + ...flaskPaths.map((item) => ({ + label: path.basename(item.fsPath), + filePath: item, + description: parseFlaskPath(state.folder, item.fsPath), + buttons: [goToFileButton], + })), + ); + } else { + const managePath = path.join(state?.folder?.uri.fsPath || '', 'app.py'); + options.push({ + label: 'Default', + description: parseFlaskPath(state.folder, managePath), + filePath: Uri.file(managePath), }); - if (selectedApp) { - manuallyEnteredAValue = true; - config.env!.FLASK_APP = selectedApp; - } else { - return; - } - } - - sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { - configurationType: DebugConfigurationType.launchFlask, - autoDetectedFlaskAppPyPath: !!application, - manuallyEnteredAValue, - }); - Object.assign(state.config, config); -} -export async function getApplicationPath(folder: WorkspaceFolder | undefined): Promise { - if (!folder) { - return undefined; - } - const defaultLocationOfManagePy = path.join(folder.uri.fsPath, 'app.py'); - if (await fs.pathExists(defaultLocationOfManagePy)) { - return 'app.py'; } - return undefined; -} + await input.run((_input, state) => pickFlaskPrompt(input, state, config, options), state); +} diff --git a/src/extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick.ts b/src/extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick.ts new file mode 100644 index 00000000..5dda5fc0 --- /dev/null +++ b/src/extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick.ts @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +import * as path from 'path'; +import { window, QuickPickItemButtonEvent, QuickPickItemKind, WorkspaceFolder } from 'vscode'; +import { IQuickPickParameters, InputFlowAction, MultiStepInput } from '../../../../common/multiStepInput'; +import { LaunchRequestArguments } from '../../../../types'; +import { DebugConfigurationState, DebugConfigurationType } from '../../../types'; +import { QuickPickType } from './types'; +import { browseFileOption, openFileExplorer } from './providerQuickPick'; +import { DebugConfigStrings } from '../../../../common/utils/localize'; +import { sendTelemetryEvent } from '../../../../telemetry'; +import { EventName } from '../../../../telemetry/constants'; + +export const workspaceFolderToken = '${workspaceFolder}'; + +export async function pickFlaskPrompt( + input: MultiStepInput, + state: DebugConfigurationState, + config: Partial, + pathsOptions: QuickPickType[], +) { + let options: QuickPickType[] = [ + ...pathsOptions, + { label: '', kind: QuickPickItemKind.Separator }, + browseFileOption, + ]; + + const selection = await input.showQuickPick>({ + placeholder: DebugConfigStrings.django.djangoConfigPromp.prompt, + items: options, + acceptFilterBoxTextAsSelection: true, + activeItem: options[0], + matchOnDescription: true, + title: DebugConfigStrings.django.djangoConfigPromp.title, + onDidTriggerItemButton: async (e: QuickPickItemButtonEvent) => { + if (e.item && 'filePath' in e.item) { + await window.showTextDocument(e.item.filePath, { preview: true }); + } + }, + }); + + if (selection === undefined) { + return; + } else if (selection.label === browseFileOption.label) { + const uris = await openFileExplorer(state.folder?.uri); + if (uris && uris.length > 0) { + config.env!.FLASK_APP = parseFlaskPath(state.folder, uris[0].fsPath); + sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { + configurationType: DebugConfigurationType.launchFlask, + browsefilevalue: true, + }); + } else { + return Promise.reject(InputFlowAction.resume); + } + } else if (typeof selection === 'string') { + config.env!.FLASK_APP = selection; + sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { + configurationType: DebugConfigurationType.launchFlask, + manuallyEnteredAValue: true, + }); + } else { + config.env!.FLASK_APP = selection.description; + sendTelemetryEvent(EventName.DEBUGGER_CONFIGURATION_PROMPTS, undefined, { + configurationType: DebugConfigurationType.launchFlask, + autoDetectedFlaskAppPyPath: true, + }); + } + Object.assign(state.config, config); +} + +export function parseFlaskPath(folder: WorkspaceFolder | undefined, flaskPath: string): string | undefined { + if (!folder) { + return flaskPath; + } + const baseManagePath = path.relative(folder.uri.fsPath, flaskPath); + if (baseManagePath && !baseManagePath.startsWith('..')) { + return baseManagePath; + } else { + return flaskPath; + } +} diff --git a/src/extension/debugger/configuration/utils/configuration.ts b/src/extension/debugger/configuration/utils/configuration.ts index 67f296ab..a3af3681 100644 --- a/src/extension/debugger/configuration/utils/configuration.ts +++ b/src/extension/debugger/configuration/utils/configuration.ts @@ -70,7 +70,7 @@ export async function getDjangoPaths(folder: WorkspaceFolder | undefined): Promi export async function getFastApiPaths(folder: WorkspaceFolder | undefined) { if (!folder) { - return undefined; + return []; } const regExpression = /app\s*=\s*FastAPI\(/; const fastApiPaths = await getPossiblePaths( @@ -83,7 +83,7 @@ export async function getFastApiPaths(folder: WorkspaceFolder | undefined) { export async function getFlaskPaths(folder: WorkspaceFolder | undefined) { if (!folder) { - return undefined; + return []; } const regExpression = /app(?:lication)?\s*=\s*(?:flask\.)?Flask\(|def\s+(?:create|make)_app\(/; const flaskPaths = await getPossiblePaths( From fc9b82b14d6eb447febdf4c426162f034fbf9264 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Thu, 21 Mar 2024 14:48:15 -0700 Subject: [PATCH 2/6] fix test and strings --- .../flaskProviderQuickPick.ts | 6 +- .../providers/flaskLaunch.unit.test.ts | 106 ++++++++---------- .../flaskProviderQuickPick.unit.test.ts | 47 ++++++++ 3 files changed, 96 insertions(+), 63 deletions(-) create mode 100644 src/test/unittest/configuration/providers/providerQuickPick/flaskProviderQuickPick.unit.test.ts diff --git a/src/extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick.ts b/src/extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick.ts index 5dda5fc0..6dfd3b27 100644 --- a/src/extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick.ts +++ b/src/extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick.ts @@ -12,8 +12,6 @@ import { DebugConfigStrings } from '../../../../common/utils/localize'; import { sendTelemetryEvent } from '../../../../telemetry'; import { EventName } from '../../../../telemetry/constants'; -export const workspaceFolderToken = '${workspaceFolder}'; - export async function pickFlaskPrompt( input: MultiStepInput, state: DebugConfigurationState, @@ -27,12 +25,12 @@ export async function pickFlaskPrompt( ]; const selection = await input.showQuickPick>({ - placeholder: DebugConfigStrings.django.djangoConfigPromp.prompt, + placeholder: DebugConfigStrings.flask.flaskConfigPromp.prompt, items: options, acceptFilterBoxTextAsSelection: true, activeItem: options[0], matchOnDescription: true, - title: DebugConfigStrings.django.djangoConfigPromp.title, + title: DebugConfigStrings.flask.flaskConfigPromp.title, onDidTriggerItemButton: async (e: QuickPickItemButtonEvent) => { if (e.item && 'filePath' in e.item) { await window.showTextDocument(e.item.filePath, { preview: true }); diff --git a/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts b/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts index 7fd6f1ea..85577cfc 100644 --- a/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts +++ b/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts @@ -7,85 +7,73 @@ import { expect } from 'chai'; import * as path from 'path'; import * as fs from 'fs-extra'; import * as sinon from 'sinon'; -import { anything, instance, mock, when } from 'ts-mockito'; -import { Uri } from 'vscode'; -import { DebugConfigStrings } from '../../../../extension/common/utils/localize'; -import { DebuggerTypeName } from '../../../../extension/constants'; +import * as typemoq from 'typemoq'; +import { ThemeIcon, Uri } from 'vscode'; import { DebugConfigurationState } from '../../../../extension/debugger/types'; import * as flaskLaunch from '../../../../extension/debugger/configuration/providers/flaskLaunch'; import { MultiStepInput } from '../../../../extension/common/multiStepInput'; +import * as configuration from '../../../../extension/debugger/configuration/utils/configuration'; +import * as flaskProviderQuickPick from '../../../../extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick'; + suite('Debugging - Configuration Provider Flask', () => { let pathExistsStub: sinon.SinonStub; - let input: MultiStepInput; + let multiStepInput: typemoq.IMock>; + let getFlaskPathsStub: sinon.SinonStub; + let pickFlaskPromptStub: sinon.SinonStub; + setup(() => { - input = mock>(MultiStepInput); pathExistsStub = sinon.stub(fs, 'pathExists'); + multiStepInput = typemoq.Mock.ofType>(); + multiStepInput + .setup((i) => i.run(typemoq.It.isAny(), typemoq.It.isAny())) + .returns((callback, _state) => callback()); + getFlaskPathsStub = sinon.stub(configuration, 'getFlaskPaths'); + pickFlaskPromptStub = sinon.stub(flaskProviderQuickPick, 'pickFlaskPrompt'); }); teardown(() => { sinon.restore(); }); - test("getApplicationPath should return undefined if file doesn't exist", async () => { - const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; - const appPyPath = path.join(folder.uri.fsPath, 'app.py'); - pathExistsStub.withArgs(appPyPath).resolves(false); - const file = await flaskLaunch.getApplicationPath(folder); - - expect(file).to.be.equal(undefined, 'Should return undefined'); - }); - test('getApplicationPath should file path', async () => { - const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; - const appPyPath = path.join(folder.uri.fsPath, 'app.py'); - pathExistsStub.withArgs(appPyPath).resolves(true); - const file = await flaskLaunch.getApplicationPath(folder); - - expect(file).to.be.equal('app.py'); - }); - test('Launch JSON with selected app path', async () => { + test('Show picker and send parsed found flask paths', async () => { const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; const state = { config: {}, folder }; - - when(input.showInputBox(anything())).thenResolve('hello'); - - await flaskLaunch.buildFlaskLaunchDebugConfiguration(instance(input), state); - - const config = { - name: DebugConfigStrings.flask.snippet.name, - type: DebuggerTypeName, - request: 'launch', - module: 'flask', - env: { - FLASK_APP: 'hello', - FLASK_DEBUG: '1', + const appPath = Uri.file(path.join(folder.uri.fsPath, 'app.py')); + getFlaskPathsStub.resolves([appPath]); + pickFlaskPromptStub.resolves(); + await flaskLaunch.buildFlaskLaunchDebugConfiguration(multiStepInput.object, state); + const options = pickFlaskPromptStub.getCall(0).args[3]; + const expectedOptions = [ + { + label: path.basename(appPath.fsPath), + filePath: appPath, + description: "app.py", + buttons: [ + { + iconPath: new ThemeIcon('go-to-file'), + tooltip: `Open in Preview`, + }, + ], }, - args: ['run', '--no-debugger', '--no-reload'], - jinja: true, - autoStartBrowser: false, - }; + ]; - expect(state.config).to.be.deep.equal(config); + expect(options).to.be.deep.equal(expectedOptions); }); - test('Launch JSON with default managepy path', async () => { + test('Show picker and send default app.py path', async () => { const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; const state = { config: {}, folder }; - when(input.showInputBox(anything())).thenResolve('app.py'); - - await flaskLaunch.buildFlaskLaunchDebugConfiguration(instance(input), state); - - const config = { - name: DebugConfigStrings.flask.snippet.name, - type: DebuggerTypeName, - request: 'launch', - module: 'flask', - env: { - FLASK_APP: 'app.py', - FLASK_DEBUG: '1', + const appPath = path.join(state?.folder?.uri.fsPath, 'app.py'); + getFlaskPathsStub.resolves([]); + pickFlaskPromptStub.resolves(); + await flaskLaunch.buildFlaskLaunchDebugConfiguration(multiStepInput.object, state); + const options = pickFlaskPromptStub.getCall(0).args[3]; + const expectedOptions = [ + { + label: 'Default', + filePath: Uri.file(appPath), + description: "app.py", }, - args: ['run', '--no-debugger', '--no-reload'], - jinja: true, - autoStartBrowser: false, - }; + ]; - expect(state.config).to.be.deep.equal(config); + expect(options).to.be.deep.equal(expectedOptions); }); }); diff --git a/src/test/unittest/configuration/providers/providerQuickPick/flaskProviderQuickPick.unit.test.ts b/src/test/unittest/configuration/providers/providerQuickPick/flaskProviderQuickPick.unit.test.ts new file mode 100644 index 00000000..f0d23c01 --- /dev/null +++ b/src/test/unittest/configuration/providers/providerQuickPick/flaskProviderQuickPick.unit.test.ts @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +'use strict'; + +import { Uri } from 'vscode'; +import { expect } from 'chai'; +import * as path from 'path'; +import * as typemoq from 'typemoq'; +import * as sinon from 'sinon'; +import { MultiStepInput } from '../../../../../extension/common/multiStepInput'; +import { DebugConfigurationState } from '../../../../../extension/debugger/types'; +import { + parseFlaskPath +} from '../../../../../extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick'; + +suite('Debugging - Configuration Provider Flask QuickPick', () => { + let pathSeparatorStub: sinon.SinonStub; + let multiStepInput: typemoq.IMock>; + + setup(() => { + multiStepInput = typemoq.Mock.ofType>(); + multiStepInput + .setup((i) => i.run(typemoq.It.isAny(), typemoq.It.isAny())) + .returns((callback, _state) => callback()); + pathSeparatorStub = sinon.stub(path, 'sep'); + pathSeparatorStub.value('-'); + }); + teardown(() => { + sinon.restore(); + }); + test('parseManagePyPath should parse the path and return it with workspaceFolderToken', () => { + const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; + const flaskPath = path.join(folder.uri.fsPath, 'app.py'); + const file = parseFlaskPath(folder, flaskPath); + pathSeparatorStub.value('-'); + const expectedValue = `app.py`; + expect(file).to.be.equal(expectedValue); + }); + test('parseManagePyPath should return the same path if the workspace do not match', () => { + const folder = { uri: Uri.parse(path.join('one', 'two')), name: '1', index: 0 }; + const flaskPath = 'random/path/app.py'; + const file = parseFlaskPath(folder, flaskPath); + + expect(file).to.be.equal(flaskPath); + }); +}); From 2556c8fbe8b3f3dd01937c4508ee0138ee90a6e7 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Thu, 21 Mar 2024 14:57:25 -0700 Subject: [PATCH 3/6] fix lint --- src/extension/common/utils/localize.ts | 8 ++------ .../debugger/configuration/providers/flaskLaunch.ts | 3 +-- .../configuration/providers/flaskLaunch.unit.test.ts | 10 +++------- .../flaskProviderQuickPick.unit.test.ts | 4 +--- 4 files changed, 7 insertions(+), 18 deletions(-) diff --git a/src/extension/common/utils/localize.ts b/src/extension/common/utils/localize.ts index 409d9b2d..bfe1bf09 100644 --- a/src/extension/common/utils/localize.ts +++ b/src/extension/common/utils/localize.ts @@ -100,9 +100,7 @@ export namespace DebugConfigStrings { }; export const djangoConfigPromp = { title: l10n.t('Debug Django'), - prompt: l10n.t( - "Enter the path to manage.py or select a file from the list.", - ), + prompt: l10n.t('Enter the path to manage.py or select a file from the list.'), }; } export namespace fastapi { @@ -134,9 +132,7 @@ export namespace DebugConfigStrings { }; export const flaskConfigPromp = { title: l10n.t('Debug Flask'), - prompt: l10n.t( - "Enter the path to app.py or select a file from the list", - ), + prompt: l10n.t('Enter the path to app.py or select a file from the list'), }; } export namespace pyramid { diff --git a/src/extension/debugger/configuration/providers/flaskLaunch.ts b/src/extension/debugger/configuration/providers/flaskLaunch.ts index f3882dbd..ee87ca8a 100644 --- a/src/extension/debugger/configuration/providers/flaskLaunch.ts +++ b/src/extension/debugger/configuration/providers/flaskLaunch.ts @@ -20,7 +20,6 @@ export async function buildFlaskLaunchDebugConfiguration( input: MultiStepInput, state: DebugConfigurationState, ): Promise { - let flaskPaths = await getFlaskPaths(state.folder); let options: QuickPickType[] = []; @@ -59,4 +58,4 @@ export async function buildFlaskLaunchDebugConfiguration( }); } await input.run((_input, state) => pickFlaskPrompt(input, state, config, options), state); -} +} diff --git a/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts b/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts index 85577cfc..d1d91ba3 100644 --- a/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts +++ b/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts @@ -5,8 +5,7 @@ import { expect } from 'chai'; import * as path from 'path'; -import * as fs from 'fs-extra'; -import * as sinon from 'sinon'; +import * as sinon from 'sinon' import * as typemoq from 'typemoq'; import { ThemeIcon, Uri } from 'vscode'; import { DebugConfigurationState } from '../../../../extension/debugger/types'; @@ -15,15 +14,12 @@ import { MultiStepInput } from '../../../../extension/common/multiStepInput'; import * as configuration from '../../../../extension/debugger/configuration/utils/configuration'; import * as flaskProviderQuickPick from '../../../../extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick'; - suite('Debugging - Configuration Provider Flask', () => { - let pathExistsStub: sinon.SinonStub; let multiStepInput: typemoq.IMock>; let getFlaskPathsStub: sinon.SinonStub; let pickFlaskPromptStub: sinon.SinonStub; setup(() => { - pathExistsStub = sinon.stub(fs, 'pathExists'); multiStepInput = typemoq.Mock.ofType>(); multiStepInput .setup((i) => i.run(typemoq.It.isAny(), typemoq.It.isAny())) @@ -46,7 +42,7 @@ suite('Debugging - Configuration Provider Flask', () => { { label: path.basename(appPath.fsPath), filePath: appPath, - description: "app.py", + description: 'app.py', buttons: [ { iconPath: new ThemeIcon('go-to-file'), @@ -70,7 +66,7 @@ suite('Debugging - Configuration Provider Flask', () => { { label: 'Default', filePath: Uri.file(appPath), - description: "app.py", + description: 'app.py', }, ]; diff --git a/src/test/unittest/configuration/providers/providerQuickPick/flaskProviderQuickPick.unit.test.ts b/src/test/unittest/configuration/providers/providerQuickPick/flaskProviderQuickPick.unit.test.ts index f0d23c01..0cddf9d4 100644 --- a/src/test/unittest/configuration/providers/providerQuickPick/flaskProviderQuickPick.unit.test.ts +++ b/src/test/unittest/configuration/providers/providerQuickPick/flaskProviderQuickPick.unit.test.ts @@ -10,9 +10,7 @@ import * as typemoq from 'typemoq'; import * as sinon from 'sinon'; import { MultiStepInput } from '../../../../../extension/common/multiStepInput'; import { DebugConfigurationState } from '../../../../../extension/debugger/types'; -import { - parseFlaskPath -} from '../../../../../extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick'; +import { parseFlaskPath } from '../../../../../extension/debugger/configuration/providers/providerQuickPick/flaskProviderQuickPick'; suite('Debugging - Configuration Provider Flask QuickPick', () => { let pathSeparatorStub: sinon.SinonStub; From dac1f6713d6b253c0af3a92883334c6c42535788 Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Thu, 21 Mar 2024 14:59:01 -0700 Subject: [PATCH 4/6] fix lint --- .../unittest/configuration/providers/flaskLaunch.unit.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts b/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts index d1d91ba3..95f3110a 100644 --- a/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts +++ b/src/test/unittest/configuration/providers/flaskLaunch.unit.test.ts @@ -5,7 +5,7 @@ import { expect } from 'chai'; import * as path from 'path'; -import * as sinon from 'sinon' +import * as sinon from 'sinon'; import * as typemoq from 'typemoq'; import { ThemeIcon, Uri } from 'vscode'; import { DebugConfigurationState } from '../../../../extension/debugger/types'; From 485bc7bd385c35ca58b8c445b5bcb6690bdd5ce1 Mon Sep 17 00:00:00 2001 From: Paula Date: Fri, 22 Mar 2024 11:12:10 -0700 Subject: [PATCH 5/6] Update src/extension/common/utils/localize.ts Co-authored-by: Luciana Abud <45497113+luabud@users.noreply.github.com> --- src/extension/common/utils/localize.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/extension/common/utils/localize.ts b/src/extension/common/utils/localize.ts index bfe1bf09..c81182c1 100644 --- a/src/extension/common/utils/localize.ts +++ b/src/extension/common/utils/localize.ts @@ -132,7 +132,7 @@ export namespace DebugConfigStrings { }; export const flaskConfigPromp = { title: l10n.t('Debug Flask'), - prompt: l10n.t('Enter the path to app.py or select a file from the list'), + prompt: l10n.t('Enter the path to app.py or select a file from the list.'), }; } export namespace pyramid { From 6ce4fc72030444d1ccbbc355b871a0bf626b9adf Mon Sep 17 00:00:00 2001 From: Paula Camargo Date: Fri, 22 Mar 2024 12:46:38 -0700 Subject: [PATCH 6/6] clean code --- src/extension/debugger/configuration/providers/flaskLaunch.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/extension/debugger/configuration/providers/flaskLaunch.ts b/src/extension/debugger/configuration/providers/flaskLaunch.ts index ee87ca8a..a83359fc 100644 --- a/src/extension/debugger/configuration/providers/flaskLaunch.ts +++ b/src/extension/debugger/configuration/providers/flaskLaunch.ts @@ -23,8 +23,6 @@ export async function buildFlaskLaunchDebugConfiguration( let flaskPaths = await getFlaskPaths(state.folder); let options: QuickPickType[] = []; - // const application = await getApplicationPath(state.folder); - // let manuallyEnteredAValue: boolean | undefined; const config: Partial = { name: DebugConfigStrings.flask.snippet.name, type: DebuggerTypeName,