15
15
********************************************************************************/
16
16
17
17
import { inject , injectable } from 'inversify' ;
18
- import { QuickOpenService } from './quick-open-service' ;
18
+ import { QuickOpenService , TitleButton } from './quick-open-service' ;
19
19
import { QuickOpenItem , QuickOpenMode } from './quick-open-model' ;
20
20
import { Deferred } from '../../common/promise-util' ;
21
21
import { MaybePromise } from '../../common/types' ;
22
22
import { MessageType } from '../../common/message-service-protocol' ;
23
23
import { Emitter , Event } from '../../common/event' ;
24
24
25
25
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
+
26
62
/**
27
63
* The prefill value.
28
64
*/
@@ -72,7 +108,7 @@ export class QuickInputService {
72
108
const validateInput = options && options . validateInput ;
73
109
this . quickOpenService . open ( {
74
110
onType : async ( lookFor , acceptor ) => {
75
- const error = validateInput ? await validateInput ( lookFor ) : undefined ;
111
+ const error = validateInput && lookFor !== undefined ? await validateInput ( lookFor ) : undefined ;
76
112
label = error || prompt ;
77
113
if ( error ) {
78
114
this . quickOpenService . showDecoration ( MessageType . Error ) ;
@@ -97,7 +133,16 @@ export class QuickInputService {
97
133
placeholder : options . placeHolder ,
98
134
password : options . password ,
99
135
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
+ }
101
146
} ) ;
102
147
return result . promise ;
103
148
}
@@ -112,4 +157,9 @@ export class QuickInputService {
112
157
return this . onDidAcceptEmitter . event ;
113
158
}
114
159
160
+ readonly onDidHideEmitter : Emitter < void > = new Emitter ( ) ;
161
+ get onDidHide ( ) : Event < void > {
162
+ return this . onDidHideEmitter . event ;
163
+ }
164
+
115
165
}
0 commit comments