@@ -51,6 +51,8 @@ import { CancellationTokenSource } from 'vs/base/common/cancellation';
51
51
import { equals } from 'vs/base/common/objects' ;
52
52
import { IEditSessionIdentityService } from 'vs/platform/workspace/common/editSessions' ;
53
53
import { ThemeIcon } from 'vs/platform/theme/common/themeService' ;
54
+ import { IOutputService } from 'vs/workbench/services/output/common/output' ;
55
+ import * as Constants from 'vs/workbench/contrib/logs/common/logConstants' ;
54
56
55
57
registerSingleton ( IEditSessionsLogService , EditSessionsLogService ) ;
56
58
registerSingleton ( IEditSessionsStorageService , EditSessionsWorkbenchService ) ;
@@ -68,6 +70,16 @@ const openLocalFolderCommand: IAction2Options = {
68
70
category : EDIT_SESSION_SYNC_CATEGORY ,
69
71
precondition : IsWebContext
70
72
} ;
73
+ const showOutputChannelCommand : IAction2Options = {
74
+ id : 'workbench.experimental.editSessions.actions.showOutputChannel' ,
75
+ title : { value : localize ( 'show log' , 'Show Log' ) , original : 'Show Log' } ,
76
+ category : EDIT_SESSION_SYNC_CATEGORY
77
+ } ;
78
+ const resumingProgressOptions = {
79
+ location : ProgressLocation . Window ,
80
+ type : 'syncing' ,
81
+ title : `[${ localize ( 'resuming edit session window' , 'Resuming edit session...' ) } ](command:${ showOutputChannelCommand . id } )`
82
+ } ;
71
83
const queryParamName = 'editSessionId' ;
72
84
const experimentalSettingName = 'workbench.experimental.editSessions.enabled' ;
73
85
@@ -120,31 +132,27 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
120
132
this . lifecycleService . onWillShutdown ( ( e ) => e . join ( this . autoStoreEditSession ( ) , { id : 'autoStoreEditSession' , label : localize ( 'autoStoreEditSession' , 'Storing current edit session...' ) } ) ) ;
121
133
}
122
134
123
- private async autoResumeEditSession ( ) {
124
- if ( this . environmentService . editSessionId !== undefined ) {
125
- // In web, resume edit session based on an edit session GUID that
126
- // was explicitly passed into the workbench construction options
127
- void this . progressService . withProgress ( { location : ProgressLocation . Window , type : 'syncing' , title : localize ( 'resuming edit session dialog' , 'Resuming your latest edit session...' ) } , async ( ) => {
128
- performance . mark ( 'code/willResumeEditSessionFromIdentifier' ) ;
135
+ private autoResumeEditSession ( ) {
136
+ void this . progressService . withProgress ( resumingProgressOptions , async ( ) => {
137
+ performance . mark ( 'code/willResumeEditSessionFromIdentifier' ) ;
129
138
130
- type ResumeEvent = { } ;
131
- type ResumeClassification = {
132
- owner : 'joyceerhl' ; comment : 'Reporting when an action is resumed from an edit session identifier.' ;
133
- } ;
134
- this . telemetryService . publicLog2 < ResumeEvent , ResumeClassification > ( 'editSessions.continue.resume' ) ;
139
+ type ResumeEvent = { } ;
140
+ type ResumeClassification = {
141
+ owner : 'joyceerhl' ; comment : 'Reporting when an action is resumed from an edit session identifier.' ;
142
+ } ;
143
+ this . telemetryService . publicLog2 < ResumeEvent , ResumeClassification > ( 'editSessions.continue.resume' ) ;
135
144
145
+ if ( this . environmentService . editSessionId !== undefined ) {
136
146
await this . resumeEditSession ( this . environmentService . editSessionId ) . finally ( ( ) => this . environmentService . editSessionId = undefined ) ;
137
-
138
- performance . mark ( 'code/didResumeEditSessionFromIdentifier' ) ;
139
- } ) ;
140
- } else if ( this . configurationService . getValue ( 'workbench.experimental.editSessions.autoResume' ) === 'onReload' && this . editSessionsStorageService . isSignedIn ) {
141
- // Attempt to resume edit session based on edit workspace identifier
142
- // Note: at this point if the user is not signed into edit sessions,
143
- // we don't want them to be prompted to sign in and should just return early
144
- void this . progressService . withProgress ( { location : ProgressLocation . Window , type : 'syncing' , title : localize ( 'resuming edit session window' , 'Resuming edit session...' ) } , async ( ) => {
147
+ } else if ( this . configurationService . getValue ( 'workbench.experimental.editSessions.autoResume' ) === 'onReload' && this . editSessionsStorageService . isSignedIn ) {
148
+ // Attempt to resume edit session based on edit workspace identifier
149
+ // Note: at this point if the user is not signed into edit sessions,
150
+ // we don't want them to be prompted to sign in and should just return early
145
151
await this . resumeEditSession ( undefined , true ) ;
146
- } ) ;
147
- }
152
+ }
153
+
154
+ performance . mark ( 'code/didResumeEditSessionFromIdentifier' ) ;
155
+ } ) ;
148
156
}
149
157
150
158
private async autoStoreEditSession ( ) {
@@ -187,10 +195,24 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
187
195
this . registerContinueInLocalFolderAction ( ) ;
188
196
189
197
this . registerShowEditSessionViewAction ( ) ;
198
+ this . registerShowEditSessionOutputChannelAction ( ) ;
190
199
191
200
this . registered = true ;
192
201
}
193
202
203
+ private registerShowEditSessionOutputChannelAction ( ) {
204
+ this . _register ( registerAction2 ( class ShowEditSessionOutput extends Action2 {
205
+ constructor ( ) {
206
+ super ( showOutputChannelCommand ) ;
207
+ }
208
+
209
+ run ( accessor : ServicesAccessor , ...args : any [ ] ) {
210
+ const outputChannel = accessor . get ( IOutputService ) ;
211
+ void outputChannel . showChannel ( Constants . editSessionsLogChannelId ) ;
212
+ }
213
+ } ) ) ;
214
+ }
215
+
194
216
private registerShowEditSessionViewAction ( ) {
195
217
const that = this ;
196
218
this . _register ( registerAction2 ( class ShowEditSessionView extends Action2 {
@@ -262,10 +284,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
262
284
}
263
285
264
286
async run ( accessor : ServicesAccessor , editSessionId ?: string ) : Promise < void > {
265
- await that . progressService . withProgress ( {
266
- location : ProgressLocation . Notification ,
267
- title : localize ( 'resuming edit session' , 'Resuming edit session...' )
268
- } , async ( ) => {
287
+ await that . progressService . withProgress ( resumingProgressOptions , async ( ) => {
269
288
type ResumeEvent = { } ;
270
289
type ResumeClassification = {
271
290
owner : 'joyceerhl' ; comment : 'Reporting when the resume edit session action is invoked.' ;
0 commit comments