Skip to content

Fix input error in django and flask pickers #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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