@@ -122,6 +122,31 @@ export namespace OpenFileRequest {
122
122
{ get method ( ) { return 'editor/openFile' ; } } ;
123
123
}
124
124
125
+ export namespace ShowErrorMessageRequest {
126
+ export const type : RequestType < string , EditorOperationResponse , void > =
127
+ { get method ( ) { return 'editor/showErrorMessage' ; } } ;
128
+ }
129
+
130
+ export namespace ShowWarningMessageRequest {
131
+ export const type : RequestType < string , EditorOperationResponse , void > =
132
+ { get method ( ) { return 'editor/showWarningMessage' ; } } ;
133
+ }
134
+
135
+ export namespace ShowInformationMessageRequest {
136
+ export const type : RequestType < string , EditorOperationResponse , void > =
137
+ { get method ( ) { return 'editor/showInformationMessage' ; } } ;
138
+ }
139
+
140
+ export namespace SetStatusBarMessageRequest {
141
+ export const type : RequestType < StatusBarMessageDetails , EditorOperationResponse , void > =
142
+ { get method ( ) { return 'editor/setStatusBarMessage' ; } } ;
143
+ }
144
+
145
+ export interface StatusBarMessageDetails {
146
+ message : string ;
147
+ timeout ?: number ;
148
+ }
149
+
125
150
export class ExtensionCommandsFeature implements IFeature {
126
151
127
152
private command : vscode . Disposable ;
@@ -172,6 +197,22 @@ export class ExtensionCommandsFeature implements IFeature {
172
197
this . languageClient . onRequest (
173
198
OpenFileRequest . type ,
174
199
filePath => this . openFile ( filePath ) ) ;
200
+
201
+ this . languageClient . onRequest (
202
+ ShowInformationMessageRequest . type ,
203
+ message => this . showInformationMessage ( message ) ) ;
204
+
205
+ this . languageClient . onRequest (
206
+ ShowErrorMessageRequest . type ,
207
+ message => this . showErrorMessage ( message ) ) ;
208
+
209
+ this . languageClient . onRequest (
210
+ ShowWarningMessageRequest . type ,
211
+ message => this . showWarningMessage ( message ) ) ;
212
+
213
+ this . languageClient . onRequest (
214
+ SetStatusBarMessageRequest . type ,
215
+ messageDetails => this . setStatusBarMessage ( messageDetails ) ) ;
175
216
}
176
217
}
177
218
@@ -285,4 +326,34 @@ export class ExtensionCommandsFeature implements IFeature {
285
326
286
327
return EditorOperationResponse . Completed ;
287
328
}
329
+
330
+ private showInformationMessage ( message : string ) : Thenable < EditorOperationResponse > {
331
+ return vscode . window
332
+ . showInformationMessage ( message )
333
+ . then ( _ => EditorOperationResponse . Completed ) ;
334
+ }
335
+
336
+ private showErrorMessage ( message : string ) : Thenable < EditorOperationResponse > {
337
+ return vscode . window
338
+ . showErrorMessage ( message )
339
+ . then ( _ => EditorOperationResponse . Completed ) ;
340
+ }
341
+
342
+ private showWarningMessage ( message : string ) : Thenable < EditorOperationResponse > {
343
+ return vscode . window
344
+ . showWarningMessage ( message )
345
+ . then ( _ => EditorOperationResponse . Completed ) ;
346
+ }
347
+
348
+ private setStatusBarMessage ( messageDetails : StatusBarMessageDetails ) : EditorOperationResponse {
349
+
350
+ if ( messageDetails . timeout ) {
351
+ vscode . window . setStatusBarMessage ( messageDetails . message , messageDetails . timeout ) ;
352
+ }
353
+ else {
354
+ vscode . window . setStatusBarMessage ( messageDetails . message ) ;
355
+ }
356
+
357
+ return EditorOperationResponse . Completed ;
358
+ }
288
359
}
0 commit comments