@@ -57,6 +57,7 @@ import { sha1Hex } from 'vs/base/browser/hash';
57
57
import { IStorageService , StorageScope , StorageTarget } from 'vs/platform/storage/common/storage' ;
58
58
import { IActivityService , NumberBadge } from 'vs/workbench/services/activity/common/activity' ;
59
59
import { IEditorService } from 'vs/workbench/services/editor/common/editorService' ;
60
+ import { ILocalizedString } from 'vs/platform/action/common/action' ;
60
61
import { Codicon } from 'vs/base/common/codicons' ;
61
62
62
63
registerSingleton ( IEditSessionsLogService , EditSessionsLogService , InstantiationType . Delayed ) ;
@@ -290,7 +291,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
290
291
super ( continueWorkingOnCommand ) ;
291
292
}
292
293
293
- async run ( accessor : ServicesAccessor , workspaceUri : URI | undefined ) : Promise < void > {
294
+ async run ( accessor : ServicesAccessor , workspaceUri : URI | undefined , destination : string | undefined ) : Promise < void > {
294
295
type ContinueEditSessionEvent = { } ;
295
296
type ContinueEditSessionClassification = {
296
297
owner : 'joyceerhl' ; comment : 'Reporting when the continue edit session action is run.' ;
@@ -299,12 +300,11 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
299
300
300
301
// First ask the user to pick a destination, if necessary
301
302
let uri : URI | 'noDestinationUri' | undefined = workspaceUri ;
302
- let destination ;
303
- if ( ! uri ) {
304
- destination = await that . pickContinueEditSessionDestination ( ) ;
305
- }
306
303
if ( ! destination && ! uri ) {
307
- return ;
304
+ destination = await that . pickContinueEditSessionDestination ( ) ;
305
+ if ( ! destination ) {
306
+ return ;
307
+ }
308
308
}
309
309
310
310
// Determine if we need to store an edit session, asking for edit session auth if necessary
@@ -731,20 +731,43 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
731
731
732
732
const icon = command . icon ;
733
733
const title = typeof command . title === 'string' ? command . title : command . title . value ;
734
+ const when = ContextKeyExpr . deserialize ( contribution . when ) ;
734
735
735
736
continueEditSessionOptions . push ( new ContinueEditSessionItem (
736
737
ThemeIcon . isThemeIcon ( icon ) ? `$(${ icon . id } ) ${ title } ` : title ,
737
738
command . id ,
738
739
command . source ,
739
- ContextKeyExpr . deserialize ( contribution . when ) ,
740
+ when ,
740
741
contribution . documentation
741
742
) ) ;
743
+
744
+ if ( contribution . qualifiedName ) {
745
+ this . generateStandaloneOptionCommand ( command . id , contribution . qualifiedName , command . category , when ) ;
746
+ }
742
747
}
743
748
}
744
749
this . continueEditSessionOptions = continueEditSessionOptions ;
745
750
} ) ;
746
751
}
747
752
753
+ private generateStandaloneOptionCommand ( commandId : string , qualifiedName : string , category : string | ILocalizedString | undefined , when : ContextKeyExpression | undefined ) {
754
+ registerAction2 ( class StandaloneContinueOnOption extends Action2 {
755
+ constructor ( ) {
756
+ super ( {
757
+ id : `${ continueWorkingOnCommand . id } .${ commandId } ` ,
758
+ title : { original : qualifiedName , value : qualifiedName } ,
759
+ category : typeof category === 'string' ? { original : category , value : category } : category ,
760
+ precondition : when ,
761
+ f1 : true
762
+ } ) ;
763
+ }
764
+
765
+ async run ( accessor : ServicesAccessor ) : Promise < void > {
766
+ return accessor . get ( ICommandService ) . executeCommand ( continueWorkingOnCommand . id , undefined , commandId ) ;
767
+ }
768
+ } ) ;
769
+ }
770
+
748
771
private registerContinueInLocalFolderAction ( ) : void {
749
772
const that = this ;
750
773
this . _register ( registerAction2 ( class ContinueInLocalFolderAction extends Action2 {
@@ -858,6 +881,7 @@ interface ICommand {
858
881
group : string ;
859
882
when : string ;
860
883
documentation ?: string ;
884
+ qualifiedName ?: string ;
861
885
}
862
886
863
887
const continueEditSessionExtPoint = ExtensionsRegistry . registerExtensionPoint < ICommand [ ] > ( {
@@ -876,6 +900,10 @@ const continueEditSessionExtPoint = ExtensionsRegistry.registerExtensionPoint<IC
876
900
description : localize ( 'continueEditSessionExtPoint.group' , 'Group into which this item belongs.' ) ,
877
901
type : 'string'
878
902
} ,
903
+ qualifiedName : {
904
+ description : localize ( 'continueEditSessionExtPoint.qualifiedName' , 'A fully qualified name for this item which is used for display in menus.' ) ,
905
+ type : 'string'
906
+ } ,
879
907
description : {
880
908
description : localize ( 'continueEditSessionExtPoint.description' , "The url, or a command that returns the url, to the option's documentation page." ) ,
881
909
type : 'string'
0 commit comments