Skip to content

Commit 1827022

Browse files
committed
Fixup
Signed-off-by: Josh Pinkney <[email protected]>
1 parent f192f49 commit 1827022

File tree

7 files changed

+731
-33
lines changed

7 files changed

+731
-33
lines changed

packages/core/src/browser/quick-open/quick-input-service.ts

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,50 @@
1515
********************************************************************************/
1616

1717
import { inject, injectable } from 'inversify';
18-
import { QuickOpenService } from './quick-open-service';
18+
import { QuickOpenService, TitleButton } from './quick-open-service';
1919
import { QuickOpenItem, QuickOpenMode } from './quick-open-model';
2020
import { Deferred } from '../../common/promise-util';
2121
import { MaybePromise } from '../../common/types';
2222
import { MessageType } from '../../common/message-service-protocol';
2323
import { Emitter, Event } from '../../common/event';
2424

2525
export interface QuickInputOptions {
26+
27+
/**
28+
* Show the progress indicator if true
29+
*/
30+
busy?: boolean
31+
32+
/**
33+
* Allow user input
34+
*/
35+
enabled?: boolean;
36+
37+
/**
38+
* Current step count
39+
*/
40+
step?: number | undefined
41+
42+
/**
43+
* The title of the input
44+
*/
45+
title?: string | undefined
46+
47+
/**
48+
* Total number of steps
49+
*/
50+
totalSteps?: number | undefined
51+
52+
/**
53+
* Buttons that are displayed on the title panel
54+
*/
55+
buttons?: ReadonlyArray<TitleButton>
56+
57+
/**
58+
* Text for when there is a problem with the current input value
59+
*/
60+
validationMessage?: string | undefined;
61+
2662
/**
2763
* The prefill value.
2864
*/
@@ -72,7 +108,7 @@ export class QuickInputService {
72108
const validateInput = options && options.validateInput;
73109
this.quickOpenService.open({
74110
onType: async (lookFor, acceptor) => {
75-
const error = validateInput ? await validateInput(lookFor) : undefined;
111+
const error = validateInput && lookFor !== undefined ? await validateInput(lookFor) : undefined;
76112
label = error || prompt;
77113
if (error) {
78114
this.quickOpenService.showDecoration(MessageType.Error);
@@ -97,7 +133,16 @@ export class QuickInputService {
97133
placeholder: options.placeHolder,
98134
password: options.password,
99135
ignoreFocusOut: options.ignoreFocusOut,
100-
onClose: () => result.resolve(undefined)
136+
busy: options.busy,
137+
buttons: options.buttons,
138+
enabled: options.enabled,
139+
step: options.step,
140+
title: options.title,
141+
totalSteps: options.totalSteps,
142+
onClose: () => {
143+
result.resolve(undefined);
144+
this.onDidHideEmitter.fire(undefined);
145+
}
101146
});
102147
return result.promise;
103148
}
@@ -112,4 +157,9 @@ export class QuickInputService {
112157
return this.onDidAcceptEmitter.event;
113158
}
114159

160+
readonly onDidHideEmitter: Emitter<void> = new Emitter();
161+
get onDidHide(): Event<void> {
162+
return this.onDidHideEmitter.event;
163+
}
164+
115165
}

packages/core/src/browser/quick-open/quick-open-service.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@
1717
import { injectable } from 'inversify';
1818
import { QuickOpenModel } from './quick-open-model';
1919
import { MessageType } from '../../common/message-service-protocol';
20+
import URI from '../../common/uri';
21+
22+
export enum TitleButtonLocation {
23+
LEFT = 0,
24+
RIGHT = 1
25+
}
26+
27+
export interface TitleButton {
28+
location: TitleButtonLocation;
29+
iconPath: URI | { dark: URI, light: URI } | { id: string };
30+
iconClass?: string;
31+
tooltip?: string | undefined;
32+
}
2033

2134
export type QuickOpenOptions = Partial<QuickOpenOptions.Resolved>;
2235
export namespace QuickOpenOptions {
@@ -27,6 +40,13 @@ export namespace QuickOpenOptions {
2740
enableSeparateSubstringMatching?: boolean
2841
}
2942
export interface Resolved {
43+
readonly busy: boolean
44+
readonly enabled: boolean;
45+
readonly step: number | undefined
46+
readonly title: string | undefined
47+
readonly totalSteps: number | undefined
48+
readonly buttons: ReadonlyArray<TitleButton>
49+
3050
readonly prefix: string;
3151
readonly placeholder: string;
3252
readonly ignoreFocusOut: boolean;
@@ -55,6 +75,13 @@ export namespace QuickOpenOptions {
5575
onClose(canceled: boolean): void;
5676
}
5777
export const defaultOptions: Resolved = Object.freeze({
78+
busy: false,
79+
enabled: true,
80+
step: undefined,
81+
title: undefined,
82+
totalSteps: undefined,
83+
buttons: [],
84+
5885
prefix: '',
5986
placeholder: '',
6087
ignoreFocusOut: false,

0 commit comments

Comments
 (0)