Skip to content

Commit

Permalink
Fix input error in django and flask pickers (#292)
Browse files Browse the repository at this point in the history
* fix input error

* fix filter on windows

* fix lint
  • Loading branch information
paulacamargo25 authored Mar 27, 2024
1 parent 0b5edc2 commit 2a4a27b
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 37 deletions.
37 changes: 11 additions & 26 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@
],
"menus": {
"issue/reporter": [
{
"command": "debugpy.reportIssue"
}
],
{
"command": "debugpy.reportIssue"
}
],
"commandPalette": [
{
"category": "Python Debugger",
Expand Down Expand Up @@ -525,7 +525,7 @@
"format-check": "prettier --check 'src/**/*.ts' 'build/**/*.yml' '.github/**/*.yml'",
"format-fix": "prettier --write 'src/**/*.ts' 'build/**/*.yml' '.github/**/*.yml'",
"test": "node ./out/test/runTest.js",
"vsce-package": "vsce package -o python-debugger.vsix"
"vsce-package": "npx @vscode/vsce package -o python-debugger.vsix"
},
"devDependencies": {
"@types/chai": "^4.3.4",
Expand All @@ -541,7 +541,7 @@
"@typescript-eslint/eslint-plugin": "^5.31.0",
"@typescript-eslint/parser": "^5.62.0",
"@vscode/test-electron": "^2.3.9",
"@vscode/vsce": "^2.19.0",
"@vscode/vsce": "^2.24.0",
"chai": "^4.3.7",
"chai-as-promised": "^7.1.1",
"eslint": "^8.50.0",
Expand Down
13 changes: 13 additions & 0 deletions src/extension/common/multiStepInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,19 @@ export class MultiStepInput<S> implements IMultiStepInput<S> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
deferred.resolve(input.value as any);
}),
input.onDidChangeSelection((selectedItems) => {
if (input.value) {
deferred.resolve(input.value as any);
} else {
deferred.resolve(selectedItems[0]);
}
}),
);
} else {
disposables.push(
input.onDidChangeSelection((selectedItems) => {
deferred.resolve(selectedItems[0]);
}),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export async function pickDjangoPrompt(
placeholder: DebugConfigStrings.django.djangoConfigPromp.prompt,
items: options,
acceptFilterBoxTextAsSelection: true,
activeItem: options[0],
matchOnDescription: true,
title: DebugConfigStrings.django.djangoConfigPromp.title,
onDidTriggerItemButton: async (e: QuickPickItemButtonEvent<QuickPickType>) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export async function pickFlaskPrompt(
placeholder: DebugConfigStrings.flask.flaskConfigPromp.prompt,
items: options,
acceptFilterBoxTextAsSelection: true,
activeItem: options[0],
matchOnDescription: true,
title: DebugConfigStrings.flask.flaskConfigPromp.title,
onDidTriggerItemButton: async (e: QuickPickItemButtonEvent<QuickPickType>) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ export const browseFileOption = {
};

export async function openFileExplorer(folder: Uri | undefined) {
const filtersKey = 'Executables';
const filtersKey = 'Python Files';
const filtersObject: { [name: string]: string[] } = {};
filtersObject[filtersKey] = ['exe'];
filtersObject[filtersKey] = ['py'];
return await window.showOpenDialog({
filters: getOSType() == OSType.Windows ? filtersObject : undefined,
filters: getOSType() === OSType.Windows ? filtersObject : undefined,
openLabel: DebugConfigStrings.browsePath.openButtonLabel,
canSelectMany: false,
title: DebugConfigStrings.browsePath.title,
Expand Down
3 changes: 3 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"ES2020"
],
"sourceMap": true,
"typeRoots": [
"./node_modules/@types"
],
"rootDir": "src",
"strict": true, /* enable all strict type-checking options */
"experimentalDecorators": true,
Expand Down

0 comments on commit 2a4a27b

Please sign in to comment.