Skip to content

Commit

Permalink
Make configuration wizard sticky (#925)
Browse files Browse the repository at this point in the history
## Changes
Add `ignoreFocusOut` to both steps of the configuration wizard. They
will not disappear when focusing away from them, but can still be closed
with an escape button.

## Tests
Manual
  • Loading branch information
ilia-db authored Nov 2, 2023
1 parent 0ec1d8d commit 7a4fb31
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ export async function configureWorkspaceWizard(
return false;
},
items,
ignoreFocusOut: true,
});

state.host = normalizeHost(host);
Expand Down Expand Up @@ -158,6 +159,7 @@ export async function configureWorkspaceWizard(
totalSteps: 2,
placeholder: "Select authentication method",
items,
ignoreFocusOut: true,
shouldResume: async () => {
return false;
},
Expand Down
6 changes: 6 additions & 0 deletions packages/databricks-vscode/src/ui/wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ interface QuickAutoCompleteParameters {
buttons?: QuickInputButton[];
shouldResume: () => Thenable<boolean>;
items: Array<QuickPickItem>;
ignoreFocusOut: boolean;
}

interface QuickPickParameters<T extends QuickPickItem> {
Expand All @@ -54,6 +55,7 @@ interface QuickPickParameters<T extends QuickPickItem> {
placeholder: string;
buttons?: QuickInputButton[];
shouldResume: () => Thenable<boolean>;
ignoreFocusOut: boolean;
}

export class MultiStepInput {
Expand Down Expand Up @@ -107,6 +109,7 @@ export class MultiStepInput {
buttons,
shouldResume,
items,
ignoreFocusOut,
}: QuickAutoCompleteParameters): Promise<
| string
| (QuickAutoCompleteParameters extends {buttons: (infer I)[]}
Expand All @@ -129,6 +132,7 @@ export class MultiStepInput {
input.totalSteps = totalSteps;
input.placeholder = prompt;
input.items = [...items];
input.ignoreFocusOut = ignoreFocusOut;

disposables.push(
input.onDidChangeValue(async () => {
Expand Down Expand Up @@ -231,6 +235,7 @@ export class MultiStepInput {
placeholder,
buttons,
shouldResume,
ignoreFocusOut,
}: P) {
const disposables: Disposable[] = [];
try {
Expand All @@ -243,6 +248,7 @@ export class MultiStepInput {
input.totalSteps = totalSteps;
input.placeholder = placeholder;
input.items = items;
input.ignoreFocusOut = ignoreFocusOut;
if (activeItem) {
input.activeItems = [activeItem];
}
Expand Down

0 comments on commit 7a4fb31

Please sign in to comment.