diff --git a/packages/core/src/browser/common-frontend-contribution.ts b/packages/core/src/browser/common-frontend-contribution.ts index 1a920732a89b3..75ff528c82ce7 100644 --- a/packages/core/src/browser/common-frontend-contribution.ts +++ b/packages/core/src/browser/common-frontend-contribution.ts @@ -45,7 +45,7 @@ import { ColorRegistry } from './color-registry'; import { Color } from '../common/color'; import { CoreConfiguration, CorePreferences } from './core-preferences'; import { ThemeService } from './theming'; -import { PreferenceService, PreferenceChangeEvent } from './preferences'; +import { PreferenceService, PreferenceChangeEvent, PreferenceScope } from './preferences'; import { ClipboardService } from './clipboard-service'; import { EncodingRegistry } from './encoding-registry'; import { UTF8 } from '../common/encodings'; @@ -330,6 +330,12 @@ export namespace CommonCommands { id: 'workbench.action.configureLanguage', label: 'Configure Display Language' }); + + export const TOGGLE_BREADCRUMBS = Command.toDefaultLocalizedCommand({ + id: 'breadcrumbs.toggle', + label: 'Toggle Breadcrumbs', + category: VIEW_CATEGORY + }); } export const supportCut = browser.isNative || document.queryCommandSupported('cut'); @@ -931,6 +937,10 @@ export class CommonFrontendContribution implements FrontendApplicationContributi commandRegistry.registerCommand(CommonCommands.CONFIGURE_DISPLAY_LANGUAGE, { execute: () => this.configureDisplayLanguage() }); + commandRegistry.registerCommand(CommonCommands.TOGGLE_BREADCRUMBS, { + execute: () => this.toggleBreadcrumbs(), + isToggled: () => this.isBreadcrumbsEnabled(), + }); commandRegistry.registerCommand(CommonCommands.NEW_UNTITLED_FILE, { execute: async () => { const untitledUri = this.untitledResourceResolver.createUntitledURI('', await this.workingDirProvider.getUserWorkingDir()); @@ -1150,6 +1160,15 @@ export class CommonFrontendContribution implements FrontendApplicationContributi } } + protected toggleBreadcrumbs(): void { + const value: boolean | undefined = this.preferenceService.get('breadcrumbs.enabled'); + this.preferenceService.set('breadcrumbs.enabled', !value, PreferenceScope.User); + } + + protected isBreadcrumbsEnabled(): boolean { + return !!this.preferenceService.get('breadcrumbs.enabled'); + } + protected async confirmRestart(): Promise { const shouldRestart = await new ConfirmDialog({ title: nls.localizeByDefault('A restart is required for the change in display language to take effect.'), diff --git a/packages/editor/src/browser/editor-menu.ts b/packages/editor/src/browser/editor-menu.ts index c1f359a622aff..32bdbc2d2bd9a 100644 --- a/packages/editor/src/browser/editor-menu.ts +++ b/packages/editor/src/browser/editor-menu.ts @@ -145,18 +145,19 @@ export class EditorMenuContribution implements MenuContribution { // Toggle Commands. registry.registerMenuAction(CommonMenus.VIEW_TOGGLE, { commandId: EditorCommands.TOGGLE_WORD_WRAP.id, - label: EditorCommands.TOGGLE_WORD_WRAP.label, order: '0' }); registry.registerMenuAction(CommonMenus.VIEW_TOGGLE, { commandId: EditorCommands.TOGGLE_MINIMAP.id, - label: EditorCommands.TOGGLE_MINIMAP.label, order: '1', }); + registry.registerMenuAction(CommonMenus.VIEW_TOGGLE, { + commandId: CommonCommands.TOGGLE_BREADCRUMBS.id, + order: '2', + }); registry.registerMenuAction(CommonMenus.VIEW_TOGGLE, { commandId: EditorCommands.TOGGLE_RENDER_WHITESPACE.id, - label: EditorCommands.TOGGLE_RENDER_WHITESPACE.label, - order: '2' + order: '3' }); registry.registerMenuAction(CommonMenus.FILE_CLOSE, { commandId: CommonCommands.CLOSE_MAIN_TAB.id,