@@ -45,6 +45,8 @@ import { FilterWidget, IFilterWidgetOptions } from 'vs/workbench/browser/parts/v
45
45
import { BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems' ;
46
46
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection' ;
47
47
import { defaultButtonStyles , defaultProgressBarStyles } from 'vs/platform/theme/browser/defaultStyles' ;
48
+ import { IConfigurationResolverService } from 'vs/workbench/services/configurationResolver/common/configurationResolver' ;
49
+ import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace' ;
48
50
49
51
export interface IViewPaneOptions extends IPaneOptions {
50
52
id : string ;
@@ -83,21 +85,34 @@ class ViewWelcomeController {
83
85
84
86
private defaultItem : IItem | undefined ;
85
87
private items : IItem [ ] = [ ] ;
86
- get contents ( ) : IViewContentDescriptor [ ] {
88
+ get contents ( ) : Promise < IViewContentDescriptor [ ] > {
87
89
const visibleItems = this . items . filter ( v => v . visible ) ;
88
90
89
91
if ( visibleItems . length === 0 && this . defaultItem ) {
90
- return [ this . defaultItem . descriptor ] ;
92
+ return Promise . resolve ( [ this . defaultItem . descriptor ] ) ;
91
93
}
92
94
93
- return visibleItems . map ( v => v . descriptor ) ;
95
+ const workspace = this . workspaceContextService . getWorkspace ( ) ;
96
+ const workspaceFolder = workspace . folders . length > 0 ? workspace . folders [ 0 ] : undefined ;
97
+
98
+ return Promise . all ( visibleItems . map ( async ( v ) => {
99
+ return {
100
+ content : workspaceFolder ? await this . configurationResolverService . resolveWithInteractionReplace ( workspaceFolder , v . descriptor . content ) : v . descriptor . content ,
101
+ when : v . descriptor . when ,
102
+ group : v . descriptor . group ,
103
+ order : v . descriptor . order ,
104
+ precondition : v . descriptor . precondition
105
+ } ;
106
+ } ) ) ;
94
107
}
95
108
96
109
private disposables = new DisposableStore ( ) ;
97
110
98
111
constructor (
99
112
private id : string ,
100
113
@IContextKeyService private contextKeyService : IContextKeyService ,
114
+ @IConfigurationResolverService private readonly configurationResolverService : IConfigurationResolverService ,
115
+ @IWorkspaceContextService private readonly workspaceContextService : IWorkspaceContextService
101
116
) {
102
117
contextKeyService . onDidChangeContext ( this . onDidChangeContext , this , this . disposables ) ;
103
118
Event . filter ( viewsRegistry . onDidChangeViewWelcomeContent , id => id === this . id ) ( this . onDidChangeViewWelcomeContent , this , this . disposables ) ;
@@ -228,7 +243,7 @@ export abstract class ViewPane extends Pane implements IView {
228
243
this . menuActions = this . _register ( this . instantiationService . createChild ( new ServiceCollection ( [ IContextKeyService , this . scopedContextKeyService ] ) ) . createInstance ( CompositeMenuActions , options . titleMenuId ?? MenuId . ViewTitle , MenuId . ViewTitleContext , { shouldForwardArgs : ! options . donotForwardArgs } ) ) ;
229
244
this . _register ( this . menuActions . onDidChange ( ( ) => this . updateActions ( ) ) ) ;
230
245
231
- this . viewWelcomeController = new ViewWelcomeController ( this . id , contextKeyService ) ;
246
+ this . viewWelcomeController = this . instantiationService . createInstance ( ViewWelcomeController , this . id ) ;
232
247
}
233
248
234
249
override get headerVisible ( ) : boolean {
@@ -549,7 +564,7 @@ export abstract class ViewPane extends Pane implements IView {
549
564
// Subclasses to implement for saving state
550
565
}
551
566
552
- private updateViewWelcome ( ) : void {
567
+ private async updateViewWelcome ( ) : Promise < void > {
553
568
this . viewWelcomeDisposable . dispose ( ) ;
554
569
555
570
if ( ! this . shouldShowWelcome ( ) ) {
@@ -559,7 +574,7 @@ export abstract class ViewPane extends Pane implements IView {
559
574
return ;
560
575
}
561
576
562
- const contents = this . viewWelcomeController . contents ;
577
+ const contents = await this . viewWelcomeController . contents ;
563
578
564
579
if ( contents . length === 0 ) {
565
580
this . bodyContainer . classList . remove ( 'welcome' ) ;
0 commit comments