Skip to content

Commit

Permalink
8992-enabling-view-when-clause:
Browse files Browse the repository at this point in the history
Enabling setting view when clauses with these values: undefined, true, false or expressions.

Signed-off-by: Dan Arad <[email protected]>
  • Loading branch information
danarad05 authored and amiramw committed Mar 21, 2021
1 parent 21e6aac commit 5dc9612
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
return false;
}
const [, view] = viewInfo;
return view.when === undefined || this.contextKeyService.match(view.when);
return view.when === undefined || view.when === 'true' || this.contextKeyService.match(view.when);
}

registerViewContainer(location: string, viewContainer: ViewContainer): Disposable {
Expand Down Expand Up @@ -285,6 +285,7 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
}
const toDispose = new DisposableCollection();

view.when = view.when?.trim();
this.views.set(view.id, [viewContainerId, view]);
toDispose.push(Disposable.create(() => this.views.delete(view.id)));

Expand All @@ -298,7 +299,7 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
}
}));

if (view.when) {
if (view.when && view.when !== 'false' && view.when !== 'true') {
this.viewClauseContexts.set(view.id, this.contextKeyService.parseKeys(view.when));
toDispose.push(Disposable.create(() => this.viewClauseContexts.delete(view.id)));
}
Expand Down

0 comments on commit 5dc9612

Please sign in to comment.