@@ -18,7 +18,7 @@ import { joinPath } from 'vs/base/common/resources';
18
18
import { FileAccess } from 'vs/base/common/network' ;
19
19
import { EXTENSION_INSTALL_SKIP_WALKTHROUGH_CONTEXT , IExtensionManagementService } from 'vs/platform/extensionManagement/common/extensionManagement' ;
20
20
import { ThemeIcon } from 'vs/base/common/themables' ;
21
- import { BuiltinGettingStartedCategory , BuiltinGettingStartedStep , walkthroughs } from 'vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent' ;
21
+ import { walkthroughs } from 'vs/workbench/contrib/welcomeGettingStarted/common/gettingStartedContent' ;
22
22
import { IWorkbenchAssignmentService } from 'vs/workbench/services/assignment/common/assignmentService' ;
23
23
import { IHostService } from 'vs/workbench/services/host/browser/host' ;
24
24
import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
@@ -34,8 +34,6 @@ import { checkGlobFileExists } from 'vs/workbench/services/extensions/common/wor
34
34
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
35
35
import { CancellationTokenSource } from 'vs/base/common/cancellation' ;
36
36
import { DefaultIconPath } from 'vs/workbench/services/extensionManagement/common/extensionManagement' ;
37
- import { IProductService } from 'vs/platform/product/common/productService' ;
38
- import { ILifecycleService , LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle' ;
39
37
40
38
export const HasMultipleNewFileEntries = new RawContextKey < boolean > ( 'hasMultipleNewFileEntries' , false ) ;
41
39
@@ -98,8 +96,8 @@ export interface IWalkthroughsService {
98
96
readonly onDidChangeWalkthrough : Event < IResolvedWalkthrough > ;
99
97
readonly onDidProgressStep : Event < IResolvedWalkthroughStep > ;
100
98
101
- getWalkthroughs ( ) : Promise < IResolvedWalkthrough [ ] > ;
102
- getWalkthrough ( id : string ) : Promise < IResolvedWalkthrough > ;
99
+ getWalkthroughs ( ) : IResolvedWalkthrough [ ] ;
100
+ getWalkthrough ( id : string ) : IResolvedWalkthrough ;
103
101
104
102
registerWalkthrough ( descriptor : IWalkthroughLoose ) : void ;
105
103
@@ -114,12 +112,6 @@ export interface IWalkthroughsService {
114
112
const DAYS = 24 * 60 * 60 * 1000 ;
115
113
const NEW_WALKTHROUGH_TIME = 7 * DAYS ;
116
114
117
- type WalkthroughTreatment = {
118
- walkthroughId : string ;
119
- walkthroughStepIds ?: string [ ] ;
120
- stepOrder : number [ ] ;
121
- } ;
122
-
123
115
export class WalkthroughsService extends Disposable implements IWalkthroughsService {
124
116
declare readonly _serviceBrand : undefined ;
125
117
@@ -149,7 +141,6 @@ export class WalkthroughsService extends Disposable implements IWalkthroughsServ
149
141
150
142
private metadata : WalkthroughMetaDataType ;
151
143
152
- private registeredWalkthroughs : boolean = false ;
153
144
constructor (
154
145
@IStorageService private readonly storageService : IStorageService ,
155
146
@ICommandService private readonly commandService : ICommandService ,
@@ -162,9 +153,7 @@ export class WalkthroughsService extends Disposable implements IWalkthroughsServ
162
153
@IHostService private readonly hostService : IHostService ,
163
154
@IViewsService private readonly viewsService : IViewsService ,
164
155
@ITelemetryService private readonly telemetryService : ITelemetryService ,
165
- @IWorkbenchAssignmentService private readonly tasExperimentService : IWorkbenchAssignmentService ,
166
- @IProductService private readonly productService : IProductService ,
167
- @ILifecycleService private readonly lifecycleService : ILifecycleService ,
156
+ @IWorkbenchAssignmentService private readonly tasExperimentService : IWorkbenchAssignmentService
168
157
) {
169
158
super ( ) ;
170
159
@@ -178,28 +167,13 @@ export class WalkthroughsService extends Disposable implements IWalkthroughsServ
178
167
this . initCompletionEventListeners ( ) ;
179
168
180
169
HasMultipleNewFileEntries . bindTo ( this . contextService ) . set ( false ) ;
181
- }
170
+ this . registerWalkthroughs ( ) ;
182
171
183
- private async registerWalkthroughs ( ) {
184
-
185
- const treatmentString = await Promise . race ( [
186
- this . tasExperimentService ?. getTreatment < string > ( 'welcome.walkthrough.content' ) ,
187
- new Promise < string | undefined > ( resolve => setTimeout ( ( ) => resolve ( '' ) , 2000 ) )
188
- ] ) ;
172
+ }
189
173
190
- const treatment : WalkthroughTreatment = treatmentString ? JSON . parse ( treatmentString ) : { walkthroughId : '' } ;
174
+ private registerWalkthroughs ( ) {
191
175
192
176
walkthroughs . forEach ( async ( category , index ) => {
193
- let shouldReorder = false ;
194
- if ( category . id === treatment ?. walkthroughId ) {
195
- category = this . updateWalkthroughContent ( category , treatment ) ;
196
-
197
- shouldReorder = ( treatment ?. stepOrder !== undefined && category . content . steps . length === treatment . stepOrder . length ) ;
198
- if ( shouldReorder ) {
199
- category . content . steps = category . content . steps . filter ( ( _step , index ) => treatment . stepOrder [ index ] >= 0 ) ;
200
- treatment . stepOrder = treatment . stepOrder . filter ( value => value >= 0 ) ;
201
- }
202
- }
203
177
204
178
this . _registerWalkthrough ( {
205
179
...category ,
@@ -214,7 +188,7 @@ export class WalkthroughsService extends Disposable implements IWalkthroughsServ
214
188
completionEvents : step . completionEvents ?? [ ] ,
215
189
description : parseDescription ( step . description ) ,
216
190
category : category . id ,
217
- order : shouldReorder ? ( treatment ?. stepOrder ? treatment . stepOrder [ index ] : index ) : index ,
191
+ order : index ,
218
192
when : ContextKeyExpr . deserialize ( step . when ) ?? ContextKeyExpr . true ( ) ,
219
193
media : step . media . type === 'image'
220
194
? {
@@ -239,38 +213,12 @@ export class WalkthroughsService extends Disposable implements IWalkthroughsServ
239
213
} ) ;
240
214
} ) ;
241
215
242
- await this . lifecycleService . when ( LifecyclePhase . Restored ) ;
243
-
244
216
walkthroughsExtensionPoint . setHandler ( ( _ , { added, removed } ) => {
245
217
added . map ( e => this . registerExtensionWalkthroughContributions ( e . description ) ) ;
246
218
removed . map ( e => this . unregisterExtensionWalkthroughContributions ( e . description ) ) ;
247
219
} ) ;
248
220
}
249
221
250
- private updateWalkthroughContent ( walkthrough : BuiltinGettingStartedCategory , experimentTreatment : WalkthroughTreatment ) : BuiltinGettingStartedCategory {
251
-
252
- if ( ! experimentTreatment ?. walkthroughStepIds ) {
253
- return walkthrough ;
254
- }
255
-
256
- const walkthroughMetadata = this . productService . walkthroughMetadata ?. find ( value => value . id === walkthrough . id ) ;
257
- for ( const step of experimentTreatment . walkthroughStepIds ) {
258
- const stepMetadata = walkthroughMetadata ?. steps . find ( value => value . id === step ) ;
259
- if ( stepMetadata ) {
260
-
261
- const newStep : BuiltinGettingStartedStep = {
262
- id : step ,
263
- title : stepMetadata . title ,
264
- description : stepMetadata . description ,
265
- when : stepMetadata . when ,
266
- media : stepMetadata . media
267
- } ;
268
- walkthrough . content . steps . push ( newStep ) ;
269
- }
270
- }
271
- return walkthrough ;
272
- }
273
-
274
222
private initCompletionEventListeners ( ) {
275
223
this . _register ( this . commandService . onDidExecuteCommand ( command => this . progressByEvent ( `onCommand:${ command . commandId } ` ) ) ) ;
276
224
@@ -493,22 +441,14 @@ export class WalkthroughsService extends Disposable implements IWalkthroughsServ
493
441
} ) ;
494
442
}
495
443
496
- async getWalkthrough ( id : string ) : Promise < IResolvedWalkthrough > {
497
- if ( ! this . registeredWalkthroughs ) {
498
- await this . registerWalkthroughs ( ) ;
499
- this . registeredWalkthroughs = true ;
500
- }
444
+ getWalkthrough ( id : string ) : IResolvedWalkthrough {
501
445
502
446
const walkthrough = this . gettingStartedContributions . get ( id ) ;
503
447
if ( ! walkthrough ) { throw Error ( 'Trying to get unknown walkthrough: ' + id ) ; }
504
448
return this . resolveWalkthrough ( walkthrough ) ;
505
449
}
506
450
507
- async getWalkthroughs ( ) : Promise < IResolvedWalkthrough [ ] > {
508
- if ( ! this . registeredWalkthroughs ) {
509
- await this . registerWalkthroughs ( ) ;
510
- this . registeredWalkthroughs = true ;
511
- }
451
+ getWalkthroughs ( ) : IResolvedWalkthrough [ ] {
512
452
513
453
const registeredCategories = [ ...this . gettingStartedContributions . values ( ) ] ;
514
454
const categoriesWithCompletion = registeredCategories
0 commit comments