Skip to content

Commit

Permalink
Applied re-view suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
dhuebner committed Feb 9, 2024
1 parent 19af781 commit 7c73dbe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions packages/core/src/browser/shell/tab-bar-decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,21 @@ export class TabBarDecoratorService implements FrontendApplicationContribution {
*/
getDecorations(title: Title<Widget>): WidgetDecoration.Data[] {
const decorators = this.contributions.getContributions();
let all: WidgetDecoration.Data[] = [];
const decorations: WidgetDecoration.Data[] = [];
for (const decorator of decorators) {
const decorations = decorator.decorate(title);
all = all.concat(decorations);
decorations.push(...decorator.decorate(title));
}
if (Navigatable.is(title.owner)) {
const resourceUri = title.owner.getResourceUri();
if (resourceUri) {
const serviceDecorations = this.decorationsService.getDecoration(resourceUri, false);
all.push(...serviceDecorations.map(d => this.toDecorator(d)));
decorations.push(...serviceDecorations.map(d => this.fromDecoration(d)));
}
}
return all;
return decorations;
}

protected toDecorator(decoration: Decoration): WidgetDecoration.Data {
protected fromDecoration(decoration: Decoration): WidgetDecoration.Data {
const colorVariable = decoration.colorId && this.colors.toCssVariableName(decoration.colorId);
return {
tailDecorations: [
Expand Down
6 changes: 3 additions & 3 deletions packages/core/src/browser/shell/tab-bars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import PerfectScrollbar from 'perfect-scrollbar';
import { TabBar, Title, Widget } from '@phosphor/widgets';
import { VirtualElement, h, VirtualDOM, ElementInlineStyle } from '@phosphor/virtualdom';
import { Disposable, DisposableCollection, MenuPath, notEmpty, SelectionService, CommandService, nls } from '../../common';
import { Disposable, DisposableCollection, MenuPath, notEmpty, SelectionService, CommandService, nls, ArrayUtils } from '../../common';
import { ContextMenuRenderer } from '../context-menu-renderer';
import { Signal, Slot } from '@phosphor/signaling';
import { Message, MessageLoop } from '@phosphor/messaging';
Expand Down Expand Up @@ -294,8 +294,8 @@ export class TabBarRenderer extends TabBar.Renderer {
if (!this.corePreferences?.get('workbench.editor.decorations.badges')) {
return [];
}
const tailDecorations = this.getDecorationData(renderData.title, 'tailDecorations')
.filter(acc => acc !== undefined).reduce((acc, current) => acc!.concat(current!), []);
const tailDecorations = ArrayUtils.coalesce(this.getDecorationData(renderData.title, 'tailDecorations'))
.reduce((acc, current) => acc.concat(current), []);
if (tailDecorations === undefined || tailDecorations.length === 0) {
return [];
}
Expand Down

0 comments on commit 7c73dbe

Please sign in to comment.