@@ -18,7 +18,7 @@ import { IFileService } from 'vs/platform/files/common/files';
18
18
import { joinPath } from 'vs/base/common/resources' ;
19
19
import { IEditorOptions } from 'vs/platform/editor/common/editor' ;
20
20
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService' ;
21
- import { GettingStartedInput , gettingStartedInputTypeId } from 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput' ;
21
+ import { GettingStartedEditorOptions , GettingStartedInput , gettingStartedInputTypeId } from 'vs/workbench/contrib/welcomeGettingStarted/browser/gettingStartedInput' ;
22
22
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService' ;
23
23
import { IStorageService , StorageScope , StorageTarget } from 'vs/platform/storage/common/storage' ;
24
24
import { getTelemetryLevel } from 'vs/platform/telemetry/common/telemetryUtils' ;
@@ -27,6 +27,7 @@ import { IProductService } from 'vs/platform/product/common/productService';
27
27
import { ILogService } from 'vs/platform/log/common/log' ;
28
28
import { INotificationService } from 'vs/platform/notification/common/notification' ;
29
29
import { localize } from 'vs/nls' ;
30
+ import { IEditorResolverService , RegisteredEditorPriority } from 'vs/workbench/services/editor/common/editorResolverService' ;
30
31
31
32
export const restoreWalkthroughsConfigurationKey = 'workbench.welcomePage.restorableWalkthroughs' ;
32
33
export type RestoreWalkthroughsConfigurationValue = { folder : string ; category ?: string ; step ?: string } ;
@@ -51,9 +52,34 @@ export class StartupPageContribution implements IWorkbenchContribution {
51
52
@IWorkbenchEnvironmentService private readonly environmentService : IWorkbenchEnvironmentService ,
52
53
@IStorageService private readonly storageService : IStorageService ,
53
54
@ILogService private readonly logService : ILogService ,
54
- @INotificationService private readonly notificationService : INotificationService
55
+ @INotificationService private readonly notificationService : INotificationService ,
56
+ @IEditorResolverService editorResolverService : IEditorResolverService
55
57
) {
56
58
this . run ( ) . then ( undefined , onUnexpectedError ) ;
59
+
60
+ editorResolverService . registerEditor (
61
+ `${ GettingStartedInput . RESOURCE . scheme } :/**` ,
62
+ {
63
+ id : GettingStartedInput . ID ,
64
+ label : localize ( 'welcome.displayName' , "Welcome Page" ) ,
65
+ priority : RegisteredEditorPriority . builtin ,
66
+ } ,
67
+ {
68
+ singlePerResource : false ,
69
+ canSupportResource : uri => uri . scheme === GettingStartedInput . RESOURCE . scheme ,
70
+ } ,
71
+ {
72
+ createEditorInput : ( { resource, options } ) => {
73
+ return {
74
+ editor : this . instantiationService . createInstance ( GettingStartedInput , options as GettingStartedEditorOptions ) ,
75
+ options : {
76
+ ...options ,
77
+ pinned : false
78
+ }
79
+ } ;
80
+ }
81
+ }
82
+ ) ;
57
83
}
58
84
59
85
private async run ( ) {
@@ -114,11 +140,10 @@ export class StartupPageContribution implements IWorkbenchContribution {
114
140
const restoreData : RestoreWalkthroughsConfigurationValue = JSON . parse ( toRestore ) ;
115
141
const currentWorkspace = this . contextService . getWorkspace ( ) ;
116
142
if ( restoreData . folder === currentWorkspace . folders [ 0 ] . uri . toString ( ) || restoreData . folder === UNKNOWN_EMPTY_WINDOW_WORKSPACE . id ) {
117
- this . editorService . openEditor (
118
- this . instantiationService . createInstance (
119
- GettingStartedInput ,
120
- { selectedCategory : restoreData . category , selectedStep : restoreData . step } ) ,
121
- { pinned : false } ) ;
143
+ this . editorService . openEditor ( {
144
+ resource : GettingStartedInput . RESOURCE ,
145
+ options : < GettingStartedEditorOptions > { selectedCategory : restoreData . category , selectedStep : restoreData . step , pinned : false } ,
146
+ } ) ;
122
147
this . storageService . remove ( restoreWalkthroughsConfigurationKey , StorageScope . PROFILE ) ;
123
148
return true ;
124
149
}
@@ -165,7 +190,10 @@ export class StartupPageContribution implements IWorkbenchContribution {
165
190
166
191
const options : IEditorOptions = editor ? { pinned : false , index : 0 } : { pinned : false } ;
167
192
if ( startupEditorTypeID === gettingStartedInputTypeId ) {
168
- this . editorService . openEditor ( this . instantiationService . createInstance ( GettingStartedInput , { showTelemetryNotice } ) , options ) ;
193
+ this . editorService . openEditor ( {
194
+ resource : GettingStartedInput . RESOURCE ,
195
+ options : < GettingStartedEditorOptions > { showTelemetryNotice, ...options } ,
196
+ } ) ;
169
197
}
170
198
}
171
199
}
0 commit comments