diff --git a/packages/core/src/browser/breadcrumbs/breadcrumbs-renderer.tsx b/packages/core/src/browser/breadcrumbs/breadcrumbs-renderer.tsx index 67a096d6e99f2..47758d2d4fdac 100644 --- a/packages/core/src/browser/breadcrumbs/breadcrumbs-renderer.tsx +++ b/packages/core/src/browser/breadcrumbs/breadcrumbs-renderer.tsx @@ -27,6 +27,7 @@ import PerfectScrollbar from 'perfect-scrollbar'; import URI from '../../common/uri'; import { BreadcrumbPopup } from './breadcrumb-popup'; import { DisposableCollection } from '../../common/disposable'; +import { CorePreferences } from '../core-preferences'; export const BreadcrumbsURI = Symbol('BreadcrumbsURI'); @@ -39,6 +40,9 @@ export class BreadcrumbsRenderer extends ReactRenderer { @inject(BreadcrumbRenderer) protected readonly breadcrumbRenderer: BreadcrumbRenderer; + @inject(CorePreferences) + protected readonly corePreferences: CorePreferences; + private breadcrumbs: Breadcrumb[] = []; private popup: BreadcrumbPopup | undefined; @@ -54,6 +58,7 @@ export class BreadcrumbsRenderer extends ReactRenderer { @postConstruct() init(): void { this.toDispose.push(this.breadcrumbsService.onBreadcrumbsChange(uri => { if (this.uri.toString() === uri.toString()) { this.refresh(); } })); + this.toDispose.push(this.corePreferences.onPreferenceChanged(_ => this.refresh())); } dispose(): void { @@ -67,7 +72,11 @@ export class BreadcrumbsRenderer extends ReactRenderer { } async refresh(): Promise { - this.breadcrumbs = await this.breadcrumbsService.getBreadcrumbs(this.uri); + if (this.corePreferences['breadcrumbs.enabled']) { + this.breadcrumbs = await this.breadcrumbsService.getBreadcrumbs(this.uri); + } else { + this.breadcrumbs = []; + } this.render(); if (!this.scrollbar) { diff --git a/packages/core/src/browser/core-preferences.ts b/packages/core/src/browser/core-preferences.ts index 5ab6f0b055390..a9e551ed362d3 100644 --- a/packages/core/src/browser/core-preferences.ts +++ b/packages/core/src/browser/core-preferences.ts @@ -44,6 +44,11 @@ export const corePreferenceSchema: PreferenceSchema = { default: 50, minimum: 0, description: 'Controls the number of recently used commands to keep in history for the command palette. Set to 0 to disable command history.' + }, + 'breadcrumbs.enabled': { + 'type': 'boolean', + 'default': true, + 'description': 'Enable/disable navigation breadcrumbs.' } } }; @@ -52,6 +57,7 @@ export interface CoreConfiguration { 'application.confirmExit': 'never' | 'ifRequired' | 'always'; 'list.openMode': 'singleClick' | 'doubleClick'; 'workbench.commandPalette.history': number; + 'breadcrumbs.enabled': boolean; } export const CorePreferences = Symbol('CorePreferences');