Skip to content

Commit 73a91c0

Browse files
authored
Merge pull request microsoft#78879 from chrismay/56286
microsoft#56286 Add a configuration option to show/hide icons in the breadcrumbs view
2 parents 8ac860d + e133b26 commit 73a91c0

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

src/vs/workbench/browser/parts/editor/breadcrumbs.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ export abstract class BreadcrumbsConfig<T> {
7171
static FilePath = BreadcrumbsConfig._stub<'on' | 'off' | 'last'>('breadcrumbs.filePath');
7272
static SymbolPath = BreadcrumbsConfig._stub<'on' | 'off' | 'last'>('breadcrumbs.symbolPath');
7373
static SymbolSortOrder = BreadcrumbsConfig._stub<'position' | 'name' | 'type'>('breadcrumbs.symbolSortOrder');
74+
static Icons = BreadcrumbsConfig._stub<boolean>('breadcrumbs.icons');
7475

7576
static FileExcludes = BreadcrumbsConfig._stub<glob.IExpression>('files.exclude');
7677

@@ -160,6 +161,11 @@ Registry.as<IConfigurationRegistry>(Extensions.Configuration).registerConfigurat
160161
localize('symbolSortOrder.name', "Show symbol outline in alphabetical order."),
161162
localize('symbolSortOrder.type', "Show symbol outline in symbol type order."),
162163
]
164+
},
165+
'breadcrumbs.icons': {
166+
description: localize('icons', "Render breadcrumb items with icons."),
167+
type: 'boolean',
168+
default: true
163169
}
164170
}
165171
});

src/vs/workbench/browser/parts/editor/breadcrumbsControl.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ class Item extends BreadcrumbsItem {
6969
return false;
7070
}
7171
if (this.element instanceof FileElement && other.element instanceof FileElement) {
72-
return isEqual(this.element.uri, other.element.uri, false);
72+
return (isEqual(this.element.uri, other.element.uri, false) &&
73+
this.options.showFileIcons === other.options.showFileIcons &&
74+
this.options.showSymbolIcons === other.options.showSymbolIcons);
7375
}
7476
if (this.element instanceof TreeElement && other.element instanceof TreeElement) {
7577
return this.element.id === other.element.id;
@@ -143,6 +145,7 @@ export class BreadcrumbsControl {
143145
private readonly _ckBreadcrumbsActive: IContextKey<boolean>;
144146

145147
private readonly _cfUseQuickPick: BreadcrumbsConfig<boolean>;
148+
private readonly _cfShowIcons: BreadcrumbsConfig<boolean>;
146149

147150
readonly domNode: HTMLDivElement;
148151
private readonly _widget: BreadcrumbsWidget;
@@ -185,6 +188,7 @@ export class BreadcrumbsControl {
185188
this._ckBreadcrumbsActive = BreadcrumbsControl.CK_BreadcrumbsActive.bindTo(this._contextKeyService);
186189

187190
this._cfUseQuickPick = BreadcrumbsConfig.UseQuickPick.bindTo(_configurationService);
191+
this._cfShowIcons = BreadcrumbsConfig.Icons.bindTo(_configurationService);
188192

189193
this._disposables.add(breadcrumbsService.register(this._editorGroup.id, this._widget));
190194
}
@@ -196,6 +200,7 @@ export class BreadcrumbsControl {
196200
this._ckBreadcrumbsVisible.reset();
197201
this._ckBreadcrumbsActive.reset();
198202
this._cfUseQuickPick.dispose();
203+
this._cfShowIcons.dispose();
199204
this._widget.dispose();
200205
this.domNode.remove();
201206
}
@@ -246,15 +251,23 @@ export class BreadcrumbsControl {
246251
dom.toggleClass(this.domNode, 'backslash-path', this._labelService.getSeparator(uri.scheme, uri.authority) === '\\');
247252

248253
const updateBreadcrumbs = () => {
249-
const items = model.getElements().map(element => new Item(element, this._options, this._instantiationService));
254+
const showIcons = this._cfShowIcons.getValue();
255+
const options: IBreadcrumbsControlOptions = {
256+
...this._options,
257+
showFileIcons: this._options.showFileIcons && showIcons,
258+
showSymbolIcons: this._options.showSymbolIcons && showIcons
259+
};
260+
const items = model.getElements().map(element => new Item(element, options, this._instantiationService));
250261
this._widget.setItems(items);
251262
this._widget.reveal(items[items.length - 1]);
252263
};
253264
const listener = model.onDidUpdate(updateBreadcrumbs);
265+
const configListener = this._cfShowIcons.onDidChange(updateBreadcrumbs);
254266
updateBreadcrumbs();
255267
this._breadcrumbsDisposables.clear();
256268
this._breadcrumbsDisposables.add(model);
257269
this._breadcrumbsDisposables.add(listener);
270+
this._breadcrumbsDisposables.add(configListener);
258271

259272
// close picker on hide/update
260273
this._breadcrumbsDisposables.add({

0 commit comments

Comments
 (0)