@@ -27,8 +27,8 @@ export enum StudioMenuType {
27
27
}
28
28
29
29
interface StudioAction extends vscode . QuickPickItem {
30
- name : string ;
31
30
id : string ;
31
+ save : number ;
32
32
}
33
33
34
34
function getOtherStudioActionLabel ( action : OtherStudioAction ) : string {
@@ -227,7 +227,7 @@ class StudioActions {
227
227
}
228
228
229
229
private userAction ( action , afterUserAction = false , answer = "" , msg = "" , type = 0 ) : Thenable < void > {
230
- if ( ! action ) {
230
+ if ( ! action || action . id == "" ) {
231
231
return ;
232
232
}
233
233
const func = afterUserAction ? "AfterUserAction(?, ?, ?, ?, ?)" : "UserAction(?, ?, ?, ?)" ;
@@ -275,29 +275,36 @@ class StudioActions {
275
275
) ;
276
276
}
277
277
278
- private prepareMenuItems ( menus , sourceControl : boolean ) : any [ ] {
278
+ private prepareMenuItems ( menus , sourceControl : boolean ) : StudioAction [ ] {
279
279
return menus
280
280
. filter ( ( menu ) => sourceControl == ( menu . id === "%SourceMenu" || menu . id === "%SourceContext" ) )
281
281
. reduce (
282
282
( list , sub ) =>
283
283
list . concat (
284
284
sub . items
285
- . filter ( ( el ) => el . id !== "" && el . separator == 0 )
286
- . filter ( ( el ) => el . enabled == 1 )
287
- . map ( ( el ) => ( {
288
- ...el ,
289
- id : `${ sub . id } ,${ el . id } ` ,
290
- label : el . name . replace ( "&" , "" ) ,
291
- itemId : el . id ,
292
- type : sub . type ,
293
- description : sub . name . replace ( "&" , "" ) ,
294
- } ) )
285
+ . filter ( ( el ) => el . id !== "" )
286
+ . filter ( ( el ) => el . separator == 1 || el . enabled == 1 )
287
+ . map ( ( el ) =>
288
+ el . separator == 1
289
+ ? {
290
+ label : "" ,
291
+ description : "---" ,
292
+ id : "" ,
293
+ save : 0 ,
294
+ }
295
+ : {
296
+ label : el . name . replace ( "&" , "" ) ,
297
+ description : sub . name . replace ( "&" , "" ) ,
298
+ id : `${ sub . id } ,${ el . id } ` ,
299
+ save : el . save ,
300
+ }
301
+ )
295
302
) ,
296
303
[ ]
297
304
) ;
298
305
}
299
306
300
- public getMenu ( menuType : StudioMenuType , sourceControl : boolean ) : Thenable < any > {
307
+ public getMenu ( menuType : StudioMenuType , sourceControl : boolean ) : Thenable < void > {
301
308
let selectedText = "" ;
302
309
const editor = vscode . window . activeTextEditor ;
303
310
if ( this . uri && editor ) {
@@ -367,15 +374,15 @@ class StudioActions {
367
374
}
368
375
}
369
376
370
- export async function mainCommandMenu ( uri ?: vscode . Uri ) : Promise < any > {
377
+ export async function mainCommandMenu ( uri ?: vscode . Uri ) : Promise < void > {
371
378
return _mainMenu ( false , uri ) ;
372
379
}
373
380
374
- export async function mainSourceControlMenu ( uri ?: vscode . Uri ) : Promise < any > {
381
+ export async function mainSourceControlMenu ( uri ?: vscode . Uri ) : Promise < void > {
375
382
return _mainMenu ( true , uri ) ;
376
383
}
377
384
378
- async function _mainMenu ( sourceControl : boolean , uri ?: vscode . Uri ) : Promise < any > {
385
+ async function _mainMenu ( sourceControl : boolean , uri ?: vscode . Uri ) : Promise < void > {
379
386
uri = uri || vscode . window . activeTextEditor ?. document . uri ;
380
387
if ( uri && uri . scheme !== FILESYSTEM_SCHEMA ) {
381
388
return ;
@@ -384,15 +391,15 @@ async function _mainMenu(sourceControl: boolean, uri?: vscode.Uri): Promise<any>
384
391
return studioActions && studioActions . getMenu ( StudioMenuType . Main , sourceControl ) ;
385
392
}
386
393
387
- export async function contextCommandMenu ( node : PackageNode | ClassNode | RoutineNode ) : Promise < any > {
394
+ export async function contextCommandMenu ( node : PackageNode | ClassNode | RoutineNode ) : Promise < void > {
388
395
return _contextMenu ( false , node ) ;
389
396
}
390
397
391
- export async function contextSourceControlMenu ( node : PackageNode | ClassNode | RoutineNode ) : Promise < any > {
398
+ export async function contextSourceControlMenu ( node : PackageNode | ClassNode | RoutineNode ) : Promise < void > {
392
399
return _contextMenu ( true , node ) ;
393
400
}
394
401
395
- export async function _contextMenu ( sourceControl : boolean , node : PackageNode | ClassNode | RoutineNode ) : Promise < any > {
402
+ export async function _contextMenu ( sourceControl : boolean , node : PackageNode | ClassNode | RoutineNode ) : Promise < void > {
396
403
const nodeOrUri = node || vscode . window . activeTextEditor ?. document . uri ;
397
404
if ( ! nodeOrUri || ( nodeOrUri instanceof vscode . Uri && nodeOrUri . scheme !== FILESYSTEM_SCHEMA ) ) {
398
405
return ;
0 commit comments