chore(vscode): update to 1.54.2

This commit is contained in:
Joe Previte
2021-03-11 10:27:10 -07:00
1459 changed files with 53404 additions and 51004 deletions

View File

@@ -5,7 +5,7 @@
import 'vs/css!./media/actions';
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { domEvent } from 'vs/base/browser/event';
import { Color } from 'vs/base/common/color';
@@ -34,7 +34,7 @@ class InspectContextKeysAction extends Action2 {
constructor() {
super({
id: 'workbench.action.inspectContextKeys',
title: { value: nls.localize('inspect context keys', "Inspect Context Keys"), original: 'Inspect Context Keys' },
title: { value: localize('inspect context keys', "Inspect Context Keys"), original: 'Inspect Context Keys' },
category: CATEGORIES.Developer,
f1: true
});
@@ -96,7 +96,7 @@ class ToggleScreencastModeAction extends Action2 {
constructor() {
super({
id: 'workbench.action.toggleScreencastMode',
title: { value: nls.localize('toggle screencast mode', "Toggle Screencast Mode"), original: 'Toggle Screencast Mode' },
title: { value: localize('toggle screencast mode', "Toggle Screencast Mode"), original: 'Toggle Screencast Mode' },
category: CATEGORIES.Developer,
f1: true
});
@@ -241,7 +241,7 @@ class LogStorageAction extends Action2 {
constructor() {
super({
id: 'workbench.action.logStorage',
title: { value: nls.localize({ key: 'logStorage', comment: ['A developer only action to log the contents of the storage for the current window.'] }, "Log Storage Database Contents"), original: 'Log Storage Database Contents' },
title: { value: localize({ key: 'logStorage', comment: ['A developer only action to log the contents of the storage for the current window.'] }, "Log Storage Database Contents"), original: 'Log Storage Database Contents' },
category: CATEGORIES.Developer,
f1: true
});
@@ -257,7 +257,7 @@ class LogWorkingCopiesAction extends Action2 {
constructor() {
super({
id: 'workbench.action.logWorkingCopies',
title: { value: nls.localize({ key: 'logWorkingCopies', comment: ['A developer only action to log the working copies that exist.'] }, "Log Working Copies"), original: 'Log Working Copies' },
title: { value: localize({ key: 'logWorkingCopies', comment: ['A developer only action to log the working copies that exist.'] }, "Log Working Copies"), original: 'Log Working Copies' },
category: CATEGORIES.Developer,
f1: true
});
@@ -291,7 +291,7 @@ const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationE
configurationRegistry.registerConfiguration({
id: 'screencastMode',
order: 9,
title: nls.localize('screencastModeConfigurationTitle', "Screencast Mode"),
title: localize('screencastModeConfigurationTitle', "Screencast Mode"),
type: 'object',
properties: {
'screencastMode.verticalOffset': {
@@ -299,18 +299,18 @@ configurationRegistry.registerConfiguration({
default: 20,
minimum: 0,
maximum: 90,
description: nls.localize('screencastMode.location.verticalPosition', "Controls the vertical offset of the screencast mode overlay from the bottom as a percentage of the workbench height.")
description: localize('screencastMode.location.verticalPosition', "Controls the vertical offset of the screencast mode overlay from the bottom as a percentage of the workbench height.")
},
'screencastMode.fontSize': {
type: 'number',
default: 56,
minimum: 20,
maximum: 100,
description: nls.localize('screencastMode.fontSize', "Controls the font size (in pixels) of the screencast mode keyboard.")
description: localize('screencastMode.fontSize', "Controls the font size (in pixels) of the screencast mode keyboard.")
},
'screencastMode.onlyKeyboardShortcuts': {
type: 'boolean',
description: nls.localize('screencastMode.onlyKeyboardShortcuts', "Only show keyboard shortcuts in screencast mode."),
description: localize('screencastMode.onlyKeyboardShortcuts', "Only show keyboard shortcuts in screencast mode."),
default: false
},
'screencastMode.keyboardOverlayTimeout': {
@@ -318,20 +318,20 @@ configurationRegistry.registerConfiguration({
default: 800,
minimum: 500,
maximum: 5000,
description: nls.localize('screencastMode.keyboardOverlayTimeout', "Controls how long (in milliseconds) the keyboard overlay is shown in screencast mode.")
description: localize('screencastMode.keyboardOverlayTimeout', "Controls how long (in milliseconds) the keyboard overlay is shown in screencast mode.")
},
'screencastMode.mouseIndicatorColor': {
type: 'string',
format: 'color-hex',
default: '#FF0000',
description: nls.localize('screencastMode.mouseIndicatorColor', "Controls the color in hex (#RGB, #RGBA, #RRGGBB or #RRGGBBAA) of the mouse indicator in screencast mode.")
description: localize('screencastMode.mouseIndicatorColor', "Controls the color in hex (#RGB, #RGBA, #RRGGBB or #RRGGBBAA) of the mouse indicator in screencast mode.")
},
'screencastMode.mouseIndicatorSize': {
type: 'number',
default: 20,
minimum: 20,
maximum: 100,
description: nls.localize('screencastMode.mouseIndicatorSize', "Controls the size (in pixels) of the mouse indicator in screencast mode.")
description: localize('screencastMode.mouseIndicatorSize', "Controls the size (in pixels) of the mouse indicator in screencast mode.")
},
}
});

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import product from 'vs/platform/product/common/product';
import { isMacintosh, isLinux, language } from 'vs/base/common/platform';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
@@ -24,7 +24,7 @@ class KeybindingsReferenceAction extends Action2 {
constructor() {
super({
id: KeybindingsReferenceAction.ID,
title: { value: nls.localize('keybindingsReference', "Keyboard Shortcuts Reference"), original: 'Keyboard Shortcuts Reference' },
title: { value: localize('keybindingsReference', "Keyboard Shortcuts Reference"), original: 'Keyboard Shortcuts Reference' },
category: CATEGORIES.Help,
f1: true,
keybinding: {
@@ -54,7 +54,7 @@ class OpenDocumentationUrlAction extends Action2 {
constructor() {
super({
id: OpenDocumentationUrlAction.ID,
title: { value: nls.localize('openDocumentationUrl', "Documentation"), original: 'Documentation' },
title: { value: localize('openDocumentationUrl', "Documentation"), original: 'Documentation' },
category: CATEGORIES.Help,
f1: true
});
@@ -78,7 +78,7 @@ class OpenIntroductoryVideosUrlAction extends Action2 {
constructor() {
super({
id: OpenIntroductoryVideosUrlAction.ID,
title: { value: nls.localize('openIntroductoryVideosUrl', "Introductory Videos"), original: 'Introductory Videos' },
title: { value: localize('openIntroductoryVideosUrl', "Introductory Videos"), original: 'Introductory Videos' },
category: CATEGORIES.Help,
f1: true
});
@@ -102,7 +102,7 @@ class OpenTipsAndTricksUrlAction extends Action2 {
constructor() {
super({
id: OpenTipsAndTricksUrlAction.ID,
title: { value: nls.localize('openTipsAndTricksUrl', "Tips and Tricks"), original: 'Tips and Tricks' },
title: { value: localize('openTipsAndTricksUrl', "Tips and Tricks"), original: 'Tips and Tricks' },
category: CATEGORIES.Help,
f1: true
});
@@ -126,7 +126,7 @@ class OpenNewsletterSignupUrlAction extends Action2 {
constructor() {
super({
id: OpenNewsletterSignupUrlAction.ID,
title: { value: nls.localize('newsletterSignup', "Signup for the VS Code Newsletter"), original: 'Signup for the VS Code Newsletter' },
title: { value: localize('newsletterSignup', "Signup for the VS Code Newsletter"), original: 'Signup for the VS Code Newsletter' },
category: CATEGORIES.Help,
f1: true
});
@@ -151,7 +151,7 @@ class OpenTwitterUrlAction extends Action2 {
constructor() {
super({
id: OpenTwitterUrlAction.ID,
title: { value: nls.localize('openTwitterUrl', "Join Us on Twitter"), original: 'Join Us on Twitter' },
title: { value: localize('openTwitterUrl', "Join Us on Twitter"), original: 'Join Us on Twitter' },
category: CATEGORIES.Help,
f1: true
});
@@ -175,7 +175,7 @@ class OpenRequestFeatureUrlAction extends Action2 {
constructor() {
super({
id: OpenRequestFeatureUrlAction.ID,
title: { value: nls.localize('openUserVoiceUrl', "Search Feature Requests"), original: 'Search Feature Requests' },
title: { value: localize('openUserVoiceUrl', "Search Feature Requests"), original: 'Search Feature Requests' },
category: CATEGORIES.Help,
f1: true
});
@@ -199,7 +199,7 @@ class OpenLicenseUrlAction extends Action2 {
constructor() {
super({
id: OpenLicenseUrlAction.ID,
title: { value: nls.localize('openLicenseUrl', "View License"), original: 'View License' },
title: { value: localize('openLicenseUrl', "View License"), original: 'View License' },
category: CATEGORIES.Help,
f1: true
});
@@ -228,7 +228,7 @@ class OpenPrivacyStatementUrlAction extends Action2 {
constructor() {
super({
id: OpenPrivacyStatementUrlAction.ID,
title: { value: nls.localize('openPrivacyStatement', "Privacy Statement"), original: 'Privacy Statement' },
title: { value: localize('openPrivacyStatement', "Privacy Statement"), original: 'Privacy Statement' },
category: CATEGORIES.Help,
f1: true
});
@@ -296,7 +296,7 @@ if (OpenDocumentationUrlAction.AVAILABLE) {
group: '1_welcome',
command: {
id: OpenDocumentationUrlAction.ID,
title: nls.localize({ key: 'miDocumentation', comment: ['&& denotes a mnemonic'] }, "&&Documentation")
title: localize({ key: 'miDocumentation', comment: ['&& denotes a mnemonic'] }, "&&Documentation")
},
order: 3
});
@@ -308,7 +308,7 @@ if (KeybindingsReferenceAction.AVAILABLE) {
group: '2_reference',
command: {
id: KeybindingsReferenceAction.ID,
title: nls.localize({ key: 'miKeyboardShortcuts', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts Reference")
title: localize({ key: 'miKeyboardShortcuts', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts Reference")
},
order: 1
});
@@ -319,7 +319,7 @@ if (OpenIntroductoryVideosUrlAction.AVAILABLE) {
group: '2_reference',
command: {
id: OpenIntroductoryVideosUrlAction.ID,
title: nls.localize({ key: 'miIntroductoryVideos', comment: ['&& denotes a mnemonic'] }, "Introductory &&Videos")
title: localize({ key: 'miIntroductoryVideos', comment: ['&& denotes a mnemonic'] }, "Introductory &&Videos")
},
order: 2
});
@@ -330,7 +330,7 @@ if (OpenTipsAndTricksUrlAction.AVAILABLE) {
group: '2_reference',
command: {
id: OpenTipsAndTricksUrlAction.ID,
title: nls.localize({ key: 'miTipsAndTricks', comment: ['&& denotes a mnemonic'] }, "Tips and Tri&&cks")
title: localize({ key: 'miTipsAndTricks', comment: ['&& denotes a mnemonic'] }, "Tips and Tri&&cks")
},
order: 3
});
@@ -342,7 +342,7 @@ if (OpenTwitterUrlAction.AVAILABLE) {
group: '3_feedback',
command: {
id: OpenTwitterUrlAction.ID,
title: nls.localize({ key: 'miTwitter', comment: ['&& denotes a mnemonic'] }, "&&Join Us on Twitter")
title: localize({ key: 'miTwitter', comment: ['&& denotes a mnemonic'] }, "&&Join Us on Twitter")
},
order: 1
});
@@ -353,7 +353,7 @@ if (OpenRequestFeatureUrlAction.AVAILABLE) {
group: '3_feedback',
command: {
id: OpenRequestFeatureUrlAction.ID,
title: nls.localize({ key: 'miUserVoice', comment: ['&& denotes a mnemonic'] }, "&&Search Feature Requests")
title: localize({ key: 'miUserVoice', comment: ['&& denotes a mnemonic'] }, "&&Search Feature Requests")
},
order: 2
});
@@ -365,7 +365,7 @@ if (OpenLicenseUrlAction.AVAILABLE) {
group: '4_legal',
command: {
id: OpenLicenseUrlAction.ID,
title: nls.localize({ key: 'miLicense', comment: ['&& denotes a mnemonic'] }, "View &&License")
title: localize({ key: 'miLicense', comment: ['&& denotes a mnemonic'] }, "View &&License")
},
order: 1
});
@@ -376,7 +376,7 @@ if (OpenPrivacyStatementUrlAction.AVAILABE) {
group: '4_legal',
command: {
id: OpenPrivacyStatementUrlAction.ID,
title: nls.localize({ key: 'miPrivacyStatement', comment: ['&& denotes a mnemonic'] }, "Privac&&y Statement")
title: localize({ key: 'miPrivacyStatement', comment: ['&& denotes a mnemonic'] }, "Privac&&y Statement")
},
order: 2
});

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { Registry } from 'vs/platform/registry/common/platform';
import { Action } from 'vs/base/common/actions';
import { SyncActionDescriptor, MenuId, MenuRegistry, registerAction2, Action2 } from 'vs/platform/actions/common/actions';
@@ -33,7 +33,7 @@ class CloseSidebarAction extends Action2 {
constructor() {
super({
id: 'workbench.action.closeSidebar',
title: { value: nls.localize('closeSidebar', "Close Side Bar"), original: 'Close Side Bar' },
title: { value: localize('closeSidebar', "Close Side Bar"), original: 'Close Side Bar' },
category: CATEGORIES.View,
f1: true
});
@@ -51,7 +51,7 @@ registerAction2(CloseSidebarAction);
export class ToggleActivityBarVisibilityAction extends Action2 {
static readonly ID = 'workbench.action.toggleActivityBarVisibility';
static readonly LABEL = nls.localize('toggleActivityBar', "Toggle Activity Bar Visibility");
static readonly LABEL = localize('toggleActivityBar', "Toggle Activity Bar Visibility");
private static readonly activityBarVisibleKey = 'workbench.activityBar.visible';
@@ -81,7 +81,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '2_workbench_layout',
command: {
id: ToggleActivityBarVisibilityAction.ID,
title: nls.localize({ key: 'miShowActivityBar', comment: ['&& denotes a mnemonic'] }, "Show &&Activity Bar"),
title: localize({ key: 'miShowActivityBar', comment: ['&& denotes a mnemonic'] }, "Show &&Activity Bar"),
toggled: ContextKeyExpr.equals('config.workbench.activityBar.visible', true)
},
order: 4
@@ -96,7 +96,7 @@ class ToggleCenteredLayout extends Action2 {
constructor() {
super({
id: ToggleCenteredLayout.ID,
title: { value: nls.localize('toggleCenteredLayout', "Toggle Centered Layout"), original: 'Toggle Centered Layout' },
title: { value: localize('toggleCenteredLayout', "Toggle Centered Layout"), original: 'Toggle Centered Layout' },
category: CATEGORIES.View,
f1: true
});
@@ -115,7 +115,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '1_toggle_view',
command: {
id: ToggleCenteredLayout.ID,
title: nls.localize({ key: 'miToggleCenteredLayout', comment: ['&& denotes a mnemonic'] }, "&&Centered Layout"),
title: localize({ key: 'miToggleCenteredLayout', comment: ['&& denotes a mnemonic'] }, "&&Centered Layout"),
toggled: IsCenteredLayoutContext
},
order: 3
@@ -126,7 +126,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
export class ToggleSidebarPositionAction extends Action {
static readonly ID = 'workbench.action.toggleSidebarPosition';
static readonly LABEL = nls.localize('toggleSidebarPosition', "Toggle Side Bar Position");
static readonly LABEL = localize('toggleSidebarPosition', "Toggle Side Bar Position");
private static readonly sidebarPositionConfigurationKey = 'workbench.sideBar.location';
@@ -147,7 +147,7 @@ export class ToggleSidebarPositionAction extends Action {
}
static getLabel(layoutService: IWorkbenchLayoutService): string {
return layoutService.getSideBarPosition() === Position.LEFT ? nls.localize('moveSidebarRight', "Move Side Bar Right") : nls.localize('moveSidebarLeft', "Move Side Bar Left");
return layoutService.getSideBarPosition() === Position.LEFT ? localize('moveSidebarRight', "Move Side Bar Right") : localize('moveSidebarLeft', "Move Side Bar Left");
}
}
@@ -155,7 +155,7 @@ registerAction2(class extends Action2 {
constructor() {
super({
id: ToggleSidebarPositionAction.ID,
title: { value: nls.localize('toggleSidebarPosition', "Toggle Side Bar Position"), original: 'Toggle Side Bar Position' },
title: { value: localize('toggleSidebarPosition', "Toggle Side Bar Position"), original: 'Toggle Side Bar Position' },
category: CATEGORIES.View,
f1: true
});
@@ -170,7 +170,7 @@ MenuRegistry.appendMenuItems([{
group: '3_workbench_layout_move',
command: {
id: ToggleSidebarPositionAction.ID,
title: nls.localize('move sidebar right', "Move Side Bar Right")
title: localize('move sidebar right', "Move Side Bar Right")
},
when: ContextKeyExpr.and(ContextKeyExpr.notEquals('config.workbench.sideBar.location', 'right'), ContextKeyExpr.equals('viewContainerLocation', ViewContainerLocationToString(ViewContainerLocation.Sidebar))),
order: 1
@@ -181,7 +181,7 @@ MenuRegistry.appendMenuItems([{
group: '3_workbench_layout_move',
command: {
id: ToggleSidebarPositionAction.ID,
title: nls.localize('move sidebar right', "Move Side Bar Right")
title: localize('move sidebar right', "Move Side Bar Right")
},
when: ContextKeyExpr.and(ContextKeyExpr.notEquals('config.workbench.sideBar.location', 'right'), ContextKeyExpr.equals('viewLocation', ViewContainerLocationToString(ViewContainerLocation.Sidebar))),
order: 1
@@ -192,7 +192,7 @@ MenuRegistry.appendMenuItems([{
group: '3_workbench_layout_move',
command: {
id: ToggleSidebarPositionAction.ID,
title: nls.localize('move sidebar left', "Move Side Bar Left")
title: localize('move sidebar left', "Move Side Bar Left")
},
when: ContextKeyExpr.and(ContextKeyExpr.equals('config.workbench.sideBar.location', 'right'), ContextKeyExpr.equals('viewContainerLocation', ViewContainerLocationToString(ViewContainerLocation.Sidebar))),
order: 1
@@ -203,7 +203,7 @@ MenuRegistry.appendMenuItems([{
group: '3_workbench_layout_move',
command: {
id: ToggleSidebarPositionAction.ID,
title: nls.localize('move sidebar left', "Move Side Bar Left")
title: localize('move sidebar left', "Move Side Bar Left")
},
when: ContextKeyExpr.and(ContextKeyExpr.equals('config.workbench.sideBar.location', 'right'), ContextKeyExpr.equals('viewLocation', ViewContainerLocationToString(ViewContainerLocation.Sidebar))),
order: 1
@@ -214,7 +214,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '3_workbench_layout_move',
command: {
id: ToggleSidebarPositionAction.ID,
title: nls.localize({ key: 'miMoveSidebarRight', comment: ['&& denotes a mnemonic'] }, "&&Move Side Bar Right")
title: localize({ key: 'miMoveSidebarRight', comment: ['&& denotes a mnemonic'] }, "&&Move Side Bar Right")
},
when: ContextKeyExpr.notEquals('config.workbench.sideBar.location', 'right'),
order: 2
@@ -224,7 +224,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '3_workbench_layout_move',
command: {
id: ToggleSidebarPositionAction.ID,
title: nls.localize({ key: 'miMoveSidebarLeft', comment: ['&& denotes a mnemonic'] }, "&&Move Side Bar Left")
title: localize({ key: 'miMoveSidebarLeft', comment: ['&& denotes a mnemonic'] }, "&&Move Side Bar Left")
},
when: ContextKeyExpr.equals('config.workbench.sideBar.location', 'right'),
order: 2
@@ -234,7 +234,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
export class ToggleEditorVisibilityAction extends Action {
static readonly ID = 'workbench.action.toggleEditorVisibility';
static readonly LABEL = nls.localize('toggleEditor', "Toggle Editor Area Visibility");
static readonly LABEL = localize('toggleEditor', "Toggle Editor Area Visibility");
constructor(
id: string,
@@ -255,7 +255,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '2_workbench_layout',
command: {
id: ToggleEditorVisibilityAction.ID,
title: nls.localize({ key: 'miShowEditorArea', comment: ['&& denotes a mnemonic'] }, "Show &&Editor Area"),
title: localize({ key: 'miShowEditorArea', comment: ['&& denotes a mnemonic'] }, "Show &&Editor Area"),
toggled: EditorAreaVisibleContext
},
order: 5
@@ -263,7 +263,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
group: '2_appearance',
title: nls.localize({ key: 'miAppearance', comment: ['&& denotes a mnemonic'] }, "&&Appearance"),
title: localize({ key: 'miAppearance', comment: ['&& denotes a mnemonic'] }, "&&Appearance"),
submenu: MenuId.MenubarAppearanceMenu,
order: 1
});
@@ -273,7 +273,7 @@ registerAction2(class extends Action2 {
constructor() {
super({
id: TOGGLE_SIDEBAR_VISIBILITY_ACTION_ID,
title: { value: nls.localize('toggleSidebar', "Toggle Side Bar Visibility"), original: 'Toggle Side Bar Visibility' },
title: { value: localize('toggleSidebar', "Toggle Side Bar Visibility"), original: 'Toggle Side Bar Visibility' },
category: CATEGORIES.View,
f1: true,
keybinding: {
@@ -293,7 +293,7 @@ MenuRegistry.appendMenuItems([{
group: '3_workbench_layout_move',
command: {
id: TOGGLE_SIDEBAR_VISIBILITY_ACTION_ID,
title: nls.localize('compositePart.hideSideBarLabel', "Hide Side Bar"),
title: localize('compositePart.hideSideBarLabel', "Hide Side Bar"),
},
when: ContextKeyExpr.and(SideBarVisibleContext, ContextKeyExpr.equals('viewContainerLocation', ViewContainerLocationToString(ViewContainerLocation.Sidebar))),
order: 2
@@ -304,7 +304,7 @@ MenuRegistry.appendMenuItems([{
group: '3_workbench_layout_move',
command: {
id: TOGGLE_SIDEBAR_VISIBILITY_ACTION_ID,
title: nls.localize('compositePart.hideSideBarLabel', "Hide Side Bar"),
title: localize('compositePart.hideSideBarLabel', "Hide Side Bar"),
},
when: ContextKeyExpr.and(SideBarVisibleContext, ContextKeyExpr.equals('viewLocation', ViewContainerLocationToString(ViewContainerLocation.Sidebar))),
order: 2
@@ -315,7 +315,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '2_workbench_layout',
command: {
id: TOGGLE_SIDEBAR_VISIBILITY_ACTION_ID,
title: nls.localize({ key: 'miShowSidebar', comment: ['&& denotes a mnemonic'] }, "Show &&Side Bar"),
title: localize({ key: 'miShowSidebar', comment: ['&& denotes a mnemonic'] }, "Show &&Side Bar"),
toggled: SideBarVisibleContext
},
order: 1
@@ -326,7 +326,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
export class ToggleStatusbarVisibilityAction extends Action {
static readonly ID = 'workbench.action.toggleStatusbarVisibility';
static readonly LABEL = nls.localize('toggleStatusbar', "Toggle Status Bar Visibility");
static readonly LABEL = localize('toggleStatusbar', "Toggle Status Bar Visibility");
private static readonly statusbarVisibleKey = 'workbench.statusBar.visible';
@@ -353,7 +353,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '2_workbench_layout',
command: {
id: ToggleStatusbarVisibilityAction.ID,
title: nls.localize({ key: 'miShowStatusbar', comment: ['&& denotes a mnemonic'] }, "Show S&&tatus Bar"),
title: localize({ key: 'miShowStatusbar', comment: ['&& denotes a mnemonic'] }, "Show S&&tatus Bar"),
toggled: ContextKeyExpr.equals('config.workbench.statusBar.visible', true)
},
order: 3
@@ -364,7 +364,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
class ToggleTabsVisibilityAction extends Action {
static readonly ID = 'workbench.action.toggleTabsVisibility';
static readonly LABEL = nls.localize('toggleTabs', "Toggle Tab Visibility");
static readonly LABEL = localize('toggleTabs', "Toggle Tab Visibility");
private static readonly tabsVisibleKey = 'workbench.editor.showTabs';
@@ -395,7 +395,7 @@ registry.registerWorkbenchAction(SyncActionDescriptor.from(ToggleTabsVisibilityA
class ToggleZenMode extends Action {
static readonly ID = 'workbench.action.toggleZenMode';
static readonly LABEL = nls.localize('toggleZenMode', "Toggle Zen Mode");
static readonly LABEL = localize('toggleZenMode', "Toggle Zen Mode");
constructor(
id: string,
@@ -416,7 +416,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '1_toggle_view',
command: {
id: ToggleZenMode.ID,
title: nls.localize('miToggleZenMode', "Zen Mode"),
title: localize('miToggleZenMode', "Zen Mode"),
toggled: InEditorZenModeContext
},
order: 2
@@ -438,7 +438,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
export class ToggleMenuBarAction extends Action {
static readonly ID = 'workbench.action.toggleMenuBar';
static readonly LABEL = nls.localize('toggleMenuBar', "Toggle Menu Bar");
static readonly LABEL = localize('toggleMenuBar', "Toggle Menu Bar");
constructor(
id: string,
@@ -461,8 +461,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '2_workbench_layout',
command: {
id: ToggleMenuBarAction.ID,
title: nls.localize({ key: 'miShowMenuBar', comment: ['&& denotes a mnemonic'] }, "Show Menu &&Bar"),
toggled: ContextKeyExpr.and(IsMacNativeContext.toNegated(), ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'hidden'), ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'toggle'))
title: localize({ key: 'miShowMenuBar', comment: ['&& denotes a mnemonic'] }, "Show Menu &&Bar"),
toggled: ContextKeyExpr.and(IsMacNativeContext.toNegated(), ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'hidden'), ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'toggle'), ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'compact'))
},
when: IsMacNativeContext.toNegated(),
order: 0
@@ -472,7 +472,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
export class ResetViewLocationsAction extends Action {
static readonly ID = 'workbench.action.resetViewLocations';
static readonly LABEL = nls.localize('resetViewLocations', "Reset View Locations");
static readonly LABEL = localize('resetViewLocations', "Reset View Locations");
constructor(
id: string,
@@ -489,40 +489,10 @@ export class ResetViewLocationsAction extends Action {
registry.registerWorkbenchAction(SyncActionDescriptor.from(ResetViewLocationsAction), 'View: Reset View Locations', CATEGORIES.View.value);
// --- Toggle View with Command
export class ToggleViewAction extends Action {
constructor(
id: string,
label: string,
private readonly viewId: string,
@IViewsService protected viewsService: IViewsService,
@IViewDescriptorService protected viewDescriptorService: IViewDescriptorService,
@IContextKeyService protected contextKeyService: IContextKeyService,
@IWorkbenchLayoutService private layoutService: IWorkbenchLayoutService,
) {
super(id, label);
}
async run(): Promise<void> {
const focusedViewId = FocusedViewContext.getValue(this.contextKeyService);
if (focusedViewId === this.viewId) {
if (this.viewDescriptorService.getViewLocationById(this.viewId) === ViewContainerLocation.Sidebar) {
this.layoutService.setSideBarHidden(true);
} else {
this.layoutService.setPanelHidden(true);
}
} else {
this.viewsService.openView(this.viewId, true);
}
}
}
// --- Move View with Command
export class MoveViewAction extends Action {
static readonly ID = 'workbench.action.moveView';
static readonly LABEL = nls.localize('moveView', "Move View");
static readonly LABEL = localize('moveView', "Move View");
constructor(
id: string,
@@ -551,7 +521,7 @@ export class MoveViewAction extends Action {
if (!hasAddedView) {
results.push({
type: 'separator',
label: nls.localize('sidebarContainer', "Side Bar / {0}", containerModel.title)
label: localize('sidebarContainer', "Side Bar / {0}", containerModel.title)
});
hasAddedView = true;
}
@@ -575,7 +545,7 @@ export class MoveViewAction extends Action {
if (!hasAddedView) {
results.push({
type: 'separator',
label: nls.localize('panelContainer', "Panel / {0}", containerModel.title)
label: localize('panelContainer', "Panel / {0}", containerModel.title)
});
hasAddedView = true;
}
@@ -593,7 +563,7 @@ export class MoveViewAction extends Action {
private async getView(viewId?: string): Promise<string> {
const quickPick = this.quickInputService.createQuickPick();
quickPick.placeholder = nls.localize('moveFocusedView.selectView', "Select a View to Move");
quickPick.placeholder = localize('moveFocusedView.selectView', "Select a View to Move");
quickPick.items = this.getViewItems();
quickPick.selectedItems = quickPick.items.filter(item => (item as IQuickPickItem).id === viewId) as IQuickPickItem[];
@@ -638,7 +608,7 @@ registry.registerWorkbenchAction(SyncActionDescriptor.from(MoveViewAction), 'Vie
// --- Move Focused View with Command
export class MoveFocusedViewAction extends Action {
static readonly ID = 'workbench.action.moveFocusedView';
static readonly LABEL = nls.localize('moveFocusedView', "Move Focused View");
static readonly LABEL = localize('moveFocusedView', "Move Focused View");
constructor(
id: string,
@@ -658,19 +628,19 @@ export class MoveFocusedViewAction extends Action {
const focusedViewId = viewId || FocusedViewContext.getValue(this.contextKeyService);
if (focusedViewId === undefined || focusedViewId.trim() === '') {
this.notificationService.error(nls.localize('moveFocusedView.error.noFocusedView', "There is no view currently focused."));
this.notificationService.error(localize('moveFocusedView.error.noFocusedView', "There is no view currently focused."));
return;
}
const viewDescriptor = this.viewDescriptorService.getViewDescriptorById(focusedViewId);
if (!viewDescriptor || !viewDescriptor.canMoveView) {
this.notificationService.error(nls.localize('moveFocusedView.error.nonMovableView', "The currently focused view is not movable."));
this.notificationService.error(localize('moveFocusedView.error.nonMovableView', "The currently focused view is not movable."));
return;
}
const quickPick = this.quickInputService.createQuickPick();
quickPick.placeholder = nls.localize('moveFocusedView.selectDestination', "Select a Destination for the View");
quickPick.title = nls.localize({ key: 'moveFocusedView.title', comment: ['{0} indicates the title of the view the user has selected to move.'] }, "View: Move {0}", viewDescriptor.name);
quickPick.placeholder = localize('moveFocusedView.selectDestination', "Select a Destination for the View");
quickPick.title = localize({ key: 'moveFocusedView.title', comment: ['{0} indicates the title of the view the user has selected to move.'] }, "View: Move {0}", viewDescriptor.name);
const items: Array<IQuickPickItem | IQuickPickSeparator> = [];
const currentContainer = this.viewDescriptorService.getViewContainerByViewId(focusedViewId)!;
@@ -680,20 +650,20 @@ export class MoveFocusedViewAction extends Action {
if (!(isViewSolo && currentLocation === ViewContainerLocation.Panel)) {
items.push({
id: '_.panel.newcontainer',
label: nls.localize({ key: 'moveFocusedView.newContainerInPanel', comment: ['Creates a new top-level tab in the panel.'] }, "New Panel Entry"),
label: localize({ key: 'moveFocusedView.newContainerInPanel', comment: ['Creates a new top-level tab in the panel.'] }, "New Panel Entry"),
});
}
if (!(isViewSolo && currentLocation === ViewContainerLocation.Sidebar)) {
items.push({
id: '_.sidebar.newcontainer',
label: nls.localize('moveFocusedView.newContainerInSidebar', "New Side Bar Entry")
label: localize('moveFocusedView.newContainerInSidebar', "New Side Bar Entry")
});
}
items.push({
type: 'separator',
label: nls.localize('sidebar', "Side Bar")
label: localize('sidebar', "Side Bar")
});
const pinnedViewlets = this.activityBarService.getVisibleViewContainerIds();
@@ -708,13 +678,13 @@ export class MoveFocusedViewAction extends Action {
.map(viewletId => {
return {
id: viewletId,
label: this.viewDescriptorService.getViewContainerById(viewletId)!.name
label: this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerById(viewletId)!)!.title
};
}));
items.push({
type: 'separator',
label: nls.localize('panel', "Panel")
label: localize('panel', "Panel")
});
const pinnedPanels = this.panelService.getPinnedPanels();
@@ -729,7 +699,7 @@ export class MoveFocusedViewAction extends Action {
.map(panel => {
return {
id: panel.id,
label: this.viewDescriptorService.getViewContainerById(panel.id)!.name
label: this.viewDescriptorService.getViewContainerModel(this.viewDescriptorService.getViewContainerById(panel.id)!)!.title
};
}));
@@ -761,7 +731,7 @@ registry.registerWorkbenchAction(SyncActionDescriptor.from(MoveFocusedViewAction
// --- Reset View Location with Command
export class ResetFocusedViewLocationAction extends Action {
static readonly ID = 'workbench.action.resetFocusedViewLocation';
static readonly LABEL = nls.localize('resetFocusedViewLocation', "Reset Focused View Location");
static readonly LABEL = localize('resetFocusedViewLocation', "Reset Focused View Location");
constructor(
id: string,
@@ -783,7 +753,7 @@ export class ResetFocusedViewLocationAction extends Action {
}
if (!viewDescriptor) {
this.notificationService.error(nls.localize('resetFocusedView.error.noFocusedView', "There is no view currently focused."));
this.notificationService.error(localize('resetFocusedView.error.noFocusedView', "There is no view currently focused."));
return;
}
@@ -837,7 +807,7 @@ export class IncreaseViewSizeAction extends BaseResizeViewAction {
constructor() {
super({
id: 'workbench.action.increaseViewSize',
title: { value: nls.localize('increaseViewSize', "Increase Current View Size"), original: 'Increase Current View Size' },
title: { value: localize('increaseViewSize', "Increase Current View Size"), original: 'Increase Current View Size' },
f1: true
});
}
@@ -852,7 +822,7 @@ export class IncreaseViewWidthAction extends BaseResizeViewAction {
constructor() {
super({
id: 'workbench.action.increaseViewWidth',
title: { value: nls.localize('increaseEditorWidth', "Increase Editor Width"), original: 'Increase Editor Width' },
title: { value: localize('increaseEditorWidth', "Increase Editor Width"), original: 'Increase Editor Width' },
f1: true
});
}
@@ -867,7 +837,7 @@ export class IncreaseViewHeightAction extends BaseResizeViewAction {
constructor() {
super({
id: 'workbench.action.increaseViewHeight',
title: { value: nls.localize('increaseEditorHeight', "Increase Editor Height"), original: 'Increase Editor Height' },
title: { value: localize('increaseEditorHeight', "Increase Editor Height"), original: 'Increase Editor Height' },
f1: true
});
}
@@ -881,7 +851,7 @@ export class DecreaseViewSizeAction extends BaseResizeViewAction {
constructor() {
super({
id: 'workbench.action.decreaseViewSize',
title: { value: nls.localize('decreaseViewSize', "Decrease Current View Size"), original: 'Decrease Current View Size' },
title: { value: localize('decreaseViewSize', "Decrease Current View Size"), original: 'Decrease Current View Size' },
f1: true
});
}
@@ -895,7 +865,7 @@ export class DecreaseViewWidthAction extends BaseResizeViewAction {
constructor() {
super({
id: 'workbench.action.decreaseViewWidth',
title: { value: nls.localize('decreaseEditorWidth', "Decrease Editor Width"), original: 'Decrease Editor Width' },
title: { value: localize('decreaseEditorWidth', "Decrease Editor Width"), original: 'Decrease Editor Width' },
f1: true
});
}
@@ -911,7 +881,7 @@ export class DecreaseViewHeightAction extends BaseResizeViewAction {
constructor() {
super({
id: 'workbench.action.decreaseViewHeight',
title: { value: nls.localize('decreaseEditorHeight', "Decrease Editor Height"), original: 'Decrease Editor Height' },
title: { value: localize('decreaseEditorHeight', "Decrease Editor Height"), original: 'Decrease Editor Height' },
f1: true
});
}

View File

@@ -7,7 +7,7 @@ import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { List } from 'vs/base/browser/ui/list/listWidget';
import { WorkbenchListFocusContextKey, IListService, WorkbenchListSupportsMultiSelectContextKey, ListWidget, WorkbenchListHasSelectionOrFocus, getSelectionKeyboardEvent } from 'vs/platform/list/browser/listService';
import { WorkbenchListFocusContextKey, IListService, WorkbenchListSupportsMultiSelectContextKey, ListWidget, WorkbenchListHasSelectionOrFocus, getSelectionKeyboardEvent, WorkbenchListWidget } from 'vs/platform/list/browser/listService';
import { PagedList } from 'vs/base/browser/ui/list/listPaging';
import { range } from 'vs/base/common/arrays';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
@@ -16,6 +16,7 @@ import { AsyncDataTree } from 'vs/base/browser/ui/tree/asyncDataTree';
import { DataTree } from 'vs/base/browser/ui/tree/dataTree';
import { ITreeNode } from 'vs/base/browser/ui/tree/tree';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { Table } from 'vs/base/browser/ui/table/tableWidget';
function ensureDOMFocus(widget: ListWidget | undefined): void {
// it can happen that one of the commands is executed while
@@ -32,7 +33,7 @@ function focusDown(accessor: ServicesAccessor, arg2?: number, loop: boolean = fa
const count = typeof arg2 === 'number' ? arg2 : 1;
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
const list = focused;
list.focusNext(count);
@@ -71,10 +72,10 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
handler: (accessor, arg2) => focusDown(accessor, arg2)
});
function expandMultiSelection(focused: List<unknown> | PagedList<unknown> | ObjectTree<unknown, unknown> | DataTree<unknown, unknown, unknown> | AsyncDataTree<unknown, unknown, unknown>, previousFocus: unknown): void {
function expandMultiSelection(focused: WorkbenchListWidget, previousFocus: unknown): void {
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
const list = focused;
const focus = list.getFocus() ? list.getFocus()[0] : undefined;
@@ -118,7 +119,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const focused = accessor.get(IListService).lastFocusedList;
// List / Tree
if (focused instanceof List || focused instanceof PagedList || focused instanceof ObjectTree || focused instanceof DataTree || focused instanceof AsyncDataTree) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table || focused instanceof ObjectTree || focused instanceof DataTree || focused instanceof AsyncDataTree) {
const list = focused;
// Focus down first
@@ -136,7 +137,7 @@ function focusUp(accessor: ServicesAccessor, arg2?: number, loop: boolean = fals
const count = typeof arg2 === 'number' ? arg2 : 1;
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
const list = focused;
list.focusPrevious(count);
@@ -184,7 +185,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const focused = accessor.get(IListService).lastFocusedList;
// List / Tree
if (focused instanceof List || focused instanceof PagedList || focused instanceof ObjectTree || focused instanceof DataTree || focused instanceof AsyncDataTree) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table || focused instanceof ObjectTree || focused instanceof DataTree || focused instanceof AsyncDataTree) {
const list = focused;
// Focus up first
@@ -210,7 +211,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const focused = accessor.get(IListService).lastFocusedList;
// Tree only
if (focused && !(focused instanceof List || focused instanceof PagedList)) {
if (focused && !(focused instanceof List || focused instanceof PagedList || focused instanceof Table)) {
if (focused instanceof ObjectTree || focused instanceof DataTree || focused instanceof AsyncDataTree) {
const tree = focused;
const focusedElements = tree.getFocus();
@@ -245,10 +246,10 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.UpArrow]
},
handler: (accessor) => {
const focusedTree = accessor.get(IListService).lastFocusedList;
const focused = accessor.get(IListService).lastFocusedList;
if (focusedTree && !(focusedTree instanceof List || focusedTree instanceof PagedList)) {
focusedTree.collapseAll();
if (focused && !(focused instanceof List || focused instanceof PagedList || focused instanceof Table)) {
focused.collapseAll();
}
}
});
@@ -261,7 +262,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
handler: (accessor) => {
const focused = accessor.get(IListService).lastFocusedList;
if (!focused || focused instanceof List || focused instanceof PagedList) {
if (!focused || focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
return;
}
@@ -291,7 +292,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const focused = accessor.get(IListService).lastFocusedList;
// Tree only
if (focused && !(focused instanceof List || focused instanceof PagedList)) {
if (focused && !(focused instanceof List || focused instanceof PagedList || focused instanceof Table)) {
if (focused instanceof ObjectTree || focused instanceof DataTree) {
// TODO@Joao: instead of doing this here, just delegate to a tree method
const tree = focused;
@@ -355,7 +356,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
focused.focusPreviousPage();
}
@@ -379,7 +380,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
focused.focusNextPage();
}
@@ -414,7 +415,7 @@ function listFocusFirst(accessor: ServicesAccessor, options?: { fromFocused: boo
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
const list = focused;
list.setFocus([0]);
@@ -458,7 +459,7 @@ function listFocusLast(accessor: ServicesAccessor, options?: { fromFocused: bool
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
const list = focused;
list.setFocus([list.length - 1]);
@@ -487,7 +488,7 @@ function focusElement(accessor: ServicesAccessor, retainCurrentFocus: boolean):
const focused = accessor.get(IListService).lastFocusedList;
const fakeKeyboardEvent = getSelectionKeyboardEvent('keydown', retainCurrentFocus);
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
const list = focused;
list.setSelection(list.getFocus(), fakeKeyboardEvent);
}
@@ -546,7 +547,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
const list = focused;
const fakeKeyboardEvent = new KeyboardEvent('keydown');
list.setSelection(range(list.length), fakeKeyboardEvent);
@@ -666,7 +667,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
const list = focused;
list.setSelection([]);
@@ -690,7 +691,7 @@ CommandsRegistry.registerCommand({
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
const list = focused;
list.toggleKeyboardNavigation();
}
@@ -709,7 +710,7 @@ CommandsRegistry.registerCommand({
const focused = accessor.get(IListService).lastFocusedList;
// List
if (focused instanceof List || focused instanceof PagedList) {
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
// TODO@joao
}

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { Registry } from 'vs/platform/registry/common/platform';
import { Action } from 'vs/base/common/actions';
import { IEditorGroupsService, GroupDirection, GroupLocation, IFindGroupScope } from 'vs/workbench/services/editor/common/editorGroupsService';
@@ -137,7 +137,7 @@ abstract class BaseNavigationAction extends Action {
class NavigateLeftAction extends BaseNavigationAction {
static readonly ID = 'workbench.action.navigateLeft';
static readonly LABEL = nls.localize('navigateLeft', "Navigate to the View on the Left");
static readonly LABEL = localize('navigateLeft', "Navigate to the View on the Left");
constructor(
id: string,
@@ -154,7 +154,7 @@ class NavigateLeftAction extends BaseNavigationAction {
class NavigateRightAction extends BaseNavigationAction {
static readonly ID = 'workbench.action.navigateRight';
static readonly LABEL = nls.localize('navigateRight', "Navigate to the View on the Right");
static readonly LABEL = localize('navigateRight', "Navigate to the View on the Right");
constructor(
id: string,
@@ -171,7 +171,7 @@ class NavigateRightAction extends BaseNavigationAction {
class NavigateUpAction extends BaseNavigationAction {
static readonly ID = 'workbench.action.navigateUp';
static readonly LABEL = nls.localize('navigateUp', "Navigate to the View Above");
static readonly LABEL = localize('navigateUp', "Navigate to the View Above");
constructor(
id: string,
@@ -188,7 +188,7 @@ class NavigateUpAction extends BaseNavigationAction {
class NavigateDownAction extends BaseNavigationAction {
static readonly ID = 'workbench.action.navigateDown';
static readonly LABEL = nls.localize('navigateDown', "Navigate to the View Below");
static readonly LABEL = localize('navigateDown', "Navigate to the View Below");
constructor(
id: string,
@@ -214,7 +214,9 @@ function findVisibleNeighbour(layoutService: IWorkbenchLayoutService, part: Part
}
function focusNextOrPreviousPart(layoutService: IWorkbenchLayoutService, editorService: IEditorService, next: boolean): void {
const editorFocused = editorService.activeEditorPane?.hasFocus();
// Need to ask if the active editor has focus since the layoutService is not aware of some custom editor focus behavior(notebooks)
// Also need to ask the layoutService for the case if no editor is opened
const editorFocused = editorService.activeEditorPane?.hasFocus() || layoutService.hasFocus(Parts.EDITOR_PART);
const currentlyFocusedPart = editorFocused ? Parts.EDITOR_PART : layoutService.hasFocus(Parts.ACTIVITYBAR_PART) ? Parts.ACTIVITYBAR_PART :
layoutService.hasFocus(Parts.STATUSBAR_PART) ? Parts.STATUSBAR_PART : layoutService.hasFocus(Parts.SIDEBAR_PART) ? Parts.SIDEBAR_PART : layoutService.hasFocus(Parts.PANEL_PART) ? Parts.PANEL_PART : undefined;
let partToFocus = Parts.EDITOR_PART;
@@ -227,7 +229,7 @@ function focusNextOrPreviousPart(layoutService: IWorkbenchLayoutService, editorS
export class FocusNextPart extends Action {
static readonly ID = 'workbench.action.focusNextPart';
static readonly LABEL = nls.localize('focusNextPart', "Focus Next Part");
static readonly LABEL = localize('focusNextPart', "Focus Next Part");
constructor(
id: string,
@@ -245,7 +247,7 @@ export class FocusNextPart extends Action {
export class FocusPreviousPart extends Action {
static readonly ID = 'workbench.action.focusPreviousPart';
static readonly LABEL = nls.localize('focusPreviousPart', "Focus Previous Part");
static readonly LABEL = localize('focusPreviousPart', "Focus Previous Part");
constructor(
id: string,

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { Action } from 'vs/base/common/actions';
import { IWindowOpenable } from 'vs/platform/windows/common/windows';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
@@ -46,18 +46,18 @@ abstract class BaseOpenRecentAction extends Action {
private readonly removeFromRecentlyOpened: IQuickInputButton = {
iconClass: Codicon.removeClose.classNames,
tooltip: nls.localize('remove', "Remove from Recently Opened")
tooltip: localize('remove', "Remove from Recently Opened")
};
private readonly dirtyRecentlyOpenedFolder: IQuickInputButton = {
iconClass: 'dirty-workspace ' + Codicon.closeDirty.classNames,
tooltip: nls.localize('dirtyRecentlyOpenedFolder', "Folder With Unsaved Files"),
tooltip: localize('dirtyRecentlyOpenedFolder', "Folder With Unsaved Files"),
alwaysVisible: true
};
private readonly dirtyRecentlyOpenedWorkspace: IQuickInputButton = {
...this.dirtyRecentlyOpenedFolder,
tooltip: nls.localize('dirtyRecentlyOpenedWorkspace', "Workspace With Unsaved Files"),
tooltip: localize('dirtyRecentlyOpenedWorkspace', "Workspace With Unsaved Files"),
};
constructor(
@@ -133,14 +133,14 @@ abstract class BaseOpenRecentAction extends Action {
let keyMods: IKeyMods | undefined;
const workspaceSeparator: IQuickPickSeparator = { type: 'separator', label: hasWorkspaces ? nls.localize('workspacesAndFolders', "folders & workspaces") : nls.localize('folders', "folders") };
const fileSeparator: IQuickPickSeparator = { type: 'separator', label: nls.localize('files', "files") };
const workspaceSeparator: IQuickPickSeparator = { type: 'separator', label: hasWorkspaces ? localize('workspacesAndFolders', "folders & workspaces") : localize('folders', "folders") };
const fileSeparator: IQuickPickSeparator = { type: 'separator', label: localize('files', "files") };
const picks = [workspaceSeparator, ...workspacePicks, fileSeparator, ...filePicks];
const pick = await this.quickInputService.pick(picks, {
contextKey: inRecentFilesPickerContextKey,
activeItem: [...workspacePicks, ...filePicks][autoFocusSecondEntry ? 1 : 0],
placeHolder: isMacintosh ? nls.localize('openRecentPlaceholderMac', "Select to open (hold Cmd-key to force new window or Alt-key for same window)") : nls.localize('openRecentPlaceholder', "Select to open (hold Ctrl-key to force new window or Alt-key for same window)"),
placeHolder: isMacintosh ? localize('openRecentPlaceholderMac', "Select to open (hold Cmd-key to force new window or Alt-key for same window)") : localize('openRecentPlaceholder', "Select to open (hold Ctrl-key to force new window or Alt-key for same window)"),
matchOnDescription: true,
onKeyMods: mods => keyMods = mods,
quickNavigate: this.isQuickNavigate() ? { keybindings: this.keybindingService.lookupKeybindings(this.id) } : undefined,
@@ -157,9 +157,9 @@ abstract class BaseOpenRecentAction extends Action {
const isDirtyWorkspace = context.button === this.dirtyRecentlyOpenedWorkspace;
const result = await this.dialogService.confirm({
type: 'question',
title: isDirtyWorkspace ? nls.localize('dirtyWorkspace', "Workspace with Unsaved Files") : nls.localize('dirtyFolder', "Folder with Unsaved Files"),
message: isDirtyWorkspace ? nls.localize('dirtyWorkspaceConfirm', "Do you want to open the workspace to review the unsaved files?") : nls.localize('dirtyFolderConfirm', "Do you want to open the folder to review the unsaved files?"),
detail: isDirtyWorkspace ? nls.localize('dirtyWorkspaceConfirmDetail', "Workspaces with unsaved files cannot be removed until all unsaved files have been saved or reverted.") : nls.localize('dirtyFolderConfirmDetail', "Folders with unsaved files cannot be removed until all unsaved files have been saved or reverted.")
title: isDirtyWorkspace ? localize('dirtyWorkspace', "Workspace with Unsaved Files") : localize('dirtyFolder', "Folder with Unsaved Files"),
message: isDirtyWorkspace ? localize('dirtyWorkspaceConfirm', "Do you want to open the workspace to review the unsaved files?") : localize('dirtyFolderConfirm', "Do you want to open the folder to review the unsaved files?"),
detail: isDirtyWorkspace ? localize('dirtyWorkspaceConfirmDetail', "Workspaces with unsaved files cannot be removed until all unsaved files have been saved or reverted.") : localize('dirtyFolderConfirmDetail', "Folders with unsaved files cannot be removed until all unsaved files have been saved or reverted.")
});
if (result.confirmed) {
@@ -212,7 +212,7 @@ abstract class BaseOpenRecentAction extends Action {
return {
iconClasses,
label: name,
ariaLabel: isDirty ? isWorkspace ? nls.localize('recentDirtyWorkspaceAriaLabel', "{0}, workspace with unsaved changes", name) : nls.localize('recentDirtyFolderAriaLabel', "{0}, folder with unsaved changes", name) : name,
ariaLabel: isDirty ? isWorkspace ? localize('recentDirtyWorkspaceAriaLabel', "{0}, workspace with unsaved changes", name) : localize('recentDirtyFolderAriaLabel', "{0}, folder with unsaved changes", name) : name,
description: parentPath,
buttons: isDirty ? [isWorkspace ? this.dirtyRecentlyOpenedWorkspace : this.dirtyRecentlyOpenedFolder] : [this.removeFromRecentlyOpened],
openable,
@@ -224,7 +224,7 @@ abstract class BaseOpenRecentAction extends Action {
export class OpenRecentAction extends BaseOpenRecentAction {
static readonly ID = 'workbench.action.openRecent';
static readonly LABEL = nls.localize('openRecent', "Open Recent...");
static readonly LABEL = localize('openRecent', "Open Recent...");
constructor(
id: string,
@@ -250,7 +250,7 @@ export class OpenRecentAction extends BaseOpenRecentAction {
class QuickPickRecentAction extends BaseOpenRecentAction {
static readonly ID = 'workbench.action.quickOpenRecent';
static readonly LABEL = nls.localize('quickOpenRecent', "Quick Open Recent...");
static readonly LABEL = localize('quickOpenRecent', "Quick Open Recent...");
constructor(
id: string,
@@ -276,7 +276,7 @@ class QuickPickRecentAction extends BaseOpenRecentAction {
class ToggleFullScreenAction extends Action {
static readonly ID = 'workbench.action.toggleFullScreen';
static readonly LABEL = nls.localize('toggleFullScreen', "Toggle Full Screen");
static readonly LABEL = localize('toggleFullScreen', "Toggle Full Screen");
constructor(
id: string,
@@ -294,7 +294,7 @@ class ToggleFullScreenAction extends Action {
export class ReloadWindowAction extends Action {
static readonly ID = 'workbench.action.reloadWindow';
static readonly LABEL = nls.localize('reloadWindow', "Reload Window");
static readonly LABEL = localize('reloadWindow', "Reload Window");
constructor(
id: string,
@@ -314,7 +314,7 @@ export class ReloadWindowAction extends Action {
class ShowAboutDialogAction extends Action {
static readonly ID = 'workbench.action.showAboutDialog';
static readonly LABEL = nls.localize('about', "About");
static readonly LABEL = localize('about', "About");
constructor(
id: string,
@@ -332,7 +332,7 @@ class ShowAboutDialogAction extends Action {
export class NewWindowAction extends Action {
static readonly ID = 'workbench.action.newWindow';
static readonly LABEL = nls.localize('newWindow', "New Window");
static readonly LABEL = localize('newWindow', "New Window");
constructor(
id: string,
@@ -352,7 +352,7 @@ class BlurAction extends Action2 {
constructor() {
super({
id: 'workbench.action.blur',
title: nls.localize('blur', "Remove keyboard focus from focused element")
title: localize('blur', "Remove keyboard focus from focused element")
});
}
@@ -369,7 +369,7 @@ const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActio
// --- Actions Registration
const fileCategory = nls.localize('file', "File");
const fileCategory = localize('file', "File");
registry.registerWorkbenchAction(SyncActionDescriptor.from(NewWindowAction, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_N }), 'New Window');
registry.registerWorkbenchAction(SyncActionDescriptor.from(QuickPickRecentAction), 'File: Quick Open Recent...', fileCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(OpenRecentAction, { primary: KeyMod.CtrlCmd | KeyCode.KEY_R, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_R } }), 'File: Open Recent...', fileCategory);
@@ -426,7 +426,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: 'z_ConfirmClose',
command: {
id: 'workbench.action.toggleConfirmBeforeClose',
title: nls.localize('miConfirmClose', "Confirm Before Close"),
title: localize('miConfirmClose', "Confirm Before Close"),
toggled: ContextKeyExpr.notEquals('config.window.confirmBeforeClose', 'never')
},
order: 1,
@@ -437,13 +437,13 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '1_new',
command: {
id: NewWindowAction.ID,
title: nls.localize({ key: 'miNewWindow', comment: ['&& denotes a mnemonic'] }, "New &&Window")
title: localize({ key: 'miNewWindow', comment: ['&& denotes a mnemonic'] }, "New &&Window")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
title: nls.localize({ key: 'miOpenRecent', comment: ['&& denotes a mnemonic'] }, "Open &&Recent"),
title: localize({ key: 'miOpenRecent', comment: ['&& denotes a mnemonic'] }, "Open &&Recent"),
submenu: MenuId.MenubarRecentMenu,
group: '2_open',
order: 4
@@ -453,7 +453,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarRecentMenu, {
group: 'y_more',
command: {
id: OpenRecentAction.ID,
title: nls.localize({ key: 'miMore', comment: ['&& denotes a mnemonic'] }, "&&More...")
title: localize({ key: 'miMore', comment: ['&& denotes a mnemonic'] }, "&&More...")
},
order: 1
});
@@ -462,7 +462,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
group: '1_toggle_view',
command: {
id: ToggleFullScreenAction.ID,
title: nls.localize({ key: 'miToggleFullScreen', comment: ['&& denotes a mnemonic'] }, "&&Full Screen"),
title: localize({ key: 'miToggleFullScreen', comment: ['&& denotes a mnemonic'] }, "&&Full Screen"),
toggled: IsFullscreenContext
},
order: 1
@@ -472,7 +472,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
group: 'z_about',
command: {
id: ShowAboutDialogAction.ID,
title: nls.localize({ key: 'miAbout', comment: ['&& denotes a mnemonic'] }, "&&About")
title: localize({ key: 'miAbout', comment: ['&& denotes a mnemonic'] }, "&&About")
},
order: 1,
when: IsMacNativeContext.toNegated()

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Action } from 'vs/base/common/actions';
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { ITelemetryData } from 'vs/platform/telemetry/common/telemetry';
import { IWorkspaceContextService, WorkbenchState, IWorkspaceFolder } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
@@ -12,9 +12,9 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { ICommandService, CommandsRegistry } from 'vs/platform/commands/common/commands';
import { ADD_ROOT_FOLDER_COMMAND_ID, ADD_ROOT_FOLDER_LABEL, PICK_WORKSPACE_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/workspaceCommands';
import { IFileDialogService } from 'vs/platform/dialogs/common/dialogs';
import { MenuRegistry, MenuId, SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { MenuRegistry, MenuId, SyncActionDescriptor, Action2, registerAction2 } from 'vs/platform/actions/common/actions';
import { EmptyWorkspaceSupportContext, WorkbenchStateContext, WorkspaceFolderCountContext } from 'vs/workbench/browser/contextkeys';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { INotificationService } from 'vs/platform/notification/common/notification';
@@ -23,11 +23,12 @@ import { KeyChord, KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IWorkspacesService, hasWorkspaceFileExtension } from 'vs/platform/workspaces/common/workspaces';
import { WORKSPACE_TRUST_ENABLED } from 'vs/workbench/services/workspaces/common/workspaceTrust';
export class OpenFileAction extends Action {
static readonly ID = 'workbench.action.files.openFile';
static readonly LABEL = nls.localize('openFile', "Open File...");
static readonly LABEL = localize('openFile', "Open File...");
constructor(
id: string,
@@ -45,7 +46,7 @@ export class OpenFileAction extends Action {
export class OpenFolderAction extends Action {
static readonly ID = 'workbench.action.files.openFolder';
static readonly LABEL = nls.localize('openFolder', "Open Folder...");
static readonly LABEL = localize('openFolder', "Open Folder...");
constructor(
id: string,
@@ -63,7 +64,7 @@ export class OpenFolderAction extends Action {
export class OpenFileFolderAction extends Action {
static readonly ID = 'workbench.action.files.openFileFolder';
static readonly LABEL = nls.localize('openFileFolder', "Open...");
static readonly LABEL = localize('openFileFolder', "Open...");
constructor(
id: string,
@@ -81,7 +82,7 @@ export class OpenFileFolderAction extends Action {
export class OpenWorkspaceAction extends Action {
static readonly ID = 'workbench.action.openWorkspace';
static readonly LABEL = nls.localize('openWorkspaceAction', "Open Workspace...");
static readonly LABEL = localize('openWorkspaceAction', "Open Workspace...");
constructor(
id: string,
@@ -99,7 +100,7 @@ export class OpenWorkspaceAction extends Action {
export class CloseWorkspaceAction extends Action {
static readonly ID = 'workbench.action.closeFolder';
static readonly LABEL = nls.localize('closeWorkspace', "Close Workspace");
static readonly LABEL = localize('closeWorkspace', "Close Workspace");
constructor(
id: string,
@@ -114,7 +115,7 @@ export class CloseWorkspaceAction extends Action {
async run(): Promise<void> {
if (this.contextService.getWorkbenchState() === WorkbenchState.EMPTY) {
this.notificationService.info(nls.localize('noWorkspaceOrFolderOpened', "There is currently no workspace or folder opened in this instance to close."));
this.notificationService.info(localize('noWorkspaceOrFolderOpened', "There is currently no workspace or folder opened in this instance to close."));
return;
}
@@ -125,7 +126,7 @@ export class CloseWorkspaceAction extends Action {
export class OpenWorkspaceConfigFileAction extends Action {
static readonly ID = 'workbench.action.openWorkspaceConfigFile';
static readonly LABEL = nls.localize('openWorkspaceConfigFile', "Open Workspace Configuration File");
static readonly LABEL = localize('openWorkspaceConfigFile', "Open Workspace Configuration File");
constructor(
id: string,
@@ -167,7 +168,7 @@ export class AddRootFolderAction extends Action {
export class GlobalRemoveRootFolderAction extends Action {
static readonly ID = 'workbench.action.removeRootFolder';
static readonly LABEL = nls.localize('globalRemoveFolderFromWorkspace', "Remove Folder from Workspace...");
static readonly LABEL = localize('globalRemoveFolderFromWorkspace', "Remove Folder from Workspace...");
constructor(
id: string,
@@ -195,7 +196,7 @@ export class GlobalRemoveRootFolderAction extends Action {
export class SaveWorkspaceAsAction extends Action {
static readonly ID = 'workbench.action.saveWorkspaceAs';
static readonly LABEL = nls.localize('saveWorkspaceAsAction', "Save Workspace As...");
static readonly LABEL = localize('saveWorkspaceAsAction', "Save Workspace As...");
constructor(
id: string,
@@ -225,7 +226,7 @@ export class SaveWorkspaceAsAction extends Action {
export class DuplicateWorkspaceInNewWindowAction extends Action {
static readonly ID = 'workbench.action.duplicateWorkspaceInNewWindow';
static readonly LABEL = nls.localize('duplicateWorkspaceInNewWindow', "Duplicate As Workspace in New Window");
static readonly LABEL = localize('duplicateWorkspaceInNewWindow', "Duplicate As Workspace in New Window");
constructor(
id: string,
@@ -250,10 +251,29 @@ export class DuplicateWorkspaceInNewWindowAction extends Action {
}
}
class WorkspaceTrustManageAction extends Action2 {
constructor() {
super({
id: 'workbench.action.manageTrust',
title: { value: localize('manageTrustAction', "Manage Workspace Trust"), original: 'Manage Workspace Trust' },
precondition: ContextKeyExpr.equals(`config.${WORKSPACE_TRUST_ENABLED}`, true),
category: localize('workspacesCategory', "Workspaces"),
f1: true
});
}
async run(accessor: ServicesAccessor) {
const commandService = accessor.get(ICommandService);
await commandService.executeCommand('workbench.trust.manage');
}
}
registerAction2(WorkspaceTrustManageAction);
// --- Actions Registration
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
const workspacesCategory = nls.localize('workspaces', "Workspaces");
const workspacesCategory = localize('workspaces', "Workspaces");
registry.registerWorkbenchAction(SyncActionDescriptor.from(AddRootFolderAction), 'Workspaces: Add Folder to Workspace...', workspacesCategory);
registry.registerWorkbenchAction(SyncActionDescriptor.from(GlobalRemoveRootFolderAction), 'Workspaces: Remove Folder from Workspace...', workspacesCategory);
@@ -271,7 +291,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '3_workspace',
command: {
id: ADD_ROOT_FOLDER_COMMAND_ID,
title: nls.localize({ key: 'miAddFolderToWorkspace', comment: ['&& denotes a mnemonic'] }, "A&&dd Folder to Workspace...")
title: localize({ key: 'miAddFolderToWorkspace', comment: ['&& denotes a mnemonic'] }, "A&&dd Folder to Workspace...")
},
order: 1
});
@@ -280,7 +300,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '3_workspace',
command: {
id: SaveWorkspaceAsAction.ID,
title: nls.localize('miSaveWorkspaceAs', "Save Workspace As...")
title: localize('miSaveWorkspaceAs', "Save Workspace As...")
},
order: 2,
when: EmptyWorkspaceSupportContext
@@ -298,7 +318,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '6_close',
command: {
id: CloseWorkspaceAction.ID,
title: nls.localize({ key: 'miCloseFolder', comment: ['&& denotes a mnemonic'] }, "Close &&Folder"),
title: localize({ key: 'miCloseFolder', comment: ['&& denotes a mnemonic'] }, "Close &&Folder"),
precondition: WorkspaceFolderCountContext.notEqualsTo('0')
},
order: 3,
@@ -309,7 +329,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
group: '6_close',
command: {
id: CloseWorkspaceAction.ID,
title: nls.localize({ key: 'miCloseWorkspace', comment: ['&& denotes a mnemonic'] }, "Close &&Workspace")
title: localize({ key: 'miCloseWorkspace', comment: ['&& denotes a mnemonic'] }, "Close &&Workspace")
},
order: 3,
when: ContextKeyExpr.and(WorkbenchStateContext.isEqualTo('workspace'), EmptyWorkspaceSupportContext)

View File

@@ -3,10 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
import * as resources from 'vs/base/common/resources';
import { dirname, removeTrailingPathSeparator } from 'vs/base/common/resources';
import { CancellationToken } from 'vs/base/common/cancellation';
import { mnemonicButtonLabel } from 'vs/base/common/labels';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
@@ -24,7 +24,7 @@ import { IOpenWindowOptions, IWindowOpenable } from 'vs/platform/windows/common/
import { hasWorkspaceFileExtension } from 'vs/platform/workspaces/common/workspaces';
export const ADD_ROOT_FOLDER_COMMAND_ID = 'addRootFolder';
export const ADD_ROOT_FOLDER_LABEL = nls.localize('addFolderToWorkspace', "Add Folder to Workspace...");
export const ADD_ROOT_FOLDER_LABEL = localize('addFolderToWorkspace', "Add Folder to Workspace...");
export const PICK_WORKSPACE_FOLDER_COMMAND_ID = '_workbench.pickWorkspaceFolder';
@@ -61,8 +61,8 @@ CommandsRegistry.registerCommand({
const workspaceEditingService = accessor.get(IWorkspaceEditingService);
const dialogsService = accessor.get(IFileDialogService);
const folders = await dialogsService.showOpenDialog({
openLabel: mnemonicButtonLabel(nls.localize({ key: 'add', comment: ['&& denotes a mnemonic'] }, "&&Add")),
title: nls.localize('addFolderToWorkspaceTitle', "Add Folder to Workspace"),
openLabel: mnemonicButtonLabel(localize({ key: 'add', comment: ['&& denotes a mnemonic'] }, "&&Add")),
title: localize('addFolderToWorkspaceTitle', "Add Folder to Workspace"),
canSelectFolders: true,
canSelectMany: true,
defaultUri: await dialogsService.defaultFolderPath()
@@ -72,7 +72,7 @@ CommandsRegistry.registerCommand({
return;
}
await workspaceEditingService.addFolders(folders.map(folder => ({ uri: resources.removeTrailingPathSeparator(folder) })));
await workspaceEditingService.addFolders(folders.map(folder => ({ uri: removeTrailingPathSeparator(folder) })));
}
});
@@ -91,7 +91,7 @@ CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, async functio
const folderPicks: IQuickPickItem[] = folders.map(folder => {
return {
label: folder.name,
description: labelService.getUriLabel(resources.dirname(folder.uri), { relative: true }),
description: labelService.getUriLabel(dirname(folder.uri), { relative: true }),
folder,
iconClasses: getIconClasses(modelService, modeService, folder.uri, FileKind.ROOT_FOLDER)
};
@@ -104,7 +104,7 @@ CommandsRegistry.registerCommand(PICK_WORKSPACE_FOLDER_COMMAND_ID, async functio
}
if (!options.placeHolder) {
options.placeHolder = nls.localize('workspaceFolderPickerPlaceholder', "Select workspace folder");
options.placeHolder = localize('workspaceFolderPickerPlaceholder', "Select workspace folder");
}
if (typeof options.matchOnDescription !== 'boolean') {
@@ -159,7 +159,7 @@ CommandsRegistry.registerCommand({
description: 'Open a folder or workspace in the current window or new window depending on the newWindow argument. Note that opening in the same window will shutdown the current extension host process and start a new one on the given folder/workspace unless the newWindow parameter is set to true.',
args: [
{ name: 'uri', description: '(optional) Uri of the folder or workspace file to open. If not provided, a native dialog will ask the user for the folder', constraint: (value: any) => value === undefined || value instanceof URI },
{ name: 'options', description: '(optional) Options. Object with the following properties: `forceNewWindow `: Whether to open the folder/workspace in a new window or the same. Defaults to opening in the same window. `noRecentEntry`: Wheter the opened URI will appear in the \'Open Recent\' list. Defaults to true. Note, for backward compatibility, options can also be of type boolean, representing the `forceNewWindow` setting.', constraint: (value: any) => value === undefined || typeof value === 'object' || typeof value === 'boolean' }
{ name: 'options', description: '(optional) Options. Object with the following properties: `forceNewWindow `: Whether to open the folder/workspace in a new window or the same. Defaults to opening in the same window. `noRecentEntry`: Whether the opened URI will appear in the \'Open Recent\' list. Defaults to true. Note, for backward compatibility, options can also be of type boolean, representing the `forceNewWindow` setting.', constraint: (value: any) => value === undefined || typeof value === 'object' || typeof value === 'boolean' }
]
}
});

View File

@@ -47,7 +47,7 @@ export class RangeHighlightDecorations extends Disposable {
}
removeHighlightRange() {
if (this.editor && this.editor.getModel() && this.rangeHighlightDecorationId) {
if (this.editor?.getModel() && this.rangeHighlightDecorationId) {
this.editor.deltaDecorations([this.rangeHighlightDecorationId], []);
this._onHighlightRemoved.fire();
}
@@ -76,7 +76,7 @@ export class RangeHighlightDecorations extends Disposable {
private getEditor(resourceRange: IRangeHighlightDecoration): ICodeEditor | undefined {
const activeEditor = this.editorService.activeEditor;
const resource = activeEditor && activeEditor.resource;
const resource = activeEditor?.resource;
if (resource && isEqual(resource, resourceRange.resource)) {
return this.editorService.activeTextEditorControl as ICodeEditor;
}
@@ -124,7 +124,7 @@ export class RangeHighlightDecorations extends Disposable {
dispose() {
super.dispose();
if (this.editor && this.editor.getModel()) {
if (this.editor?.getModel()) {
this.removeHighlightRange();
this.editor = null;
}

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IAction, IActionRunner, ActionRunner, IActionViewItem } from 'vs/base/common/actions';
import { IAction, IActionRunner, ActionRunner } from 'vs/base/common/actions';
import { Component } from 'vs/workbench/common/component';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IComposite, ICompositeControl } from 'vs/workbench/common/composite';
@@ -14,6 +14,7 @@ import { trackFocus, Dimension } from 'vs/base/browser/dom';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { Disposable } from 'vs/base/common/lifecycle';
import { assertIsDefined } from 'vs/base/common/types';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
/**
* Composites are layed out in the sidebar and panel part of the workbench. At a time only one composite

View File

@@ -3,6 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { Event } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { IContextKeyService, IContextKey, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
@@ -22,18 +23,18 @@ import { getRemoteName } from 'vs/platform/remote/common/remoteHosts';
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
import { isNative } from 'vs/base/common/platform';
export const WorkbenchStateContext = new RawContextKey<string>('workbenchState', undefined);
export const WorkspaceFolderCountContext = new RawContextKey<number>('workspaceFolderCount', 0);
export const EmptyWorkspaceSupportContext = new RawContextKey<boolean>('emptyWorkspaceSupport', true);
export const WorkbenchStateContext = new RawContextKey<string>('workbenchState', undefined, { type: 'string', description: localize('workbenchState', "The kind of workspace opened in the window, either 'empty' (no workspace), 'folder' (single folder) or 'workspace' (multi-root workspace)") });
export const WorkspaceFolderCountContext = new RawContextKey<number>('workspaceFolderCount', 0, localize('workspaceFolderCount', "The number of root folders in the workspace"));
export const EmptyWorkspaceSupportContext = new RawContextKey<boolean>('emptyWorkspaceSupport', true, true);
export const DirtyWorkingCopiesContext = new RawContextKey<boolean>('dirtyWorkingCopies', false);
export const DirtyWorkingCopiesContext = new RawContextKey<boolean>('dirtyWorkingCopies', false, localize('dirtyWorkingCopies', "Wether there are any dirty working copies"));
export const RemoteNameContext = new RawContextKey<string>('remoteName', '');
export const RemoteNameContext = new RawContextKey<string>('remoteName', '', localize('remoteName', "The name of the remote the window is connected to or an empty string if not connected to any remote"));
export const IsFullscreenContext = new RawContextKey<boolean>('isFullscreen', false);
export const IsFullscreenContext = new RawContextKey<boolean>('isFullscreen', false, localize('isFullscreen', "Whether the window is in fullscreen mode"));
// Support for FileSystemAccess web APIs (https://wicg.github.io/file-system-access)
export const HasWebFileSystemAccess = new RawContextKey<boolean>('hasWebFileSystemAccess', false);
export const HasWebFileSystemAccess = new RawContextKey<boolean>('hasWebFileSystemAccess', false, true);
export class WorkbenchContextKeysHandler extends Disposable {
private inputFocusedContext: IContextKey<boolean>;
@@ -167,7 +168,7 @@ export class WorkbenchContextKeysHandler extends Disposable {
this._register(this.editorGroupService.onDidAddGroup(() => this.updateEditorContextKeys()));
this._register(this.editorGroupService.onDidRemoveGroup(() => this.updateEditorContextKeys()));
this._register(this.editorGroupService.onDidGroupIndexChange(() => this.updateEditorContextKeys()));
this._register(this.editorGroupService.onDidChangeGroupIndex(() => this.updateEditorContextKeys()));
this._register(addDisposableListener(window, EventType.FOCUS_IN, () => this.updateInputContextKeys(), true));
@@ -180,15 +181,15 @@ export class WorkbenchContextKeysHandler extends Disposable {
}
}));
this._register(this.layoutService.onZenModeChange(enabled => this.inZenModeContext.set(enabled)));
this._register(this.layoutService.onFullscreenChange(fullscreen => this.isFullscreenContext.set(fullscreen)));
this._register(this.layoutService.onCenteredLayoutChange(centered => this.isCenteredLayoutContext.set(centered)));
this._register(this.layoutService.onPanelPositionChange(position => this.panelPositionContext.set(position)));
this._register(this.layoutService.onDidChangeZenMode(enabled => this.inZenModeContext.set(enabled)));
this._register(this.layoutService.onDidChangeFullscreen(fullscreen => this.isFullscreenContext.set(fullscreen)));
this._register(this.layoutService.onDidChangeCenteredLayout(centered => this.isCenteredLayoutContext.set(centered)));
this._register(this.layoutService.onDidChangePanelPosition(position => this.panelPositionContext.set(position)));
this._register(this.viewletService.onDidViewletClose(() => this.updateSideBarContextKeys()));
this._register(this.viewletService.onDidViewletOpen(() => this.updateSideBarContextKeys()));
this._register(this.layoutService.onPartVisibilityChange(() => {
this._register(this.layoutService.onDidChangePartVisibility(() => {
this.editorAreaVisibleContext.set(this.layoutService.isVisible(Parts.EDITOR_PART));
this.panelVisibleContext.set(this.layoutService.isVisible(Parts.PANEL_PART));
this.panelMaximizedContext.set(this.layoutService.isPanelMaximized());

View File

@@ -582,7 +582,7 @@ export class CompositeDragAndDropObserver extends Disposable {
const id = e.dragAndDropData.getData().id;
const type = e.dragAndDropData.getData().type;
const data = this.readDragData(type);
if (data && data.getData().id === id) {
if (data?.getData().id === id) {
this.transferData.clearData(type === 'view' ? DraggedViewIdentifier.prototype : DraggedCompositeIdentifier.prototype);
}
}));

View File

@@ -3,6 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { Event } from 'vs/base/common/event';
import { EditorInput } from 'vs/workbench/common/editor';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
import { Registry } from 'vs/platform/registry/common/platform';
@@ -10,9 +12,27 @@ import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
import { IConstructorSignature0, IInstantiationService, BrandedService } from 'vs/platform/instantiation/common/instantiation';
import { insert } from 'vs/base/common/arrays';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuration';
import { Extensions as ConfigurationExtensions, IConfigurationNode, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
export const Extensions = {
Editors: 'workbench.contributions.editors',
Associations: 'workbench.editors.associations'
};
//#region Editors Registry
export interface IEditorDescriptor {
/**
* The unique identifier of the editor
*/
getId(): string;
/**
* The display name of the editor
*/
getName(): string;
instantiate(instantiationService: IInstantiationService): EditorPane;
@@ -174,8 +194,137 @@ class EditorRegistry implements IEditorRegistry {
}
}
export const Extensions = {
Editors: 'workbench.contributions.editors'
Registry.add(Extensions.Editors, new EditorRegistry());
//#endregion
//#region Editor Associations
export const editorsAssociationsSettingId = 'workbench.editorAssociations';
export const DEFAULT_EDITOR_ASSOCIATION: IEditorType = {
id: 'default',
displayName: localize('promptOpenWith.defaultEditor.displayName', "Text Editor"),
providerDisplayName: localize('builtinProviderDisplayName', "Built-in")
};
Registry.add(Extensions.Editors, new EditorRegistry());
export type EditorAssociation = {
readonly viewType: string;
readonly filenamePattern?: string;
};
export type EditorsAssociations = readonly EditorAssociation[];
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
const editorTypeSchemaAddition: IJSONSchema = {
type: 'string',
enum: []
};
const editorAssociationsConfigurationNode: IConfigurationNode = {
...workbenchConfigurationNodeBase,
properties: {
'workbench.editorAssociations': {
type: 'array',
markdownDescription: localize('editor.editorAssociations', "Configure which editor to use for specific file types."),
items: {
type: 'object',
defaultSnippets: [{
body: {
'viewType': '$1',
'filenamePattern': '$2'
}
}],
properties: {
'viewType': {
anyOf: [
{
type: 'string',
description: localize('editor.editorAssociations.viewType', "The unique id of the editor to use."),
},
editorTypeSchemaAddition
]
},
'filenamePattern': {
type: 'string',
description: localize('editor.editorAssociations.filenamePattern', "Glob pattern specifying which files the editor should be used for."),
}
}
}
}
}
};
export interface IEditorType {
readonly id: string;
readonly displayName: string;
readonly providerDisplayName: string;
}
export interface IEditorTypesHandler {
readonly onDidChangeEditorTypes: Event<void>;
getEditorTypes(): IEditorType[];
}
export interface IEditorAssociationsRegistry {
/**
* Register handlers for editor types
*/
registerEditorTypesHandler(id: string, handler: IEditorTypesHandler): IDisposable;
}
class EditorAssociationsRegistry implements IEditorAssociationsRegistry {
private readonly editorTypesHandlers = new Map<string, IEditorTypesHandler>();
registerEditorTypesHandler(id: string, handler: IEditorTypesHandler): IDisposable {
if (this.editorTypesHandlers.has(id)) {
throw new Error(`An editor type handler with ${id} was already registered.`);
}
this.editorTypesHandlers.set(id, handler);
this.updateEditorAssociationsSchema();
const editorTypeChangeEvent = handler.onDidChangeEditorTypes(() => {
this.updateEditorAssociationsSchema();
});
return {
dispose: () => {
editorTypeChangeEvent.dispose();
this.editorTypesHandlers.delete(id);
this.updateEditorAssociationsSchema();
}
};
}
private updateEditorAssociationsSchema() {
const enumValues: string[] = [];
const enumDescriptions: string[] = [];
const editorTypes: IEditorType[] = [DEFAULT_EDITOR_ASSOCIATION];
for (const [, handler] of this.editorTypesHandlers) {
editorTypes.push(...handler.getEditorTypes());
}
for (const { id, providerDisplayName } of editorTypes) {
enumValues.push(id);
enumDescriptions.push(localize('editorAssociations.viewType.sourceDescription', "Source: {0}", providerDisplayName));
}
editorTypeSchemaAddition.enum = enumValues;
editorTypeSchemaAddition.enumDescriptions = enumDescriptions;
configurationRegistry.notifyConfigurationSchemaUpdated(editorAssociationsConfigurationNode);
}
}
Registry.add(Extensions.Associations, new EditorAssociationsRegistry());
configurationRegistry.registerConfiguration(editorAssociationsConfigurationNode);
//#endregion

View File

@@ -22,6 +22,7 @@ import { getIconClasses, detectModeId } from 'vs/editor/common/services/getIconC
import { Disposable, dispose, IDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { withNullAsUndefined } from 'vs/base/common/types';
import { normalizeDriveLetter } from 'vs/base/common/labels';
export interface IResourceLabelProps {
resource?: URI | { primary?: URI, secondary?: URI };
@@ -368,10 +369,10 @@ class ResourceLabelWidget extends IconLabel {
}
setFile(resource: URI, options?: IFileLabelOptions): void {
const hideLabel = options && options.hideLabel;
const hideLabel = options?.hideLabel;
let name: string | undefined;
if (!hideLabel) {
if (options && options.fileKind === FileKind.ROOT_FOLDER) {
if (options?.fileKind === FileKind.ROOT_FOLDER) {
const workspaceFolder = this.contextService.getWorkspaceFolder(resource);
if (workspaceFolder) {
name = workspaceFolder.name;
@@ -379,7 +380,7 @@ class ResourceLabelWidget extends IconLabel {
}
if (!name) {
name = basenameOrAuthority(resource);
name = normalizeDriveLetter(basenameOrAuthority(resource));
}
}
@@ -545,11 +546,11 @@ class ResourceLabelWidget extends IconLabel {
iconLabelOptions.extraClasses = this.computedIconClasses.slice(0);
}
if (this.options && this.options.extraClasses) {
if (this.options?.extraClasses) {
iconLabelOptions.extraClasses.push(...this.options.extraClasses);
}
if (this.options && this.options.fileDecorations && resource) {
if (this.options?.fileDecorations && resource) {
const deco = this.decorationsService.getDecoration(
resource,
this.options.fileKind !== FileKind.FILE

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { Emitter } from 'vs/base/common/event';
import { Event, Emitter } from 'vs/base/common/event';
import { EventType, addDisposableListener, getClientArea, Dimension, position, size, IDimension, isAncestorUsingFlowTo } from 'vs/base/browser/dom';
import { onDidChangeFullscreen, isFullscreen } from 'vs/base/browser/browser';
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
@@ -47,6 +47,7 @@ import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
import { mark } from 'vs/base/common/performance';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { ILogService } from 'vs/platform/log/common/log';
import { Promises } from 'vs/base/common/async';
export enum Settings {
ACTIVITYBAR_VISIBLE = 'workbench.activityBar.visible',
@@ -98,26 +99,29 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
//#region Events
private readonly _onZenModeChange = this._register(new Emitter<boolean>());
readonly onZenModeChange = this._onZenModeChange.event;
private readonly _onDidChangeZenMode = this._register(new Emitter<boolean>());
readonly onDidChangeZenMode = this._onDidChangeZenMode.event;
private readonly _onFullscreenChange = this._register(new Emitter<boolean>());
readonly onFullscreenChange = this._onFullscreenChange.event;
private readonly _onDidChangeFullscreen = this._register(new Emitter<boolean>());
readonly onDidChangeFullscreen = this._onDidChangeFullscreen.event;
private readonly _onCenteredLayoutChange = this._register(new Emitter<boolean>());
readonly onCenteredLayoutChange = this._onCenteredLayoutChange.event;
private readonly _onDidChangeCenteredLayout = this._register(new Emitter<boolean>());
readonly onDidChangeCenteredLayout = this._onDidChangeCenteredLayout.event;
private readonly _onMaximizeChange = this._register(new Emitter<boolean>());
readonly onMaximizeChange = this._onMaximizeChange.event;
private readonly _onDidChangeWindowMaximized = this._register(new Emitter<boolean>());
readonly onDidChangeWindowMaximized = this._onDidChangeWindowMaximized.event;
private readonly _onPanelPositionChange = this._register(new Emitter<string>());
readonly onPanelPositionChange = this._onPanelPositionChange.event;
private readonly _onDidChangePanelPosition = this._register(new Emitter<string>());
readonly onDidChangePanelPosition = this._onDidChangePanelPosition.event;
private readonly _onPartVisibilityChange = this._register(new Emitter<void>());
readonly onPartVisibilityChange = this._onPartVisibilityChange.event;
private readonly _onDidChangePartVisibility = this._register(new Emitter<void>());
readonly onDidChangePartVisibility = this._onDidChangePartVisibility.event;
private readonly _onLayout = this._register(new Emitter<IDimension>());
readonly onLayout = this._onLayout.event;
private readonly _onDidChangeNotificationsVisibility = this._register(new Emitter<boolean>());
readonly onDidChangeNotificationsVisibility = this._onDidChangeNotificationsVisibility.event;
private readonly _onDidLayout = this._register(new Emitter<IDimension>());
readonly onDidLayout = this._onDidLayout.event;
//#endregion
@@ -179,7 +183,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
windowBorder: false,
menuBar: {
visibility: 'default' as MenuBarVisibility,
visibility: 'classic' as MenuBarVisibility,
toggled: false
},
@@ -320,8 +324,13 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
if (visible !== this.state.menuBar.toggled) {
this.state.menuBar.toggled = visible;
if (this.state.fullscreen && (this.state.menuBar.visibility === 'toggle' || this.state.menuBar.visibility === 'default')) {
// Propagate to grid
// The menu bar toggles the title bar in web because it does not need to be shown for window controls only
if (isWeb && this.state.menuBar.visibility === 'toggle') {
this.workbenchGrid.setViewVisible(this.titleBarPartView, this.isVisible(Parts.TITLEBAR_PART));
}
// The menu bar toggles the title bar in full screen for toggle and classic settings
else if (this.state.fullscreen && (this.state.menuBar.visibility === 'toggle' || this.state.menuBar.visibility === 'classic')) {
this.workbenchGrid.setViewVisible(this.titleBarPartView, this.isVisible(Parts.TITLEBAR_PART));
}
@@ -359,7 +368,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.layout(); // handle title bar when fullscreen changes
}
this._onFullscreenChange.fire(this.state.fullscreen);
this._onDidChangeFullscreen.fire(this.state.fullscreen);
}
private onWindowFocusChanged(hasFocus: boolean): void {
@@ -567,7 +576,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return;
}
if (!storageService.isNew(StorageScope.WORKSPACE)) {
if (!defaultLayout.force && !storageService.isNew(StorageScope.WORKSPACE)) {
return;
}
@@ -623,24 +632,17 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
private _openedDefaultEditors: boolean = false;
get openedDefaultEditors() {
return this._openedDefaultEditors;
}
get openedDefaultEditors() { return this._openedDefaultEditors; }
private getInitialFilesToOpen(): { filesToOpenOrCreate?: IPath[], filesToDiff?: IPath[]; } | undefined {
const defaultLayout = this.environmentService.options?.defaultLayout;
if (defaultLayout?.editors?.length && this.storageService.isNew(StorageScope.WORKSPACE)) {
if (defaultLayout?.editors?.length && (defaultLayout.force || this.storageService.isNew(StorageScope.WORKSPACE))) {
this._openedDefaultEditors = true;
return {
filesToOpenOrCreate: defaultLayout.editors
.map<IPath>(f => {
// Support the old path+scheme api until embedders can migrate
if ('path' in f && 'scheme' in f) {
return { fileUri: URI.file((f as any).path).with({ scheme: (f as any).scheme }) };
}
return { fileUri: URI.revive(f.uri), openOnlyIfExists: f.openOnlyIfExists, overrideId: f.openWith };
})
filesToOpenOrCreate: defaultLayout.editors.map<IPath>(file => {
return { fileUri: URI.revive(file.uri), openOnlyIfExists: file.openOnlyIfExists, editorOverrideId: file.openWith };
})
};
}
@@ -718,7 +720,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
if (defaultViews.length) {
await this.extensionService.whenInstalledExtensionsRegistered();
let i = defaultViews.length;
while (i) {
i--;
@@ -794,7 +795,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
// Await restore to be done
await Promise.all(restorePromises);
await Promises.settled(restorePromises);
}
private updatePanelPosition() {
@@ -817,6 +818,10 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
return part;
}
registerNotifications(delegate: { onDidChangeNotificationsVisibility: Event<boolean> }): void {
this._register(delegate.onDidChangeNotificationsVisibility(visible => this._onDidChangeNotificationsVisibility.fire(visible)));
}
isRestored(): boolean {
return this.lifecycleService.phase >= LifecyclePhase.Restored;
}
@@ -883,19 +888,35 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
isVisible(part: Parts): boolean {
switch (part) {
case Parts.TITLEBAR_PART:
// Using the native title bar, don't ever show the custom one
if (getTitleBarStyle(this.configurationService) === 'native') {
return false;
} else if (!this.state.fullscreen && !isWeb) {
return true;
} else if (isMacintosh && isNative) {
return false;
} else if (this.state.menuBar.visibility === 'visible') {
return true;
} else if (this.state.menuBar.visibility === 'toggle' || this.state.menuBar.visibility === 'default') {
return this.state.menuBar.toggled;
}
return false;
// macOS desktop does not need a title bar when full screen
if (isMacintosh && isNative) {
return !this.state.fullscreen;
}
// non-fullscreen native must show the title bar
if (isNative && !this.state.fullscreen) {
return true;
}
// remaining behavior is based on menubar visibility
switch (this.state.menuBar.visibility) {
case 'classic':
return !this.state.fullscreen || this.state.menuBar.toggled;
case 'compact':
case 'hidden':
return false;
case 'toggle':
return this.state.menuBar.toggled;
case 'visible':
return true;
default:
return isWeb ? false : !this.state.fullscreen || this.state.menuBar.toggled;
}
case Parts.SIDEBAR_PART:
return !this.state.sideBar.hidden;
case Parts.PANEL_PART:
@@ -967,15 +988,16 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
editorControlSet.clear();
} else {
this.editorService.visibleTextEditorControls.forEach(editorControl => {
for (const editorControl of this.editorService.visibleTextEditorControls) {
if (!editorControlSet.has(editorControl)) {
editorControlSet.add(editorControl);
this.state.zenMode.transitionDisposables.add(editorControl.onDidDispose(() => {
editorControlSet.delete(editorControl);
}));
}
setEditorLineNumbers(editorControl);
});
}
}
};
@@ -1075,7 +1097,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
// Event
this._onZenModeChange.fire(this.state.zenMode.active);
this._onDidChangeZenMode.fire(this.state.zenMode.active);
// State
if (this.state.zenMode.active) {
@@ -1145,7 +1167,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.workbenchGrid = workbenchGrid;
this.workbenchGrid.edgeSnapping = this.state.fullscreen;
[titleBar, editorPart, activityBar, panelPart, sideBar, statusBar].forEach((part: Part) => {
for (const part of [titleBar, editorPart, activityBar, panelPart, sideBar, statusBar]) {
this._register(part.onDidVisibilityChange((visible) => {
if (part === sideBar) {
this.setSideBarHidden(!visible, true);
@@ -1154,9 +1176,9 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
} else if (part === editorPart) {
this.setEditorHidden(!visible, true);
}
this._onPartVisibilityChange.fire();
this._onDidChangePartVisibility.fire();
}));
});
}
this._register(this.storageService.onWillSaveState(() => {
const grid = this.workbenchGrid as SerializableGrid<ISerializableView>;
@@ -1196,7 +1218,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.workbenchGrid.layout(this._dimension.width, this._dimension.height);
// Emit as event
this._onLayout.fire(this._dimension);
this._onDidLayout.fire(this._dimension);
}
}
@@ -1234,7 +1256,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
}
this._onCenteredLayoutChange.fire(this.state.editor.centered);
this._onDidChangeCenteredLayout.fire(this.state.editor.centered);
}
resizePart(part: Parts, sizeChangeWidth: number, sizeChangeHeight: number): void {
@@ -1530,10 +1552,6 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
}
isPanelMaximized(): boolean {
if (!this.workbenchGrid) {
return false;
}
return this.state.editor.hidden;
}
@@ -1559,16 +1577,14 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
toggleMenuBar(): void {
let currentVisibilityValue = getMenuBarVisibility(this.configurationService);
if (typeof currentVisibilityValue !== 'string') {
currentVisibilityValue = 'default';
currentVisibilityValue = 'classic';
}
let newVisibilityValue: string;
if (currentVisibilityValue === 'visible' || currentVisibilityValue === 'default') {
newVisibilityValue = 'toggle';
} else if (currentVisibilityValue === 'compact') {
newVisibilityValue = 'hidden';
if (currentVisibilityValue === 'visible' || currentVisibilityValue === 'classic') {
newVisibilityValue = 'compact';
} else {
newVisibilityValue = (isWeb && currentVisibilityValue === 'hidden') ? 'compact' : 'default';
newVisibilityValue = 'classic';
}
this.configurationService.updateValue(Storage.MENU_VISIBILITY, newVisibilityValue);
@@ -1627,7 +1643,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
// Reset sidebar to original size before shifting the panel
this.workbenchGrid.resizeView(this.sideBarPartView, sideBarSize);
this._onPanelPositionChange.fire(newPositionValue);
this._onDidChangePanelPosition.fire(newPositionValue);
}
isWindowMaximized() {
@@ -1642,7 +1658,7 @@ export abstract class Layout extends Disposable implements IWorkbenchLayoutServi
this.state.maximized = maximized;
this.updateWindowBorder();
this._onMaximizeChange.fire(maximized);
this._onDidChangeWindowMaximized.fire(maximized);
}
getVisibleNeighborPart(part: Parts, direction: Direction): Parts | undefined {

View File

@@ -13,15 +13,18 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { Composite } from 'vs/workbench/browser/composite';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { ViewPaneContainer } from './parts/views/viewPaneContainer';
import { ViewPaneContainer, ViewsSubMenu } from './parts/views/viewPaneContainer';
import { IPaneComposite } from 'vs/workbench/common/panecomposite';
import { IAction, IActionViewItem, Separator } from 'vs/base/common/actions';
import { IAction, Separator } from 'vs/base/common/actions';
import { SubmenuItemAction } from 'vs/platform/actions/common/actions';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
export class PaneComposite extends Composite implements IPaneComposite {
export abstract class PaneComposite extends Composite implements IPaneComposite {
private viewPaneContainer?: ViewPaneContainer;
constructor(
id: string,
protected readonly viewPaneContainer: ViewPaneContainer,
@ITelemetryService telemetryService: ITelemetryService,
@IStorageService protected storageService: IStorageService,
@IInstantiationService protected instantiationService: IInstantiationService,
@@ -31,78 +34,94 @@ export class PaneComposite extends Composite implements IPaneComposite {
@IWorkspaceContextService protected contextService: IWorkspaceContextService
) {
super(id, telemetryService, themeService, storageService);
this._register(this.viewPaneContainer.onTitleAreaUpdate(() => this.updateTitleArea()));
}
create(parent: HTMLElement): void {
this.viewPaneContainer = this._register(this.createViewPaneContainer(parent));
this._register(this.viewPaneContainer.onTitleAreaUpdate(() => this.updateTitleArea()));
this.viewPaneContainer.create(parent);
}
setVisible(visible: boolean): void {
super.setVisible(visible);
this.viewPaneContainer.setVisible(visible);
this.viewPaneContainer?.setVisible(visible);
}
layout(dimension: Dimension): void {
this.viewPaneContainer.layout(dimension);
this.viewPaneContainer?.layout(dimension);
}
getOptimalWidth(): number {
return this.viewPaneContainer.getOptimalWidth();
return this.viewPaneContainer?.getOptimalWidth() ?? 0;
}
openView<T extends IView>(id: string, focus?: boolean): T | undefined {
return this.viewPaneContainer.openView(id, focus) as T;
return this.viewPaneContainer?.openView(id, focus) as T;
}
getViewPaneContainer(): ViewPaneContainer {
getViewPaneContainer(): ViewPaneContainer | undefined {
return this.viewPaneContainer;
}
getActionsContext(): unknown {
return this.getViewPaneContainer().getActionsContext();
return this.getViewPaneContainer()?.getActionsContext();
}
getContextMenuActions(): ReadonlyArray<IAction> {
const result = [];
result.push(...this.viewPaneContainer.getContextMenuActions2());
const otherActions = this.viewPaneContainer.getContextMenuActions();
if (otherActions.length) {
result.push(new Separator());
result.push(...otherActions);
}
return result;
return this.viewPaneContainer?.menuActions?.getContextMenuActions() ?? [];
}
getActions(): ReadonlyArray<IAction> {
const result = [];
result.push(...this.viewPaneContainer.getActions2());
result.push(...this.viewPaneContainer.getActions());
if (this.viewPaneContainer?.menuActions) {
result.push(...this.viewPaneContainer.menuActions.getPrimaryActions());
if (this.viewPaneContainer.isViewMergedWithContainer()) {
result.push(...this.viewPaneContainer.panes[0].menuActions.getPrimaryActions());
}
}
return result;
}
getSecondaryActions(): ReadonlyArray<IAction> {
const menuActions = this.viewPaneContainer.getSecondaryActions2();
const viewPaneContainerActions = this.viewPaneContainer.getSecondaryActions();
if (menuActions.length && viewPaneContainerActions.length) {
if (!this.viewPaneContainer?.menuActions) {
return [];
}
const viewPaneActions = this.viewPaneContainer.isViewMergedWithContainer() ? this.viewPaneContainer.panes[0].menuActions.getSecondaryActions() : [];
let menuActions = this.viewPaneContainer.menuActions.getSecondaryActions();
const viewsSubmenuActionIndex = menuActions.findIndex(action => action instanceof SubmenuItemAction && action.item.submenu === ViewsSubMenu);
if (viewsSubmenuActionIndex !== -1) {
const viewsSubmenuAction = <SubmenuItemAction>menuActions[viewsSubmenuActionIndex];
if (viewsSubmenuAction.actions.some(({ enabled }) => enabled)) {
if (menuActions.length === 1 && viewPaneActions.length === 0) {
menuActions = viewsSubmenuAction.actions.slice();
} else if (viewsSubmenuActionIndex !== 0) {
menuActions = [viewsSubmenuAction, ...menuActions.slice(0, viewsSubmenuActionIndex), ...menuActions.slice(viewsSubmenuActionIndex + 1)];
}
} else {
// Remove views submenu if none of the actions are enabled
menuActions.splice(viewsSubmenuActionIndex, 1);
}
}
if (menuActions.length && viewPaneActions.length) {
return [
...menuActions,
new Separator(),
...viewPaneContainerActions
...viewPaneActions
];
}
return menuActions.length ? menuActions : viewPaneContainerActions;
return menuActions.length ? menuActions : viewPaneActions;
}
getActionViewItem(action: IAction): IActionViewItem | undefined {
return this.viewPaneContainer.getActionViewItem(action);
return this.viewPaneContainer?.getActionViewItem(action);
}
getTitle(): string {
return this.viewPaneContainer.getTitle();
return this.viewPaneContainer?.getTitle() ?? '';
}
saveState(): void {
@@ -110,6 +129,8 @@ export class PaneComposite extends Composite implements IPaneComposite {
}
focus(): void {
this.viewPaneContainer.focus();
this.viewPaneContainer?.focus();
}
protected abstract createViewPaneContainer(parent: HTMLElement): ViewPaneContainer;
}

View File

@@ -17,7 +17,6 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
export abstract class Panel extends PaneComposite implements IPanel {
@@ -25,7 +24,6 @@ export abstract class Panel extends PaneComposite implements IPanel {
private readonly panelActions: CompositeMenuActions;
constructor(id: string,
viewPaneContainer: ViewPaneContainer,
@ITelemetryService telemetryService: ITelemetryService,
@IStorageService storageService: IStorageService,
@IInstantiationService instantiationService: IInstantiationService,
@@ -34,7 +32,7 @@ export abstract class Panel extends PaneComposite implements IPanel {
@IExtensionService extensionService: IExtensionService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
) {
super(id, viewPaneContainer, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
super(id, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
this.panelActions = this._register(this.instantiationService.createInstance(CompositeMenuActions, MenuId.PanelTitle, undefined, undefined));
this._register(this.panelActions.onDidChange(() => this.updateTitleArea()));
}

View File

@@ -159,7 +159,7 @@ class PartLayout {
// Title Size: Width (Fill), Height (Variable)
let titleSize: Dimension;
if (this.options && this.options.hasTitle) {
if (this.options.hasTitle) {
titleSize = new Dimension(width, Math.min(height, PartLayout.TITLE_HEIGHT));
} else {
titleSize = Dimension.None;

View File

@@ -19,7 +19,7 @@ import { IColorTheme, IThemeService, registerThemingParticipant } from 'vs/platf
import { ActivityAction, ActivityActionViewItem, ICompositeBar, ICompositeBarColors, ToggleCompositePinnedAction } from 'vs/workbench/browser/parts/compositeBarActions';
import { CATEGORIES } from 'vs/workbench/common/actions';
import { IActivity } from 'vs/workbench/common/activity';
import { ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_ACTIVE_FOCUS_BORDER, ACTIVITY_BAR_ACTIVE_BACKGROUND, ACTIVITY_BAR_BACKGROUND } from 'vs/workbench/common/theme';
import { ACTIVITY_BAR_FOREGROUND, ACTIVITY_BAR_ACTIVE_BORDER, ACTIVITY_BAR_ACTIVE_FOCUS_BORDER, ACTIVITY_BAR_ACTIVE_BACKGROUND } from 'vs/workbench/common/theme';
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
@@ -118,7 +118,7 @@ class MenuActivityActionViewItem extends ActivityActionViewItem {
@IConfigurationService protected readonly configurationService: IConfigurationService,
@IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService
) {
super(action, { draggable: false, colors, icon: true }, themeService);
super(action, { draggable: false, colors, icon: true, hasPopup: true }, themeService);
}
render(container: HTMLElement): void {
@@ -182,54 +182,6 @@ class MenuActivityActionViewItem extends ActivityActionViewItem {
}
}
export class HomeActivityActionViewItem extends MenuActivityActionViewItem {
static readonly HOME_BAR_VISIBILITY_PREFERENCE = 'workbench.activity.showHomeIndicator';
constructor(
private readonly goHomeHref: string,
action: ActivityAction,
contextMenuActionsProvider: () => IAction[],
colors: (theme: IColorTheme) => ICompositeBarColors,
@IThemeService themeService: IThemeService,
@IMenuService menuService: IMenuService,
@IContextMenuService contextMenuService: IContextMenuService,
@IContextKeyService contextKeyService: IContextKeyService,
@IConfigurationService configurationService: IConfigurationService,
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@IStorageService private readonly storageService: IStorageService
) {
super(MenuId.MenubarHomeMenu, action, contextMenuActionsProvider, colors, themeService, menuService, contextMenuService, contextKeyService, configurationService, environmentService);
}
protected async resolveMainMenuActions(homeMenu: IMenu, disposables: DisposableStore): Promise<IAction[]> {
const actions = [];
// Go Home
actions.push(toAction({ id: 'goHome', label: localize('goHome', "Go Home"), run: () => window.location.href = this.goHomeHref }));
// Contributed
const contributedActions = await super.resolveMainMenuActions(homeMenu, disposables);
if (contributedActions.length) {
actions.push(disposables.add(new Separator()));
actions.push(...contributedActions);
}
return actions;
}
protected async resolveContextMenuActions(disposables: DisposableStore): Promise<IAction[]> {
const actions = await super.resolveContextMenuActions(disposables);
actions.unshift(...[
toAction({ id: 'hideHomeButton', label: localize('hideHomeButton', "Hide Home Button"), run: () => this.storageService.store(HomeActivityActionViewItem.HOME_BAR_VISIBILITY_PREFERENCE, false, StorageScope.GLOBAL, StorageTarget.USER) }),
new Separator()
]);
return actions;
}
}
export class AccountsActivityActionViewItem extends MenuActivityActionViewItem {
static readonly ACCOUNTS_VISIBILITY_PREFERENCE_KEY = 'workbench.activity.showAccounts';
@@ -288,7 +240,7 @@ export class AccountsActivityActionViewItem extends MenuActivityActionViewItem {
}));
const signOutAction = disposables.add(new Action('signOut', localize('signOut', "Sign Out"), '', true, () => {
return this.authenticationService.signOutOfAccount(sessionInfo.providerId, accountName);
return this.authenticationService.removeAccountSessions(sessionInfo.providerId, accountName, sessionInfo.sessions[accountName]);
}));
const providerSubMenuActions = [manageExtensionsAction];
@@ -307,6 +259,11 @@ export class AccountsActivityActionViewItem extends MenuActivityActionViewItem {
}
});
if (providers.length && !menus.length) {
const noAccountsAvailableAction = disposables.add(new Action('noAccountsAvailable', localize('noAccounts', "You are not signed in to any accounts"), undefined, false));
menus.push(noAccountsAvailableAction);
}
if (menus.length && otherCommands.length) {
menus.push(disposables.add(new Separator()));
}
@@ -422,15 +379,6 @@ registerAction2(
);
registerThemingParticipant((theme, collector) => {
const activityBarBackgroundColor = theme.getColor(ACTIVITY_BAR_BACKGROUND);
if (activityBarBackgroundColor) {
collector.addRule(`
.monaco-workbench .activitybar > .content > .home-bar > .home-bar-icon-badge {
background-color: ${activityBarBackgroundColor};
}
`);
}
const activityBarForegroundColor = theme.getColor(ACTIVITY_BAR_FOREGROUND);
if (activityBarForegroundColor) {
collector.addRule(`
@@ -439,7 +387,6 @@ registerThemingParticipant((theme, collector) => {
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:hover .action-label:not(.codicon) {
background-color: ${activityBarForegroundColor} !important;
}
.monaco-workbench .activitybar > .content .home-bar > .monaco-action-bar .action-item .action-label.codicon,
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item.active .action-label.codicon,
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:focus .action-label.codicon,
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .action-item:hover .action-label.codicon {

View File

@@ -8,7 +8,7 @@ import { localize } from 'vs/nls';
import { ActionsOrientation, ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { GLOBAL_ACTIVITY_ID, IActivity, ACCOUNTS_ACTIVITY_ID } from 'vs/workbench/common/activity';
import { Part } from 'vs/workbench/browser/part';
import { GlobalActivityActionViewItem, ViewContainerActivityAction, PlaceHolderToggleCompositePinnedAction, PlaceHolderViewContainerActivityAction, AccountsActivityActionViewItem, HomeActivityActionViewItem } from 'vs/workbench/browser/parts/activitybar/activitybarActions';
import { GlobalActivityActionViewItem, ViewContainerActivityAction, PlaceHolderToggleCompositePinnedAction, PlaceHolderViewContainerActivityAction, AccountsActivityActionViewItem } from 'vs/workbench/browser/parts/activitybar/activitybarActions';
import { IBadge, NumberBadge } from 'vs/workbench/services/activity/common/activity';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
@@ -23,8 +23,8 @@ import { IStorageService, StorageScope, IStorageValueChangeEvent, StorageTarget
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { URI, UriComponents } from 'vs/base/common/uri';
import { ToggleCompositePinnedAction, ICompositeBarColors, ActivityAction, ICompositeActivity } from 'vs/workbench/browser/parts/compositeBarActions';
import { IViewDescriptorService, ViewContainer, IViewContainerModel, ViewContainerLocation, IViewsService } from 'vs/workbench/common/views';
import { IContextKeyService, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { IViewDescriptorService, ViewContainer, IViewContainerModel, ViewContainerLocation, IViewsService, getEnabledViewContainerContextKey } from 'vs/workbench/common/views';
import { IContextKeyService, ContextKeyExpr, IContextKey } from 'vs/platform/contextkey/common/contextkey';
import { assertIsDefined, isString } from 'vs/base/common/types';
import { IActivityBarService } from 'vs/workbench/services/activityBar/browser/activityBarService';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
@@ -32,9 +32,9 @@ import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/
import { CustomMenubarControl } from 'vs/workbench/browser/parts/titlebar/menubarControl';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { getMenuBarVisibility } from 'vs/platform/windows/common/windows';
import { isNative, isWeb } from 'vs/base/common/platform';
import { isNative } from 'vs/base/common/platform';
import { Before2D } from 'vs/workbench/browser/dnd';
import { Codicon, iconRegistry } from 'vs/base/common/codicons';
import { Codicon } from 'vs/base/common/codicons';
import { IAction, Separator, toAction } from 'vs/base/common/actions';
import { Event } from 'vs/base/common/event';
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
@@ -94,9 +94,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
private content: HTMLElement | undefined;
private homeBar: ActionBar | undefined;
private homeBarContainer: HTMLElement | undefined;
private menuBar: CustomMenubarControl | undefined;
private menuBarContainer: HTMLElement | undefined;
@@ -120,6 +117,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
private readonly location = ViewContainerLocation.Sidebar;
private hasExtensionsRegistered: boolean = false;
private readonly enabledViewContainersContextKeys: Map<string, IContextKey<boolean>> = new Map<string, IContextKey<boolean>>();
constructor(
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService,
@@ -163,25 +162,11 @@ export class ActivitybarPart extends Part implements IActivityBarService {
getCompositePinnedAction: compositeId => this.getCompositeActions(compositeId).pinnedAction,
getOnCompositeClickAction: compositeId => toAction({ id: compositeId, label: '', run: async () => this.viewsService.isViewContainerVisible(compositeId) ? this.viewsService.closeViewContainer(compositeId) : this.viewsService.openViewContainer(compositeId) }),
fillExtraContextMenuActions: actions => {
// Home
const topActions: IAction[] = [];
if (this.homeBarContainer) {
topActions.push({
id: 'toggleHomeBarAction',
label: localize('homeButton', "Home Button"),
class: undefined,
tooltip: localize('homeButton', "Home Button"),
checked: this.homeBarVisibilityPreference,
enabled: true,
run: async () => this.homeBarVisibilityPreference = !this.homeBarVisibilityPreference,
dispose: () => { }
});
}
// Menu
const menuBarVisibility = getMenuBarVisibility(this.configurationService);
if (menuBarVisibility === 'compact' || (menuBarVisibility === 'hidden' && isWeb)) {
if (menuBarVisibility === 'compact' || menuBarVisibility === 'hidden' || menuBarVisibility === 'toggle') {
topActions.push({
id: 'toggleMenuVisibility',
label: localize('menu', "Menu"),
@@ -189,7 +174,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
tooltip: localize('menu', "Menu"),
checked: menuBarVisibility === 'compact',
enabled: true,
run: async () => this.layoutService.toggleMenuBar(),
run: async () => this.configurationService.updateValue('window.menuBarVisibility', menuBarVisibility === 'compact' ? 'toggle' : 'compact'),
dispose: () => { }
});
}
@@ -309,12 +294,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
}
}
private onDidChangeHomeBarVisibility(): void {
if (this.homeBarContainer) {
this.homeBarContainer.style.display = this.homeBarVisibilityPreference ? '' : 'none';
}
}
private onDidRegisterExtensions(): void {
this.hasExtensionsRegistered = true;
@@ -340,7 +319,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
if (viewContainer) {
// Update the composite bar by adding
this.compositeBar.addComposite(viewContainer);
this.addComposite(viewContainer);
this.compositeBar.activateComposite(viewContainer.id);
if (this.shouldBeHidden(viewContainer)) {
@@ -459,11 +438,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
this.menuBarContainer.classList.add('menubar');
const content = assertIsDefined(this.content);
if (this.homeBarContainer) {
content.insertBefore(this.menuBarContainer, this.homeBarContainer.nextSibling);
} else {
content.prepend(this.menuBarContainer);
}
content.prepend(this.menuBarContainer);
// Menubar: install a custom menu bar depending on configuration
this.menuBar = this._register(this.instantiationService.createInstance(CustomMenubarControl));
@@ -479,19 +454,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
this.content.classList.add('content');
parent.appendChild(this.content);
// Home action bar
const homeIndicator = this.environmentService.options?.homeIndicator;
// TODO @sbatten remove the fake setting and associated code
if (homeIndicator && this.configurationService.getValue<boolean>('window.showHomeIndicator')) {
let codicon = iconRegistry.get(homeIndicator.icon);
if (!codicon) {
codicon = Codicon.code;
}
this.createHomeBar(homeIndicator.href, codicon);
this.onDidChangeHomeBarVisibility();
}
// Install menubar if compact
if (getMenuBarVisibility(this.configurationService) === 'compact') {
this.installMenubar();
@@ -515,20 +477,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
private registerKeyboardNavigationListeners(): void {
this.keyboardNavigationDisposables.clear();
// Down arrow on home indicator
if (this.homeBarContainer) {
this.keyboardNavigationDisposables.add(addDisposableListener(this.homeBarContainer, EventType.KEY_DOWN, e => {
const kbEvent = new StandardKeyboardEvent(e);
if (kbEvent.equals(KeyCode.DownArrow) || kbEvent.equals(KeyCode.RightArrow)) {
if (this.menuBar) {
this.menuBar.toggleFocus();
} else if (this.compositeBar) {
this.compositeBar.focus();
}
}
}));
}
// Up/Down arrow on compact menu
if (this.menuBarContainer) {
this.keyboardNavigationDisposables.add(addDisposableListener(this.menuBarContainer, EventType.KEY_DOWN, e => {
@@ -537,10 +485,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
if (this.compositeBar) {
this.compositeBar.focus();
}
} else if (kbEvent.equals(KeyCode.UpArrow) || kbEvent.equals(KeyCode.LeftArrow)) {
if (this.homeBar) {
this.homeBar.focus();
}
}
}));
}
@@ -556,8 +500,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
} else if (kbEvent.equals(KeyCode.UpArrow) || kbEvent.equals(KeyCode.LeftArrow)) {
if (this.menuBar) {
this.menuBar.toggleFocus();
} else if (this.homeBar) {
this.homeBar.focus();
}
}
}));
@@ -576,35 +518,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
}
}
private createHomeBar(href: string, icon: Codicon): void {
this.homeBarContainer = document.createElement('div');
this.homeBarContainer.setAttribute('aria-label', localize('homeIndicator', "Home"));
this.homeBarContainer.setAttribute('role', 'toolbar');
this.homeBarContainer.classList.add('home-bar');
this.homeBar = this._register(new ActionBar(this.homeBarContainer, {
actionViewItemProvider: action => this.instantiationService.createInstance(HomeActivityActionViewItem, href, action as ActivityAction, () => this.compositeBar.getContextMenuActions(), (theme: IColorTheme) => this.getActivitybarItemColors(theme)),
orientation: ActionsOrientation.VERTICAL,
ariaLabel: localize('home', "Home"),
animated: false,
preventLoopNavigation: true,
ignoreOrientationForPreviousAndNextKey: true
}));
const homeBarIconBadge = document.createElement('div');
homeBarIconBadge.classList.add('home-bar-icon-badge');
this.homeBarContainer.appendChild(homeBarIconBadge);
this.homeBar.push(this._register(new ActivityAction({
id: 'workbench.actions.home',
name: localize('home', "Home"),
cssClass: icon.classNames
})));
const content = assertIsDefined(this.content);
content.appendChild(this.homeBarContainer);
}
private createGlobalActivityActionBar(container: HTMLElement): void {
this.globalActivityActionBar = this._register(new ActionBar(container, {
actionViewItemProvider: action => {
@@ -621,8 +534,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
orientation: ActionsOrientation.VERTICAL,
ariaLabel: localize('manage', "Manage"),
animated: false,
preventLoopNavigation: true,
ignoreOrientationForPreviousAndNextKey: true
preventLoopNavigation: true
}));
this.globalActivityAction = this._register(new ActivityAction({
@@ -669,8 +581,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
if (viewContainer) {
const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer);
compositeActions = {
activityAction: this.instantiationService.createInstance(ViewContainerActivityAction, this.toActivity(viewContainer, viewContainerModel)),
pinnedAction: new ToggleCompositePinnedAction(viewContainer, this.compositeBar)
activityAction: this.instantiationService.createInstance(ViewContainerActivityAction, this.toActivity(viewContainerModel)),
pinnedAction: new ToggleCompositePinnedAction(this.toActivity(viewContainerModel), this.compositeBar)
};
} else {
const cachedComposite = this.cachedViewContainers.filter(c => c.id === compositeId)[0];
@@ -688,7 +600,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
private onDidRegisterViewContainers(viewContainers: ReadonlyArray<ViewContainer>): void {
for (const viewContainer of viewContainers) {
this.compositeBar.addComposite(viewContainer);
this.addComposite(viewContainer);
// Pin it by default if it is new
const cachedViewContainer = this.cachedViewContainers.filter(({ id }) => id === viewContainer.id)[0];
@@ -725,7 +637,7 @@ export class ActivitybarPart extends Part implements IActivityBarService {
}
private updateActivity(viewContainer: ViewContainer, viewContainerModel: IViewContainerModel): void {
const activity: IActivity = this.toActivity(viewContainer, viewContainerModel);
const activity: IActivity = this.toActivity(viewContainerModel);
const { activityAction, pinnedAction } = this.getCompositeActions(viewContainer.id);
activityAction.updateActivity(activity);
@@ -736,8 +648,8 @@ export class ActivitybarPart extends Part implements IActivityBarService {
this.saveCachedViewContainers();
}
private toActivity({ id, focusCommand }: ViewContainer, { icon, title: name }: IViewContainerModel): IActivity {
return ActivitybarPart.toActivity(id, name, icon, focusCommand?.id || id);
private toActivity(viewContainerModel: IViewContainerModel): IActivity {
return ActivitybarPart.toActivity(viewContainerModel.viewContainer.id, viewContainerModel.title, viewContainerModel.icon, viewContainerModel.keybindingId);
}
private static toActivity(id: string, name: string, icon: URI | ThemeIcon | undefined, keybindingId: string | undefined): IActivity {
@@ -764,10 +676,17 @@ export class ActivitybarPart extends Part implements IActivityBarService {
}
private showOrHideViewContainer(viewContainer: ViewContainer): void {
let contextKey = this.enabledViewContainersContextKeys.get(viewContainer.id);
if (!contextKey) {
contextKey = this.contextKeyService.createKey(getEnabledViewContainerContextKey(viewContainer.id), false);
this.enabledViewContainersContextKeys.set(viewContainer.id, contextKey);
}
if (this.shouldBeHidden(viewContainer)) {
contextKey.set(false);
this.hideComposite(viewContainer.id);
} else {
this.compositeBar.addComposite(viewContainer);
contextKey.set(true);
this.addComposite(viewContainer);
}
}
@@ -802,6 +721,10 @@ export class ActivitybarPart extends Part implements IActivityBarService {
return true;
}
private addComposite(viewContainer: ViewContainer): void {
this.compositeBar.addComposite({ id: viewContainer.id, name: viewContainer.title, order: viewContainer.order, requestedIndex: viewContainer.requestedIndex });
}
private hideComposite(compositeId: string): void {
this.compositeBar.hideComposite(compositeId);
@@ -877,9 +800,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
// Layout composite bar
let availableHeight = contentAreaSize.height;
if (this.homeBarContainer) {
availableHeight -= this.homeBarContainer.clientHeight;
}
if (this.menuBarContainer) {
availableHeight -= this.menuBarContainer.clientHeight;
}
@@ -927,10 +847,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
this.compositeBar.setCompositeBarItems(newCompositeItems);
}
if (e.key === HomeActivityActionViewItem.HOME_BAR_VISIBILITY_PREFERENCE && e.scope === StorageScope.GLOBAL) {
this.onDidChangeHomeBarVisibility();
}
if (e.key === AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY && e.scope === StorageScope.GLOBAL) {
this.toggleAccountsActivity();
}
@@ -1067,14 +983,6 @@ export class ActivitybarPart extends Part implements IActivityBarService {
this.storageService.store(ActivitybarPart.PLACEHOLDER_VIEW_CONTAINERS, value, StorageScope.GLOBAL, StorageTarget.MACHINE);
}
private get homeBarVisibilityPreference(): boolean {
return this.storageService.getBoolean(HomeActivityActionViewItem.HOME_BAR_VISIBILITY_PREFERENCE, StorageScope.GLOBAL, true);
}
private set homeBarVisibilityPreference(value: boolean) {
this.storageService.store(HomeActivityActionViewItem.HOME_BAR_VISIBILITY_PREFERENCE, value, StorageScope.GLOBAL, StorageTarget.USER);
}
private get accountsVisibilityPreference(): boolean {
return this.storageService.getBoolean(AccountsActivityActionViewItem.ACCOUNTS_VISIBILITY_PREFERENCE_KEY, StorageScope.GLOBAL, true);
}

View File

@@ -156,6 +156,19 @@
text-align: center;
}
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .badge .codicon.badge-content {
font-size: 12px;
font-weight: unset;
padding: 0 2px;
}
.monaco-workbench .activitybar > .content :not(.monaco-menu) > .monaco-action-bar .badge .codicon.badge-content::before {
text-align: center;
vertical-align: baseline;
}
/* Right aligned */
.monaco-workbench .activitybar.right > .content :not(.monaco-menu) > .monaco-action-bar .action-label:not(.codicon) {

View File

@@ -45,30 +45,6 @@
background-color: inherit;
}
/** Home Bar */
.monaco-workbench .activitybar > .content > .home-bar {
position: relative;
width: 100%;
height: 48px;
}
.monaco-workbench .activitybar > .content > .home-bar > .home-bar-icon-badge {
position: absolute;
right: 10px;
bottom: 9px;
width: 14px;
height: 14px;
z-index: 1; /* on top of home indicator */
background-image: url('../../../media/code-icon.svg');
background-repeat: no-repeat;
background-position: center center;
background-size: 14px;
pointer-events: none;
border-top: 2px solid transparent;
border-left: 2px solid transparent;
}
/** Viewlet Switcher */
.monaco-workbench .activitybar > .content .monaco-action-bar {

View File

@@ -3,10 +3,10 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { IAction, toAction } from 'vs/base/common/actions';
import { illegalArgument } from 'vs/base/common/errors';
import * as arrays from 'vs/base/common/arrays';
import { equals } from 'vs/base/common/arrays';
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
import { IBadge } from 'vs/workbench/services/activity/common/activity';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
@@ -224,10 +224,9 @@ export class CompositeBar extends Widget implements ICompositeBar {
);
},
orientation: this.options.orientation,
ariaLabel: nls.localize('activityBarAriaLabel', "Active View Switcher"),
ariaLabel: localize('activityBarAriaLabel', "Active View Switcher"),
animated: false,
preventLoopNavigation: this.options.preventLoopNavigation,
ignoreOrientationForPreviousAndNextKey: true,
triggerKeys: { keyDown: true }
}));
@@ -539,7 +538,7 @@ export class CompositeBar extends Widget implements ICompositeBar {
compositesToShow.length ? compositesToShow.splice(compositesToShow.length - 2, 1) : compositesToShow.pop();
}
const visibleCompositesChange = !arrays.equals(compositesToShow, this.visibleComposites);
const visibleCompositesChange = !equals(compositesToShow, this.visibleComposites);
// Pull out overflow action if there is a composite change so that we can add it to the end later
if (this.compositeOverflowAction && visibleCompositesChange) {

View File

@@ -3,13 +3,13 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { Action, IAction, Separator } from 'vs/base/common/actions';
import * as dom from 'vs/base/browser/dom';
import { $, addDisposableListener, append, clearNode, EventHelper, EventType, getDomNodePagePosition, hide, show } from 'vs/base/browser/dom';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { dispose, toDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IThemeService, IColorTheme } from 'vs/platform/theme/common/themeService';
import { IThemeService, IColorTheme, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { TextBadge, NumberBadge, IBadge, IconBadge, ProgressBadge } from 'vs/workbench/services/activity/common/activity';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { contrastBorder } from 'vs/platform/theme/common/colorRegistry';
@@ -19,8 +19,8 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { Emitter, Event } from 'vs/base/common/event';
import { CompositeDragAndDropObserver, ICompositeDragAndDrop, Before2D, toggleDropEffect } from 'vs/workbench/browser/dnd';
import { Color } from 'vs/base/common/color';
import { Codicon } from 'vs/base/common/codicons';
import { IBaseActionViewItemOptions, BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
import { Codicon } from 'vs/base/common/codicons';
export interface ICompositeActivity {
badge: IBadge;
@@ -125,6 +125,7 @@ export interface ICompositeBarColors {
export interface IActivityActionViewItemOptions extends IBaseActionViewItemOptions {
icon?: boolean;
colors: (theme: IColorTheme) => ICompositeBarColors;
hasPopup?: boolean;
}
export class ActivityActionViewItem extends BaseActionViewItem {
@@ -199,16 +200,19 @@ export class ActivityActionViewItem extends BaseActionViewItem {
this.container = container;
// Make the container tab-able for keyboard navigation
this.container.tabIndex = 0;
this.container.setAttribute('role', 'tab');
if (this.options.hasPopup) {
this.container.setAttribute('role', 'button');
this.container.setAttribute('aria-haspopup', 'true');
} else {
this.container.setAttribute('role', 'tab');
}
// Try hard to prevent keyboard only focus feedback when using mouse
this._register(dom.addDisposableListener(this.container, dom.EventType.MOUSE_DOWN, () => {
this._register(addDisposableListener(this.container, EventType.MOUSE_DOWN, () => {
this.container.classList.add('clicked');
}));
this._register(dom.addDisposableListener(this.container, dom.EventType.MOUSE_UP, () => {
this._register(addDisposableListener(this.container, EventType.MOUSE_UP, () => {
if (this.mouseUpTimeout) {
clearTimeout(this.mouseUpTimeout);
}
@@ -219,19 +223,19 @@ export class ActivityActionViewItem extends BaseActionViewItem {
}));
// Label
this.label = dom.append(container, dom.$('a'));
this.label = append(container, $('a'));
// Badge
this.badge = dom.append(container, dom.$('.badge'));
this.badgeContent = dom.append(this.badge, dom.$('.badge-content'));
this.badge = append(container, $('.badge'));
this.badgeContent = append(this.badge, $('.badge-content'));
// Activity bar active border + background
const isActivityBarItem = this.options.icon;
if (isActivityBarItem) {
dom.append(container, dom.$('.active-item-indicator'));
append(container, $('.active-item-indicator'));
}
dom.hide(this.badge);
hide(this.badge);
this.updateActivity();
this.updateStyles();
@@ -259,8 +263,8 @@ export class ActivityActionViewItem extends BaseActionViewItem {
this.badgeDisposable.clear();
dom.clearNode(this.badgeContent);
dom.hide(this.badge);
clearNode(this.badgeContent);
hide(this.badge);
if (badge) {
@@ -278,24 +282,26 @@ export class ActivityActionViewItem extends BaseActionViewItem {
}
}
this.badgeContent.textContent = number;
dom.show(this.badge);
show(this.badge);
}
}
// Text
else if (badge instanceof TextBadge) {
this.badgeContent.textContent = badge.text;
dom.show(this.badge);
show(this.badge);
}
// Text
// Icon
else if (badge instanceof IconBadge) {
dom.show(this.badge);
const clazzList = ThemeIcon.asClassNameArray(badge.icon);
this.badgeContent.classList.add(...clazzList);
show(this.badge);
}
// Progress
else if (badge instanceof ProgressBadge) {
dom.show(this.badge);
show(this.badge);
}
if (clazz) {
@@ -308,7 +314,7 @@ export class ActivityActionViewItem extends BaseActionViewItem {
let title: string;
if (badge?.getDescription()) {
if (this.activity.name) {
title = nls.localize('badgeTitle', "{0} - {1}", this.activity.name, badge.getDescription());
title = localize('badgeTitle', "{0} - {1}", this.activity.name, badge.getDescription());
} else {
title = badge.getDescription();
}
@@ -363,7 +369,7 @@ export class CompositeOverflowActivityAction extends ActivityAction {
) {
super({
id: 'additionalComposites.action',
name: nls.localize('additionalViews', "Additional Views"),
name: localize('additionalViews', "Additional Views"),
cssClass: Codicon.more.classNames
});
}
@@ -386,7 +392,7 @@ export class CompositeOverflowActivityActionViewItem extends ActivityActionViewI
@IContextMenuService private readonly contextMenuService: IContextMenuService,
@IThemeService themeService: IThemeService
) {
super(action, { icon: true, colors }, themeService);
super(action, { icon: true, colors, hasPopup: true }, themeService);
}
showMenu(): void {
@@ -418,7 +424,7 @@ export class CompositeOverflowActivityActionViewItem extends ActivityActionViewI
}
if (suffix) {
action.label = nls.localize('numberBadge', "{0} ({1})", composite.name, suffix);
action.label = localize('numberBadge', "{0} ({1})", composite.name, suffix);
} else {
action.label = composite.name || '';
}
@@ -441,7 +447,7 @@ class ManageExtensionAction extends Action {
constructor(
@ICommandService private readonly commandService: ICommandService
) {
super('activitybar.manage.extension', nls.localize('manageExtension', "Manage Extension"));
super('activitybar.manage.extension', localize('manageExtension', "Manage Extension"));
}
run(id: string): Promise<void> {
@@ -507,7 +513,7 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
}
const keybinding = this.compositeActivityAction.activity.keybindingId ? this.keybindingService.lookupKeybinding(this.compositeActivityAction.activity.keybindingId) : null;
return keybinding ? nls.localize('titleKeybinding', "{0} ({1})", name, keybinding.getLabel()) : name;
return keybinding ? localize('titleKeybinding', "{0} ({1})", name, keybinding.getLabel()) : name;
}
render(container: HTMLElement): void {
@@ -516,8 +522,8 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
this.updateChecked();
this.updateEnabled();
this._register(dom.addDisposableListener(this.container, dom.EventType.CONTEXT_MENU, e => {
dom.EventHelper.stop(e, true);
this._register(addDisposableListener(this.container, EventType.CONTEXT_MENU, e => {
EventHelper.stop(e, true);
this.showContextMenu(container);
}));
@@ -540,7 +546,7 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
},
onDrop: e => {
dom.EventHelper.stop(e.eventData, true);
EventHelper.stop(e.eventData, true);
this.dndHandler.drop(e.dragAndDropData, this.activity.id, e.eventData, insertDropBefore);
insertDropBefore = this.updateFromDragging(container, false, e.eventData);
},
@@ -620,10 +626,10 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
const isPinned = this.compositeBar.isPinned(this.activity.id);
if (isPinned) {
this.toggleCompositePinnedAction.label = nls.localize('hide', "Hide '{0}'", this.getActivtyName(true));
this.toggleCompositePinnedAction.label = localize('hide', "Hide '{0}'", this.getActivtyName(true));
this.toggleCompositePinnedAction.checked = false;
} else {
this.toggleCompositePinnedAction.label = nls.localize('keep', "Keep '{0}'", this.getActivtyName(true));
this.toggleCompositePinnedAction.label = localize('keep', "Keep '{0}'", this.getActivtyName(true));
}
const otherActions = this.contextMenuActionsProvider();
@@ -632,7 +638,7 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
actions.push(...otherActions);
}
const elementPosition = dom.getDomNodePagePosition(container);
const elementPosition = getDomNodePagePosition(container);
const anchor = {
x: Math.floor(elementPosition.left + (elementPosition.width / 2)),
y: elementPosition.top + elementPosition.height
@@ -645,10 +651,6 @@ export class CompositeActionViewItem extends ActivityActionViewItem {
});
}
focus(): void {
this.container.focus();
}
protected updateChecked(): void {
if (this.getAction().checked) {
this.container.classList.add('checked');
@@ -688,7 +690,7 @@ export class ToggleCompositePinnedAction extends Action {
private activity: IActivity | undefined,
private compositeBar: ICompositeBar
) {
super('show.toggleCompositePinned', activity ? activity.name : nls.localize('toggle', "Toggle View Pinned"));
super('show.toggleCompositePinned', activity ? activity.name : localize('toggle', "Toggle View Pinned"));
this.checked = !!this.activity && this.compositeBar.isPinned(this.activity.id);
}

View File

@@ -4,15 +4,15 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/compositepart';
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { defaultGenerator } from 'vs/base/common/idGenerator';
import { IDisposable, dispose, DisposableStore, MutableDisposable } from 'vs/base/common/lifecycle';
import { Emitter } from 'vs/base/common/event';
import * as errors from 'vs/base/common/errors';
import { isPromiseCanceledError } from 'vs/base/common/errors';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { ActionsOrientation, prepareActions } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionsOrientation, IActionViewItem, prepareActions } from 'vs/base/browser/ui/actionbar/actionbar';
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar';
import { IAction, WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification, IActionViewItem } from 'vs/base/common/actions';
import { IAction, WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification } from 'vs/base/common/actions';
import { Part, IPartOptions } from 'vs/workbench/browser/part';
import { Composite, CompositeRegistry } from 'vs/workbench/browser/composite';
import { IComposite } from 'vs/workbench/common/composite';
@@ -96,7 +96,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
protected openComposite(id: string, focus?: boolean): Composite | undefined {
// Check if composite already visible and just focus in that case
if (this.activeComposite && this.activeComposite.getId() === id) {
if (this.activeComposite?.getId() === id) {
if (focus) {
this.activeComposite.focus();
}
@@ -137,7 +137,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
}
// Check if composite already visible and just focus in that case
if (this.activeComposite && this.activeComposite.getId() === composite.getId()) {
if (this.activeComposite?.getId() === composite.getId()) {
if (focus) {
composite.focus();
}
@@ -258,7 +258,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
this.telemetryActionsListener.value = toolBar.actionRunner.onDidRun(e => {
// Check for Error
if (e.error && !errors.isPromiseCanceledError(e.error)) {
if (e.error && !isPromiseCanceledError(e.error)) {
this.notificationService.error(e.error);
}
@@ -290,7 +290,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
}
// Active Composite
if (this.activeComposite && this.activeComposite.getId() === compositeId) {
if (this.activeComposite?.getId() === compositeId) {
// Actions
const actionsBinding = this.collectCompositeActions(this.activeComposite);
this.mapActionsBindingToComposite.set(this.activeComposite.getId(), actionsBinding);
@@ -318,7 +318,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
this.titleLabel.updateTitle(compositeId, compositeTitle, withNullAsUndefined(keybinding?.getLabel()));
const toolBar = assertIsDefined(this.toolBar);
toolBar.setAriaLabel(nls.localize('ariaCompositeToolbarLabel', "{0} actions", compositeTitle));
toolBar.setAriaLabel(localize('ariaCompositeToolbarLabel', "{0} actions", compositeTitle));
}
private collectCompositeActions(composite?: Composite): () => void {
@@ -394,7 +394,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
orientation: ActionsOrientation.HORIZONTAL,
getKeyBinding: action => this.keybindingService.lookupKeybinding(action.id),
anchorAlignmentProvider: () => this.getTitleAreaDropDownAnchorAlignment(),
toggleMenuTitle: nls.localize('viewsAndMoreActions', "Views and More Actions...")
toggleMenuTitle: localize('viewsAndMoreActions', "Views and More Actions...")
}));
this.collectCompositeActions()();
@@ -413,7 +413,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
// The title label is shared for all composites in the base CompositePart
if (!this.activeComposite || this.activeComposite.getId() === id) {
titleLabel.innerText = title;
titleLabel.title = keybinding ? nls.localize('titleTooltip', "{0} ({1})", title, keybinding) : title;
titleLabel.title = keybinding ? localize('titleTooltip', "{0} ({1})", title, keybinding) : title;
}
},
@@ -484,7 +484,7 @@ export abstract class CompositePart<T extends Composite> extends Part {
}
protected removeComposite(compositeId: string): boolean {
if (this.activeComposite && this.activeComposite.getId() === compositeId) {
if (this.activeComposite?.getId() === compositeId) {
return false; // do not remove active composite
}

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { IDialogOptions, IConfirmation, IConfirmationResult, DialogType, IShowResult, IInputResult, ICheckbox, IInput, IDialogHandler } from 'vs/platform/dialogs/common/dialogs';
import { ILayoutService } from 'vs/platform/layout/browser/layoutService';
import { ILogService } from 'vs/platform/log/common/log';
@@ -46,13 +46,13 @@ export class BrowserDialogHandler implements IDialogHandler {
if (confirmation.primaryButton) {
buttons.push(confirmation.primaryButton);
} else {
buttons.push(nls.localize({ key: 'yesButton', comment: ['&& denotes a mnemonic'] }, "&&Yes"));
buttons.push(localize({ key: 'yesButton', comment: ['&& denotes a mnemonic'] }, "&&Yes"));
}
if (confirmation.secondaryButton) {
buttons.push(confirmation.secondaryButton);
} else if (typeof confirmation.secondaryButton === 'undefined') {
buttons.push(nls.localize('cancelButton', "Cancel"));
buttons.push(localize('cancelButton', "Cancel"));
}
const result = await this.doShow(confirmation.type, confirmation.message, buttons, confirmation.detail, 1, confirmation.checkbox);
@@ -87,7 +87,7 @@ export class BrowserDialogHandler implements IDialogHandler {
type,
keyEventProcessor: (event: StandardKeyboardEvent) => {
const resolved = this.keybindingService.softDispatch(event, this.layoutService.container);
if (resolved && resolved.commandId) {
if (resolved?.commandId) {
if (BrowserDialogHandler.ALLOWABLE_COMMANDS.indexOf(resolved.commandId) === -1) {
EventHelper.stop(event, true);
}
@@ -121,8 +121,13 @@ export class BrowserDialogHandler implements IDialogHandler {
async about(): Promise<void> {
const detailString = (useAgo: boolean): string => {
<<<<<<< HEAD
return nls.localize('aboutDetail',
"code-server: v{4}\n VS Code: v{0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
=======
return localize('aboutDetail',
"Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
>>>>>>> e8cd17a97d8c58fffcbac05394b3ee2b3c72d384
this.productService.version || 'Unknown',
this.productService.commit || 'Unknown',
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
@@ -135,7 +140,7 @@ export class BrowserDialogHandler implements IDialogHandler {
const detailToCopy = detailString(false);
const { choice } = await this.show(Severity.Info, this.productService.nameLong, [nls.localize('copy', "Copy"), nls.localize('ok', "OK")], { detail, cancelId: 1 });
const { choice } = await this.show(Severity.Info, this.productService.nameLong, [localize('copy', "Copy"), localize('ok', "OK")], { detail, cancelId: 1 });
if (choice === 0) {
this.clipboardService.writeText(detailToCopy);

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { BINARY_DIFF_EDITOR_ID } from 'vs/workbench/common/editor';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
@@ -33,7 +33,7 @@ export class BinaryResourceDiffEditor extends SideBySideEditor {
const secondary = this.secondaryEditorPane;
if (primary instanceof BaseBinaryResourceEditor && secondary instanceof BaseBinaryResourceEditor) {
return nls.localize('metadataDiff', "{0} ↔ {1}", secondary.getMetadata(), primary.getMetadata());
return localize('metadataDiff', "{0} ↔ {1}", secondary.getMetadata(), primary.getMetadata());
}
return undefined;

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/binaryeditor';
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { Emitter } from 'vs/base/common/event';
import { EditorInput, EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
@@ -32,8 +32,8 @@ export interface IOpenCallbacks {
*/
export abstract class BaseBinaryResourceEditor extends EditorPane {
private readonly _onMetadataChanged = this._register(new Emitter<void>());
readonly onMetadataChanged = this._onMetadataChanged.event;
private readonly _onDidChangeMetadata = this._register(new Emitter<void>());
readonly onDidChangeMetadata = this._onDidChangeMetadata.event;
private readonly _onDidOpenInPlace = this._register(new Emitter<void>());
readonly onDidOpenInPlace = this._onDidOpenInPlace.event;
@@ -58,7 +58,7 @@ export abstract class BaseBinaryResourceEditor extends EditorPane {
}
getTitle(): string {
return this.input ? this.input.getName() : nls.localize('binaryEditor', "Binary Viewer");
return this.input ? this.input.getName() : localize('binaryEditor', "Binary Viewer");
}
protected createEditor(parent: HTMLElement): void {
@@ -111,7 +111,7 @@ export abstract class BaseBinaryResourceEditor extends EditorPane {
private handleMetadataChanged(meta: string | undefined): void {
this.metadata = meta;
this._onMetadataChanged.fire();
this._onDidChangeMetadata.fire();
}
getMetadata(): string | undefined {
@@ -139,7 +139,7 @@ export abstract class BaseBinaryResourceEditor extends EditorPane {
const [binaryContainer, scrollbar] = assertAllDefined(this.binaryContainer, this.scrollbar);
size(binaryContainer, dimension.width, dimension.height);
scrollbar.scanDomNode();
if (this.resourceViewerContext && this.resourceViewerContext.layout) {
if (typeof this.resourceViewerContext?.layout === 'function') {
this.resourceViewerContext.layout(dimension);
}
}
@@ -217,7 +217,7 @@ class FileTooLargeFileView {
clearNode(container);
const label = document.createElement('span');
label.textContent = nls.localize('nativeFileTooLargeError', "The file is not displayed in the editor because it is too large ({0}).", size);
label.textContent = localize('nativeFileTooLargeError', "The file is not displayed in the editor because it is too large ({0}).", size);
container.appendChild(label);
scrollbar.scanDomNode();
@@ -240,12 +240,12 @@ class FileSeemsBinaryFileView {
const disposables = new DisposableStore();
const label = document.createElement('p');
label.textContent = nls.localize('nativeBinaryError', "The file is not displayed in the editor because it is either binary or uses an unsupported text encoding.");
label.textContent = localize('nativeBinaryError', "The file is not displayed in the editor because it is either binary or uses an unsupported text encoding.");
container.appendChild(label);
const link = append(label, $('a.embedded-link'));
link.setAttribute('role', 'button');
link.textContent = nls.localize('openAsText', "Do you want to open it anyway?");
link.textContent = localize('openAsText', "Do you want to open it anyway?");
disposables.add(addDisposableListener(link, EventType.CLICK, () => delegate.openInternalClb(descriptor.resource)));

View File

@@ -251,12 +251,13 @@ export class BreadcrumbsControl {
// honor diff editors and such
const uri = EditorResourceAccessor.getCanonicalUri(this._editorGroup.activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY });
const wasHidden = this.isHidden();
if (!uri || !this._fileService.canHandleResource(uri)) {
// cleanup and return when there is no input or when
// we cannot handle this input
this._ckBreadcrumbsPossible.set(false);
if (!this.isHidden()) {
if (!wasHidden) {
this.hide();
return true;
} else {
@@ -315,7 +316,7 @@ export class BreadcrumbsControl {
}
});
return true;
return wasHidden !== this.isHidden();
}
private _onFocusEvent(event: IBreadcrumbsItemEvent): void {

View File

@@ -427,15 +427,9 @@ export class BreadcrumbsFilePicker extends BreadcrumbsPicker {
}
async _revealElement(element: IFileStat | IWorkspaceFolder, options: IEditorOptions, sideBySide: boolean): Promise<boolean> {
let resource: URI | undefined;
if (isWorkspaceFolder(element)) {
resource = element.uri;
} else if (!element.isDirectory) {
resource = element.resource;
}
if (resource) {
if (!isWorkspaceFolder(element) && element.isFile) {
this._onWillPickElement.fire();
await this._editorService.openEditor({ resource, options }, sideBySide ? SIDE_GROUP : undefined);
await this._editorService.openEditor({ resource: element.resource, options }, sideBySide ? SIDE_GROUP : undefined);
return true;
}
return false;

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { URI, UriComponents } from 'vs/base/common/uri';
import { IEditorRegistry, EditorDescriptor, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
import { EditorInput, IEditorInputFactory, SideBySideEditorInput, IEditorInputFactoryRegistry, Extensions as EditorInputExtensions, TextCompareEditorActiveContext, ActiveEditorPinnedContext, EditorGroupEditorsCountContext, ActiveEditorStickyContext, ActiveEditorAvailableEditorIdsContext, MultipleEditorGroupsContext, ActiveEditorDirtyContext } from 'vs/workbench/common/editor';
@@ -15,6 +15,7 @@ import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/u
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { TextDiffEditor } from 'vs/workbench/browser/parts/editor/textDiffEditor';
import { UntitledHintContribution } from 'vs/workbench/browser/parts/editor/untitledHint';
import { BinaryResourceDiffEditor } from 'vs/workbench/browser/parts/editor/binaryDiffEditor';
import { ChangeEncodingAction, ChangeEOLAction, ChangeModeAction, EditorStatus } from 'vs/workbench/browser/parts/editor/editorStatus';
import { IWorkbenchActionRegistry, Extensions as ActionExtensions, CATEGORIES } from 'vs/workbench/common/actions';
@@ -35,7 +36,12 @@ import {
NewEditorGroupAboveAction, NewEditorGroupBelowAction, SplitEditorOrthogonalAction, CloseEditorInAllGroupsAction, NavigateToLastEditLocationAction, ToggleGroupSizesAction, ShowAllEditorsByMostRecentlyUsedAction,
QuickAccessPreviousRecentlyUsedEditorAction, OpenPreviousRecentlyUsedEditorInGroupAction, OpenNextRecentlyUsedEditorInGroupAction, QuickAccessLeastRecentlyUsedEditorAction, QuickAccessLeastRecentlyUsedEditorInGroupAction, ReopenResourcesAction, ToggleEditorTypeAction, DuplicateGroupDownAction, DuplicateGroupLeftAction, DuplicateGroupRightAction, DuplicateGroupUpAction
} from 'vs/workbench/browser/parts/editor/editorActions';
import * as editorCommands from 'vs/workbench/browser/parts/editor/editorCommands';
import {
CLOSE_EDITORS_AND_GROUP_COMMAND_ID, CLOSE_EDITORS_IN_GROUP_COMMAND_ID, CLOSE_EDITORS_TO_THE_RIGHT_COMMAND_ID, CLOSE_EDITOR_COMMAND_ID, CLOSE_EDITOR_GROUP_COMMAND_ID,
CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID, CLOSE_PINNED_EDITOR_COMMAND_ID, CLOSE_SAVED_EDITORS_COMMAND_ID, GOTO_NEXT_CHANGE, GOTO_PREVIOUS_CHANGE, KEEP_EDITOR_COMMAND_ID,
PIN_EDITOR_COMMAND_ID, SHOW_EDITORS_IN_GROUP, SPLIT_EDITOR_DOWN, SPLIT_EDITOR_LEFT, SPLIT_EDITOR_RIGHT, SPLIT_EDITOR_UP, TOGGLE_DIFF_IGNORE_TRIM_WHITESPACE,
TOGGLE_DIFF_SIDE_BY_SIDE, TOGGLE_KEEP_EDITORS_COMMAND_ID, UNPIN_EDITOR_COMMAND_ID, setup
} from 'vs/workbench/browser/parts/editor/editorCommands';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { inQuickPickContext, getQuickNavigateHandler } from 'vs/workbench/browser/quickaccess';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
@@ -63,7 +69,7 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
EditorDescriptor.create(
TextResourceEditor,
TextResourceEditor.ID,
nls.localize('textEditor', "Text Editor"),
localize('textEditor', "Text Editor"),
),
[
new SyncDescriptor(UntitledTextEditorInput),
@@ -76,7 +82,7 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
EditorDescriptor.create(
TextDiffEditor,
TextDiffEditor.ID,
nls.localize('textDiffEditor', "Text Diff Editor")
localize('textDiffEditor', "Text Diff Editor")
),
[
new SyncDescriptor(DiffEditorInput)
@@ -88,7 +94,7 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
EditorDescriptor.create(
BinaryResourceDiffEditor,
BinaryResourceDiffEditor.ID,
nls.localize('binaryDiffEditor', "Binary Diff Editor")
localize('binaryDiffEditor', "Binary Diff Editor")
),
[
new SyncDescriptor(DiffEditorInput)
@@ -99,7 +105,7 @@ Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
EditorDescriptor.create(
SideBySideEditor,
SideBySideEditor.ID,
nls.localize('sideBySideEditor', "Side by Side Editor")
localize('sideBySideEditor', "Side by Side Editor")
),
[
new SyncDescriptor(SideBySideEditorInput)
@@ -276,6 +282,9 @@ Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).regi
// Register Editor Auto Save
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(EditorAutoSave, LifecyclePhase.Ready);
// Register Untitled Hint
registerEditorContribution(UntitledHintContribution.ID, UntitledHintContribution);
// Register Status Actions
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ChangeModeAction, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_M) }), 'Change Language Mode');
@@ -291,24 +300,24 @@ quickAccessRegistry.registerQuickAccessProvider({
ctor: ActiveGroupEditorsByMostRecentlyUsedQuickAccess,
prefix: ActiveGroupEditorsByMostRecentlyUsedQuickAccess.PREFIX,
contextKey: editorPickerContextKey,
placeholder: nls.localize('editorQuickAccessPlaceholder', "Type the name of an editor to open it."),
helpEntries: [{ description: nls.localize('activeGroupEditorsByMostRecentlyUsedQuickAccess', "Show Editors in Active Group by Most Recently Used"), needsEditor: false }]
placeholder: localize('editorQuickAccessPlaceholder', "Type the name of an editor to open it."),
helpEntries: [{ description: localize('activeGroupEditorsByMostRecentlyUsedQuickAccess', "Show Editors in Active Group by Most Recently Used"), needsEditor: false }]
});
quickAccessRegistry.registerQuickAccessProvider({
ctor: AllEditorsByAppearanceQuickAccess,
prefix: AllEditorsByAppearanceQuickAccess.PREFIX,
contextKey: editorPickerContextKey,
placeholder: nls.localize('editorQuickAccessPlaceholder', "Type the name of an editor to open it."),
helpEntries: [{ description: nls.localize('allEditorsByAppearanceQuickAccess', "Show All Opened Editors By Appearance"), needsEditor: false }]
placeholder: localize('editorQuickAccessPlaceholder', "Type the name of an editor to open it."),
helpEntries: [{ description: localize('allEditorsByAppearanceQuickAccess', "Show All Opened Editors By Appearance"), needsEditor: false }]
});
quickAccessRegistry.registerQuickAccessProvider({
ctor: AllEditorsByMostRecentlyUsedQuickAccess,
prefix: AllEditorsByMostRecentlyUsedQuickAccess.PREFIX,
contextKey: editorPickerContextKey,
placeholder: nls.localize('editorQuickAccessPlaceholder', "Type the name of an editor to open it."),
helpEntries: [{ description: nls.localize('allEditorsByMostRecentlyUsedQuickAccess', "Show All Opened Editors By Most Recently Used"), needsEditor: false }]
placeholder: localize('editorQuickAccessPlaceholder', "Type the name of an editor to open it."),
helpEntries: [{ description: localize('allEditorsByMostRecentlyUsedQuickAccess', "Show All Opened Editors By Most Recently Used"), needsEditor: false }]
});
// Register Editor Actions
@@ -326,7 +335,7 @@ registry.registerWorkbenchAction(SyncActionDescriptor.from(ReopenClosedEditorAct
registry.registerWorkbenchAction(SyncActionDescriptor.from(ShowAllEditorsByAppearanceAction, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_P), mac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.Tab } }), 'View: Show All Editors By Appearance', CATEGORIES.View.value);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ShowAllEditorsByMostRecentlyUsedAction), 'View: Show All Editors By Most Recently Used', CATEGORIES.View.value);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ShowEditorsInActiveGroupByMostRecentlyUsedAction), 'View: Show Editors in Active Group By Most Recently Used', CATEGORIES.View.value);
registry.registerWorkbenchAction(SyncActionDescriptor.from(ClearRecentFilesAction), 'File: Clear Recently Opened', nls.localize('file', "File"));
registry.registerWorkbenchAction(SyncActionDescriptor.from(ClearRecentFilesAction), 'File: Clear Recently Opened', localize('file', "File"));
registry.registerWorkbenchAction(SyncActionDescriptor.from(CloseAllEditorsAction, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_W) }), 'View: Close All Editors', CATEGORIES.View.value);
registry.registerWorkbenchAction(SyncActionDescriptor.from(CloseAllEditorGroupsAction, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_W) }), 'View: Close All Editor Groups', CATEGORIES.View.value);
registry.registerWorkbenchAction(SyncActionDescriptor.from(CloseLeftEditorsInGroupAction), 'View: Close Editors to the Left in Group', CATEGORIES.View.value);
@@ -424,7 +433,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
// Editor Commands
editorCommands.setup();
setup();
// Touch Bar
if (isMacintosh) {
@@ -442,33 +451,34 @@ if (isMacintosh) {
}
// Empty Editor Group Context Menu
MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: editorCommands.SPLIT_EDITOR_UP, title: nls.localize('splitUp', "Split Up") }, group: '2_split', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: editorCommands.SPLIT_EDITOR_DOWN, title: nls.localize('splitDown', "Split Down") }, group: '2_split', order: 20 });
MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: editorCommands.SPLIT_EDITOR_LEFT, title: nls.localize('splitLeft', "Split Left") }, group: '2_split', order: 30 });
MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: editorCommands.SPLIT_EDITOR_RIGHT, title: nls.localize('splitRight', "Split Right") }, group: '2_split', order: 40 });
MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: editorCommands.CLOSE_EDITOR_GROUP_COMMAND_ID, title: nls.localize('close', "Close") }, group: '3_close', order: 10, when: ContextKeyExpr.has('multipleEditorGroups') });
MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: SPLIT_EDITOR_UP, title: localize('splitUp', "Split Up") }, group: '2_split', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: SPLIT_EDITOR_DOWN, title: localize('splitDown', "Split Down") }, group: '2_split', order: 20 });
MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: SPLIT_EDITOR_LEFT, title: localize('splitLeft', "Split Left") }, group: '2_split', order: 30 });
MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: SPLIT_EDITOR_RIGHT, title: localize('splitRight', "Split Right") }, group: '2_split', order: 40 });
MenuRegistry.appendMenuItem(MenuId.EmptyEditorGroupContext, { command: { id: CLOSE_EDITOR_GROUP_COMMAND_ID, title: localize('close', "Close") }, group: '3_close', order: 10, when: ContextKeyExpr.has('multipleEditorGroups') });
// Editor Title Context Menu
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.CLOSE_EDITOR_COMMAND_ID, title: nls.localize('close', "Close") }, group: '1_close', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID, title: nls.localize('closeOthers', "Close Others"), precondition: EditorGroupEditorsCountContext.notEqualsTo('1') }, group: '1_close', order: 20 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.CLOSE_EDITORS_TO_THE_RIGHT_COMMAND_ID, title: nls.localize('closeRight', "Close to the Right"), precondition: EditorGroupEditorsCountContext.notEqualsTo('1') }, group: '1_close', order: 30, when: ContextKeyExpr.has('config.workbench.editor.showTabs') });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.CLOSE_SAVED_EDITORS_COMMAND_ID, title: nls.localize('closeAllSaved', "Close Saved") }, group: '1_close', order: 40 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: nls.localize('closeAll', "Close All") }, group: '1_close', order: 50 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: CLOSE_EDITOR_COMMAND_ID, title: localize('close', "Close") }, group: '1_close', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID, title: localize('closeOthers', "Close Others"), precondition: EditorGroupEditorsCountContext.notEqualsTo('1') }, group: '1_close', order: 20 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: CLOSE_EDITORS_TO_THE_RIGHT_COMMAND_ID, title: localize('closeRight', "Close to the Right"), precondition: EditorGroupEditorsCountContext.notEqualsTo('1') }, group: '1_close', order: 30, when: ContextKeyExpr.has('config.workbench.editor.showTabs') });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: CLOSE_SAVED_EDITORS_COMMAND_ID, title: localize('closeAllSaved', "Close Saved") }, group: '1_close', order: 40 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: localize('closeAll', "Close All") }, group: '1_close', order: 50 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: ReopenResourcesAction.ID, title: ReopenResourcesAction.LABEL }, group: '1_open', order: 10, when: ActiveEditorAvailableEditorIdsContext });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.KEEP_EDITOR_COMMAND_ID, title: nls.localize('keepOpen', "Keep Open"), precondition: ActiveEditorPinnedContext.toNegated() }, group: '3_preview', order: 10, when: ContextKeyExpr.has('config.workbench.editor.enablePreview') });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.PIN_EDITOR_COMMAND_ID, title: nls.localize('pin', "Pin") }, group: '3_preview', order: 20, when: ActiveEditorStickyContext.toNegated() });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.UNPIN_EDITOR_COMMAND_ID, title: nls.localize('unpin', "Unpin") }, group: '3_preview', order: 20, when: ActiveEditorStickyContext });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_UP, title: nls.localize('splitUp', "Split Up") }, group: '5_split', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_DOWN, title: nls.localize('splitDown', "Split Down") }, group: '5_split', order: 20 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_LEFT, title: nls.localize('splitLeft', "Split Left") }, group: '5_split', order: 30 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: editorCommands.SPLIT_EDITOR_RIGHT, title: nls.localize('splitRight', "Split Right") }, group: '5_split', order: 40 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: KEEP_EDITOR_COMMAND_ID, title: localize('keepOpen', "Keep Open"), precondition: ActiveEditorPinnedContext.toNegated() }, group: '3_preview', order: 10, when: ContextKeyExpr.has('config.workbench.editor.enablePreview') });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: PIN_EDITOR_COMMAND_ID, title: localize('pin', "Pin") }, group: '3_preview', order: 20, when: ActiveEditorStickyContext.toNegated() });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: UNPIN_EDITOR_COMMAND_ID, title: localize('unpin', "Unpin") }, group: '3_preview', order: 20, when: ActiveEditorStickyContext });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: SPLIT_EDITOR_UP, title: localize('splitUp', "Split Up") }, group: '5_split', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: SPLIT_EDITOR_DOWN, title: localize('splitDown', "Split Down") }, group: '5_split', order: 20 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: SPLIT_EDITOR_LEFT, title: localize('splitLeft', "Split Left") }, group: '5_split', order: 30 });
MenuRegistry.appendMenuItem(MenuId.EditorTitleContext, { command: { id: SPLIT_EDITOR_RIGHT, title: localize('splitRight', "Split Right") }, group: '5_split', order: 40 });
// Editor Title Menu
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.TOGGLE_DIFF_SIDE_BY_SIDE, title: nls.localize('toggleInlineView', "Toggle Inline View") }, group: '1_diff', order: 10, when: ContextKeyExpr.has('isInDiffEditor') });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.SHOW_EDITORS_IN_GROUP, title: nls.localize('showOpenedEditors', "Show Opened Editors") }, group: '3_open', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: nls.localize('closeAll', "Close All") }, group: '5_close', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.CLOSE_SAVED_EDITORS_COMMAND_ID, title: nls.localize('closeAllSaved', "Close Saved") }, group: '5_close', order: 20 });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: editorCommands.TOGGLE_KEEP_EDITORS_COMMAND_ID, title: nls.localize('toggleKeepEditors', "Keep Editors Open"), toggled: ContextKeyExpr.not('config.workbench.editor.enablePreview') }, group: '7_settings', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: TOGGLE_DIFF_SIDE_BY_SIDE, title: localize('inlineView', "Inline View"), toggled: ContextKeyExpr.equals('config.diffEditor.renderSideBySide', false) }, group: '1_diff', order: 10, when: ContextKeyExpr.has('isInDiffEditor') });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: SHOW_EDITORS_IN_GROUP, title: localize('showOpenedEditors', "Show Opened Editors") }, group: '3_open', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: localize('closeAll', "Close All") }, group: '5_close', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: CLOSE_SAVED_EDITORS_COMMAND_ID, title: localize('closeAllSaved', "Close Saved") }, group: '5_close', order: 20 });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { command: { id: TOGGLE_KEEP_EDITORS_COMMAND_ID, title: localize('toggleKeepEditors', "Keep Editors Open"), toggled: ContextKeyExpr.not('config.workbench.editor.enablePreview') }, group: '7_settings', order: 10 });
MenuRegistry.appendMenuItem(MenuId.EditorTitle, { submenu: MenuId.EditorTitleRun, title: { value: localize('run', "Run"), original: 'Run', }, icon: Codicon.run, group: 'navigation', order: -1 });
interface IEditorToolItem { id: string; title: string; icon?: { dark?: URI; light?: URI; } | ThemeIcon; }
@@ -500,14 +510,14 @@ function appendEditorToolItem(primary: IEditorToolItem, when: ContextKeyExpressi
appendEditorToolItem(
{
id: SplitEditorAction.ID,
title: nls.localize('splitEditorRight', "Split Editor Right"),
title: localize('splitEditorRight', "Split Editor Right"),
icon: Codicon.splitHorizontal
},
ContextKeyExpr.not('splitEditorsVertically'),
100000, // towards the end
{
id: editorCommands.SPLIT_EDITOR_DOWN,
title: nls.localize('splitEditorDown', "Split Editor Down"),
id: SPLIT_EDITOR_DOWN,
title: localize('splitEditorDown', "Split Editor Down"),
icon: Codicon.splitVertical
}
);
@@ -515,14 +525,14 @@ appendEditorToolItem(
appendEditorToolItem(
{
id: SplitEditorAction.ID,
title: nls.localize('splitEditorDown', "Split Editor Down"),
title: localize('splitEditorDown', "Split Editor Down"),
icon: Codicon.splitVertical
},
ContextKeyExpr.has('splitEditorsVertically'),
100000, // towards the end
{
id: editorCommands.SPLIT_EDITOR_RIGHT,
title: nls.localize('splitEditorRight', "Split Editor Right"),
id: SPLIT_EDITOR_RIGHT,
title: localize('splitEditorRight', "Split Editor Right"),
icon: Codicon.splitHorizontal
}
);
@@ -530,15 +540,15 @@ appendEditorToolItem(
// Editor Title Menu: Close (tabs disabled, normal editor)
appendEditorToolItem(
{
id: editorCommands.CLOSE_EDITOR_COMMAND_ID,
title: nls.localize('close', "Close"),
id: CLOSE_EDITOR_COMMAND_ID,
title: localize('close', "Close"),
icon: Codicon.close
},
ContextKeyExpr.and(ContextKeyExpr.not('config.workbench.editor.showTabs'), ActiveEditorDirtyContext.toNegated(), ActiveEditorStickyContext.toNegated()),
1000000, // towards the far end
{
id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID,
title: nls.localize('closeAll', "Close All"),
id: CLOSE_EDITORS_IN_GROUP_COMMAND_ID,
title: localize('closeAll', "Close All"),
icon: Codicon.closeAll
}
);
@@ -546,15 +556,15 @@ appendEditorToolItem(
// Editor Title Menu: Close (tabs disabled, dirty editor)
appendEditorToolItem(
{
id: editorCommands.CLOSE_EDITOR_COMMAND_ID,
title: nls.localize('close', "Close"),
id: CLOSE_EDITOR_COMMAND_ID,
title: localize('close', "Close"),
icon: Codicon.closeDirty
},
ContextKeyExpr.and(ContextKeyExpr.not('config.workbench.editor.showTabs'), ActiveEditorDirtyContext, ActiveEditorStickyContext.toNegated()),
1000000, // towards the far end
{
id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID,
title: nls.localize('closeAll', "Close All"),
id: CLOSE_EDITORS_IN_GROUP_COMMAND_ID,
title: localize('closeAll', "Close All"),
icon: Codicon.closeAll
}
);
@@ -562,15 +572,15 @@ appendEditorToolItem(
// Editor Title Menu: Close (tabs disabled, sticky editor)
appendEditorToolItem(
{
id: editorCommands.UNPIN_EDITOR_COMMAND_ID,
title: nls.localize('unpin', "Unpin"),
id: UNPIN_EDITOR_COMMAND_ID,
title: localize('unpin', "Unpin"),
icon: Codicon.pinned
},
ContextKeyExpr.and(ContextKeyExpr.not('config.workbench.editor.showTabs'), ActiveEditorDirtyContext.toNegated(), ActiveEditorStickyContext),
1000000, // towards the far end
{
id: editorCommands.CLOSE_EDITOR_COMMAND_ID,
title: nls.localize('close', "Close"),
id: CLOSE_EDITOR_COMMAND_ID,
title: localize('close', "Close"),
icon: Codicon.close
}
);
@@ -578,29 +588,29 @@ appendEditorToolItem(
// Editor Title Menu: Close (tabs disabled, dirty & sticky editor)
appendEditorToolItem(
{
id: editorCommands.UNPIN_EDITOR_COMMAND_ID,
title: nls.localize('unpin', "Unpin"),
id: UNPIN_EDITOR_COMMAND_ID,
title: localize('unpin', "Unpin"),
icon: Codicon.pinnedDirty
},
ContextKeyExpr.and(ContextKeyExpr.not('config.workbench.editor.showTabs'), ActiveEditorDirtyContext, ActiveEditorStickyContext),
1000000, // towards the far end
{
id: editorCommands.CLOSE_EDITOR_COMMAND_ID,
title: nls.localize('close', "Close"),
id: CLOSE_EDITOR_COMMAND_ID,
title: localize('close', "Close"),
icon: Codicon.close
}
);
const previousChangeIcon = registerIcon('diff-editor-previous-change', Codicon.arrowUp, nls.localize('previousChangeIcon', 'Icon for the previous change action in the diff editor.'));
const nextChangeIcon = registerIcon('diff-editor-next-change', Codicon.arrowDown, nls.localize('nextChangeIcon', 'Icon for the next change action in the diff editor.'));
const toggleWhitespace = registerIcon('diff-editor-toggle-whitespace', Codicon.whitespace, nls.localize('toggleWhitespace', 'Icon for the toggle whitespace action in the diff editor.'));
const previousChangeIcon = registerIcon('diff-editor-previous-change', Codicon.arrowUp, localize('previousChangeIcon', 'Icon for the previous change action in the diff editor.'));
const nextChangeIcon = registerIcon('diff-editor-next-change', Codicon.arrowDown, localize('nextChangeIcon', 'Icon for the next change action in the diff editor.'));
const toggleWhitespace = registerIcon('diff-editor-toggle-whitespace', Codicon.whitespace, localize('toggleWhitespace', 'Icon for the toggle whitespace action in the diff editor.'));
// Diff Editor Title Menu: Previous Change
appendEditorToolItem(
{
id: editorCommands.GOTO_PREVIOUS_CHANGE,
title: nls.localize('navigate.prev.label', "Previous Change"),
id: GOTO_PREVIOUS_CHANGE,
title: localize('navigate.prev.label', "Previous Change"),
icon: previousChangeIcon
},
TextCompareEditorActiveContext,
@@ -610,8 +620,8 @@ appendEditorToolItem(
// Diff Editor Title Menu: Next Change
appendEditorToolItem(
{
id: editorCommands.GOTO_NEXT_CHANGE,
title: nls.localize('navigate.next.label', "Next Change"),
id: GOTO_NEXT_CHANGE,
title: localize('navigate.next.label', "Next Change"),
icon: nextChangeIcon
},
TextCompareEditorActiveContext,
@@ -621,8 +631,8 @@ appendEditorToolItem(
// Diff Editor Title Menu: Toggle Ignore Trim Whitespace (Enabled)
appendEditorToolItem(
{
id: editorCommands.TOGGLE_DIFF_IGNORE_TRIM_WHITESPACE,
title: nls.localize('ignoreTrimWhitespace.label', "Ignore Leading/Trailing Whitespace Differences"),
id: TOGGLE_DIFF_IGNORE_TRIM_WHITESPACE,
title: localize('ignoreTrimWhitespace.label', "Ignore Leading/Trailing Whitespace Differences"),
icon: toggleWhitespace
},
ContextKeyExpr.and(TextCompareEditorActiveContext, ContextKeyExpr.notEquals('config.diffEditor.ignoreTrimWhitespace', true)),
@@ -632,8 +642,8 @@ appendEditorToolItem(
// Diff Editor Title Menu: Toggle Ignore Trim Whitespace (Disabled)
appendEditorToolItem(
{
id: editorCommands.TOGGLE_DIFF_IGNORE_TRIM_WHITESPACE,
title: nls.localize('showTrimWhitespace.label', "Show Leading/Trailing Whitespace Differences"),
id: TOGGLE_DIFF_IGNORE_TRIM_WHITESPACE,
title: localize('showTrimWhitespace.label', "Show Leading/Trailing Whitespace Differences"),
icon: ThemeIcon.modify(toggleWhitespace, 'disabled')
},
ContextKeyExpr.and(TextCompareEditorActiveContext, ContextKeyExpr.notEquals('config.diffEditor.ignoreTrimWhitespace', false)),
@@ -641,23 +651,23 @@ appendEditorToolItem(
);
// Editor Commands for Command Palette
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.KEEP_EDITOR_COMMAND_ID, title: { value: nls.localize('keepEditor', "Keep Editor"), original: 'Keep Editor' }, category: CATEGORIES.View }, when: ContextKeyExpr.has('config.workbench.editor.enablePreview') });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.PIN_EDITOR_COMMAND_ID, title: { value: nls.localize('pinEditor', "Pin Editor"), original: 'Pin Editor' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.UNPIN_EDITOR_COMMAND_ID, title: { value: nls.localize('unpinEditor', "Unpin Editor"), original: 'Unpin Editor' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_EDITOR_COMMAND_ID, title: { value: nls.localize('closeEditor', "Close Editor"), original: 'Close Editor' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_PINNED_EDITOR_COMMAND_ID, title: { value: nls.localize('closePinnedEditor', "Close Pinned Editor"), original: 'Close Pinned Editor' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: { value: nls.localize('closeEditorsInGroup', "Close All Editors in Group"), original: 'Close All Editors in Group' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_SAVED_EDITORS_COMMAND_ID, title: { value: nls.localize('closeSavedEditors', "Close Saved Editors in Group"), original: 'Close Saved Editors in Group' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID, title: { value: nls.localize('closeOtherEditors', "Close Other Editors in Group"), original: 'Close Other Editors in Group' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_EDITORS_TO_THE_RIGHT_COMMAND_ID, title: { value: nls.localize('closeRightEditors', "Close Editors to the Right in Group"), original: 'Close Editors to the Right in Group' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: editorCommands.CLOSE_EDITORS_AND_GROUP_COMMAND_ID, title: { value: nls.localize('closeEditorGroup', "Close Editor Group"), original: 'Close Editor Group' }, category: CATEGORIES.View }, when: MultipleEditorGroupsContext });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: KEEP_EDITOR_COMMAND_ID, title: { value: localize('keepEditor', "Keep Editor"), original: 'Keep Editor' }, category: CATEGORIES.View }, when: ContextKeyExpr.has('config.workbench.editor.enablePreview') });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: PIN_EDITOR_COMMAND_ID, title: { value: localize('pinEditor', "Pin Editor"), original: 'Pin Editor' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: UNPIN_EDITOR_COMMAND_ID, title: { value: localize('unpinEditor', "Unpin Editor"), original: 'Unpin Editor' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: CLOSE_EDITOR_COMMAND_ID, title: { value: localize('closeEditor', "Close Editor"), original: 'Close Editor' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: CLOSE_PINNED_EDITOR_COMMAND_ID, title: { value: localize('closePinnedEditor', "Close Pinned Editor"), original: 'Close Pinned Editor' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: CLOSE_EDITORS_IN_GROUP_COMMAND_ID, title: { value: localize('closeEditorsInGroup', "Close All Editors in Group"), original: 'Close All Editors in Group' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: CLOSE_SAVED_EDITORS_COMMAND_ID, title: { value: localize('closeSavedEditors', "Close Saved Editors in Group"), original: 'Close Saved Editors in Group' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: CLOSE_OTHER_EDITORS_IN_GROUP_COMMAND_ID, title: { value: localize('closeOtherEditors', "Close Other Editors in Group"), original: 'Close Other Editors in Group' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: CLOSE_EDITORS_TO_THE_RIGHT_COMMAND_ID, title: { value: localize('closeRightEditors', "Close Editors to the Right in Group"), original: 'Close Editors to the Right in Group' }, category: CATEGORIES.View } });
MenuRegistry.appendMenuItem(MenuId.CommandPalette, { command: { id: CLOSE_EDITORS_AND_GROUP_COMMAND_ID, title: { value: localize('closeEditorGroup', "Close Editor Group"), original: 'Close Editor Group' }, category: CATEGORIES.View }, when: MultipleEditorGroupsContext });
// File menu
MenuRegistry.appendMenuItem(MenuId.MenubarRecentMenu, {
group: '1_editor',
command: {
id: ReopenClosedEditorAction.ID,
title: nls.localize({ key: 'miReopenClosedEditor', comment: ['&& denotes a mnemonic'] }, "&&Reopen Closed Editor"),
title: localize({ key: 'miReopenClosedEditor', comment: ['&& denotes a mnemonic'] }, "&&Reopen Closed Editor"),
precondition: ContextKeyExpr.has('canReopenClosedEditor')
},
order: 1
@@ -667,7 +677,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarRecentMenu, {
group: 'z_clear',
command: {
id: ClearRecentFilesAction.ID,
title: nls.localize({ key: 'miClearRecentOpen', comment: ['&& denotes a mnemonic'] }, "&&Clear Recently Opened")
title: localize({ key: 'miClearRecentOpen', comment: ['&& denotes a mnemonic'] }, "&&Clear Recently Opened")
},
order: 1
});
@@ -675,7 +685,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarRecentMenu, {
// Layout menu
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
group: '2_appearance',
title: nls.localize({ key: 'miEditorLayout', comment: ['&& denotes a mnemonic'] }, "Editor &&Layout"),
title: localize({ key: 'miEditorLayout', comment: ['&& denotes a mnemonic'] }, "Editor &&Layout"),
submenu: MenuId.MenubarLayoutMenu,
order: 2
});
@@ -683,8 +693,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '1_split',
command: {
id: editorCommands.SPLIT_EDITOR_UP,
title: nls.localize({ key: 'miSplitEditorUp', comment: ['&& denotes a mnemonic'] }, "Split &&Up")
id: SPLIT_EDITOR_UP,
title: localize({ key: 'miSplitEditorUp', comment: ['&& denotes a mnemonic'] }, "Split &&Up")
},
order: 1
});
@@ -692,8 +702,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '1_split',
command: {
id: editorCommands.SPLIT_EDITOR_DOWN,
title: nls.localize({ key: 'miSplitEditorDown', comment: ['&& denotes a mnemonic'] }, "Split &&Down")
id: SPLIT_EDITOR_DOWN,
title: localize({ key: 'miSplitEditorDown', comment: ['&& denotes a mnemonic'] }, "Split &&Down")
},
order: 2
});
@@ -701,8 +711,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '1_split',
command: {
id: editorCommands.SPLIT_EDITOR_LEFT,
title: nls.localize({ key: 'miSplitEditorLeft', comment: ['&& denotes a mnemonic'] }, "Split &&Left")
id: SPLIT_EDITOR_LEFT,
title: localize({ key: 'miSplitEditorLeft', comment: ['&& denotes a mnemonic'] }, "Split &&Left")
},
order: 3
});
@@ -710,8 +720,8 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '1_split',
command: {
id: editorCommands.SPLIT_EDITOR_RIGHT,
title: nls.localize({ key: 'miSplitEditorRight', comment: ['&& denotes a mnemonic'] }, "Split &&Right")
id: SPLIT_EDITOR_RIGHT,
title: localize({ key: 'miSplitEditorRight', comment: ['&& denotes a mnemonic'] }, "Split &&Right")
},
order: 4
});
@@ -720,7 +730,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '2_layouts',
command: {
id: EditorLayoutSingleAction.ID,
title: nls.localize({ key: 'miSingleColumnEditorLayout', comment: ['&& denotes a mnemonic'] }, "&&Single")
title: localize({ key: 'miSingleColumnEditorLayout', comment: ['&& denotes a mnemonic'] }, "&&Single")
},
order: 1
});
@@ -729,7 +739,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '2_layouts',
command: {
id: EditorLayoutTwoColumnsAction.ID,
title: nls.localize({ key: 'miTwoColumnsEditorLayout', comment: ['&& denotes a mnemonic'] }, "&&Two Columns")
title: localize({ key: 'miTwoColumnsEditorLayout', comment: ['&& denotes a mnemonic'] }, "&&Two Columns")
},
order: 3
});
@@ -738,7 +748,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '2_layouts',
command: {
id: EditorLayoutThreeColumnsAction.ID,
title: nls.localize({ key: 'miThreeColumnsEditorLayout', comment: ['&& denotes a mnemonic'] }, "T&&hree Columns")
title: localize({ key: 'miThreeColumnsEditorLayout', comment: ['&& denotes a mnemonic'] }, "T&&hree Columns")
},
order: 4
});
@@ -747,7 +757,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '2_layouts',
command: {
id: EditorLayoutTwoRowsAction.ID,
title: nls.localize({ key: 'miTwoRowsEditorLayout', comment: ['&& denotes a mnemonic'] }, "T&&wo Rows")
title: localize({ key: 'miTwoRowsEditorLayout', comment: ['&& denotes a mnemonic'] }, "T&&wo Rows")
},
order: 5
});
@@ -756,7 +766,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '2_layouts',
command: {
id: EditorLayoutThreeRowsAction.ID,
title: nls.localize({ key: 'miThreeRowsEditorLayout', comment: ['&& denotes a mnemonic'] }, "Three &&Rows")
title: localize({ key: 'miThreeRowsEditorLayout', comment: ['&& denotes a mnemonic'] }, "Three &&Rows")
},
order: 6
});
@@ -765,7 +775,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '2_layouts',
command: {
id: EditorLayoutTwoByTwoGridAction.ID,
title: nls.localize({ key: 'miTwoByTwoGridEditorLayout', comment: ['&& denotes a mnemonic'] }, "&&Grid (2x2)")
title: localize({ key: 'miTwoByTwoGridEditorLayout', comment: ['&& denotes a mnemonic'] }, "&&Grid (2x2)")
},
order: 7
});
@@ -774,7 +784,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '2_layouts',
command: {
id: EditorLayoutTwoRowsRightAction.ID,
title: nls.localize({ key: 'miTwoRowsRightEditorLayout', comment: ['&& denotes a mnemonic'] }, "Two R&&ows Right")
title: localize({ key: 'miTwoRowsRightEditorLayout', comment: ['&& denotes a mnemonic'] }, "Two R&&ows Right")
},
order: 8
});
@@ -783,7 +793,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarLayoutMenu, {
group: '2_layouts',
command: {
id: EditorLayoutTwoColumnsBottomAction.ID,
title: nls.localize({ key: 'miTwoColumnsBottomEditorLayout', comment: ['&& denotes a mnemonic'] }, "Two &&Columns Bottom")
title: localize({ key: 'miTwoColumnsBottomEditorLayout', comment: ['&& denotes a mnemonic'] }, "Two &&Columns Bottom")
},
order: 9
});
@@ -795,7 +805,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
group: '1_history_nav',
command: {
id: 'workbench.action.navigateBack',
title: nls.localize({ key: 'miBack', comment: ['&& denotes a mnemonic'] }, "&&Back"),
title: localize({ key: 'miBack', comment: ['&& denotes a mnemonic'] }, "&&Back"),
precondition: ContextKeyExpr.has('canNavigateBack')
},
order: 1
@@ -805,7 +815,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
group: '1_history_nav',
command: {
id: 'workbench.action.navigateForward',
title: nls.localize({ key: 'miForward', comment: ['&& denotes a mnemonic'] }, "&&Forward"),
title: localize({ key: 'miForward', comment: ['&& denotes a mnemonic'] }, "&&Forward"),
precondition: ContextKeyExpr.has('canNavigateForward')
},
order: 2
@@ -815,7 +825,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
group: '1_history_nav',
command: {
id: 'workbench.action.navigateToLastEditLocation',
title: nls.localize({ key: 'miLastEditLocation', comment: ['&& denotes a mnemonic'] }, "&&Last Edit Location"),
title: localize({ key: 'miLastEditLocation', comment: ['&& denotes a mnemonic'] }, "&&Last Edit Location"),
precondition: ContextKeyExpr.has('canNavigateToLastEditLocation')
},
order: 3
@@ -826,7 +836,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '1_any',
command: {
id: 'workbench.action.nextEditor',
title: nls.localize({ key: 'miNextEditor', comment: ['&& denotes a mnemonic'] }, "&&Next Editor")
title: localize({ key: 'miNextEditor', comment: ['&& denotes a mnemonic'] }, "&&Next Editor")
},
order: 1
});
@@ -835,7 +845,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '1_any',
command: {
id: 'workbench.action.previousEditor',
title: nls.localize({ key: 'miPreviousEditor', comment: ['&& denotes a mnemonic'] }, "&&Previous Editor")
title: localize({ key: 'miPreviousEditor', comment: ['&& denotes a mnemonic'] }, "&&Previous Editor")
},
order: 2
});
@@ -844,7 +854,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '2_any_used',
command: {
id: 'workbench.action.openNextRecentlyUsedEditor',
title: nls.localize({ key: 'miNextRecentlyUsedEditor', comment: ['&& denotes a mnemonic'] }, "&&Next Used Editor")
title: localize({ key: 'miNextRecentlyUsedEditor', comment: ['&& denotes a mnemonic'] }, "&&Next Used Editor")
},
order: 1
});
@@ -853,7 +863,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '2_any_used',
command: {
id: 'workbench.action.openPreviousRecentlyUsedEditor',
title: nls.localize({ key: 'miPreviousRecentlyUsedEditor', comment: ['&& denotes a mnemonic'] }, "&&Previous Used Editor")
title: localize({ key: 'miPreviousRecentlyUsedEditor', comment: ['&& denotes a mnemonic'] }, "&&Previous Used Editor")
},
order: 2
});
@@ -862,7 +872,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '3_group',
command: {
id: 'workbench.action.nextEditorInGroup',
title: nls.localize({ key: 'miNextEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Editor in Group")
title: localize({ key: 'miNextEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Editor in Group")
},
order: 1
});
@@ -871,7 +881,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '3_group',
command: {
id: 'workbench.action.previousEditorInGroup',
title: nls.localize({ key: 'miPreviousEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Editor in Group")
title: localize({ key: 'miPreviousEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Editor in Group")
},
order: 2
});
@@ -880,7 +890,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '4_group_used',
command: {
id: 'workbench.action.openNextRecentlyUsedEditorInGroup',
title: nls.localize({ key: 'miNextUsedEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Used Editor in Group")
title: localize({ key: 'miNextUsedEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Used Editor in Group")
},
order: 1
});
@@ -889,14 +899,14 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchEditorMenu, {
group: '4_group_used',
command: {
id: 'workbench.action.openPreviousRecentlyUsedEditorInGroup',
title: nls.localize({ key: 'miPreviousUsedEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Used Editor in Group")
title: localize({ key: 'miPreviousUsedEditorInGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Used Editor in Group")
},
order: 2
});
MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
group: '2_editor_nav',
title: nls.localize({ key: 'miSwitchEditor', comment: ['&& denotes a mnemonic'] }, "Switch &&Editor"),
title: localize({ key: 'miSwitchEditor', comment: ['&& denotes a mnemonic'] }, "Switch &&Editor"),
submenu: MenuId.MenubarSwitchEditorMenu,
order: 1
});
@@ -906,7 +916,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '1_focus_index',
command: {
id: 'workbench.action.focusFirstEditorGroup',
title: nls.localize({ key: 'miFocusFirstGroup', comment: ['&& denotes a mnemonic'] }, "Group &&1")
title: localize({ key: 'miFocusFirstGroup', comment: ['&& denotes a mnemonic'] }, "Group &&1")
},
order: 1
});
@@ -915,7 +925,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '1_focus_index',
command: {
id: 'workbench.action.focusSecondEditorGroup',
title: nls.localize({ key: 'miFocusSecondGroup', comment: ['&& denotes a mnemonic'] }, "Group &&2")
title: localize({ key: 'miFocusSecondGroup', comment: ['&& denotes a mnemonic'] }, "Group &&2")
},
order: 2
});
@@ -924,7 +934,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '1_focus_index',
command: {
id: 'workbench.action.focusThirdEditorGroup',
title: nls.localize({ key: 'miFocusThirdGroup', comment: ['&& denotes a mnemonic'] }, "Group &&3"),
title: localize({ key: 'miFocusThirdGroup', comment: ['&& denotes a mnemonic'] }, "Group &&3"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 3
@@ -934,7 +944,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '1_focus_index',
command: {
id: 'workbench.action.focusFourthEditorGroup',
title: nls.localize({ key: 'miFocusFourthGroup', comment: ['&& denotes a mnemonic'] }, "Group &&4"),
title: localize({ key: 'miFocusFourthGroup', comment: ['&& denotes a mnemonic'] }, "Group &&4"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 4
@@ -944,7 +954,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '1_focus_index',
command: {
id: 'workbench.action.focusFifthEditorGroup',
title: nls.localize({ key: 'miFocusFifthGroup', comment: ['&& denotes a mnemonic'] }, "Group &&5"),
title: localize({ key: 'miFocusFifthGroup', comment: ['&& denotes a mnemonic'] }, "Group &&5"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 5
@@ -954,7 +964,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '2_next_prev',
command: {
id: 'workbench.action.focusNextGroup',
title: nls.localize({ key: 'miNextGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Group"),
title: localize({ key: 'miNextGroup', comment: ['&& denotes a mnemonic'] }, "&&Next Group"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 1
@@ -964,7 +974,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '2_next_prev',
command: {
id: 'workbench.action.focusPreviousGroup',
title: nls.localize({ key: 'miPreviousGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Group"),
title: localize({ key: 'miPreviousGroup', comment: ['&& denotes a mnemonic'] }, "&&Previous Group"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 2
@@ -974,7 +984,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '3_directional',
command: {
id: 'workbench.action.focusLeftGroup',
title: nls.localize({ key: 'miFocusLeftGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Left"),
title: localize({ key: 'miFocusLeftGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Left"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 1
@@ -984,7 +994,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '3_directional',
command: {
id: 'workbench.action.focusRightGroup',
title: nls.localize({ key: 'miFocusRightGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Right"),
title: localize({ key: 'miFocusRightGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Right"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 2
@@ -994,7 +1004,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '3_directional',
command: {
id: 'workbench.action.focusAboveGroup',
title: nls.localize({ key: 'miFocusAboveGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Above"),
title: localize({ key: 'miFocusAboveGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Above"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 3
@@ -1004,7 +1014,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
group: '3_directional',
command: {
id: 'workbench.action.focusBelowGroup',
title: nls.localize({ key: 'miFocusBelowGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Below"),
title: localize({ key: 'miFocusBelowGroup', comment: ['&& denotes a mnemonic'] }, "Group &&Below"),
precondition: ContextKeyExpr.has('multipleEditorGroups')
},
order: 4
@@ -1012,7 +1022,7 @@ MenuRegistry.appendMenuItem(MenuId.MenubarSwitchGroupMenu, {
MenuRegistry.appendMenuItem(MenuId.MenubarGoMenu, {
group: '2_editor_nav',
title: nls.localize({ key: 'miSwitchGroup', comment: ['&& denotes a mnemonic'] }, "Switch &&Group"),
title: localize({ key: 'miSwitchGroup', comment: ['&& denotes a mnemonic'] }, "Switch &&Group"),
submenu: MenuId.MenubarSwitchGroupMenu,
order: 2
});

View File

@@ -88,7 +88,7 @@ export interface IEditorGroupsAccessor {
readonly activeGroup: IEditorGroupView;
readonly partOptions: IEditorPartOptions;
readonly onDidEditorPartOptionsChange: Event<IEditorPartOptionsChangeEvent>;
readonly onDidChangeEditorPartOptions: Event<IEditorPartOptionsChangeEvent>;
readonly onDidVisibilityChange: Event<boolean>;
@@ -109,12 +109,12 @@ export interface IEditorGroupsAccessor {
arrangeGroups(arrangement: GroupsArrangement, target?: IEditorGroupView | GroupIdentifier): void;
}
export interface IEditorGroupTitleDimensions {
export interface IEditorGroupTitleHeight {
/**
* The overall height of the editor group title control.
*/
height: number;
total: number;
/**
* The height offset to e.g. use when drawing drop overlays.
@@ -137,7 +137,7 @@ export interface IEditorGroupView extends IDisposable, ISerializableView, IEdito
readonly group: EditorGroup;
readonly whenRestored: Promise<void>;
readonly titleDimensions: IEditorGroupTitleDimensions;
readonly titleHeight: IEditorGroupTitleHeight;
readonly isEmpty: boolean;
readonly isMinimized: boolean;

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { Action } from 'vs/base/common/actions';
import { IEditorInput, IEditorIdentifier, IEditorCommandsContext, CloseDirection, SaveReason, EditorsOrder, SideBySideEditorInput } from 'vs/workbench/common/editor';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
@@ -22,8 +22,7 @@ import { ItemActivation, IQuickInputService } from 'vs/platform/quickinput/commo
import { AllEditorsByMostRecentlyUsedQuickAccess, ActiveGroupEditorsByMostRecentlyUsedQuickAccess, AllEditorsByAppearanceQuickAccess } from 'vs/workbench/browser/parts/editor/editorQuickAccess';
import { Codicon } from 'vs/base/common/codicons';
import { IFilesConfigurationService, AutoSaveMode } from 'vs/workbench/services/filesConfiguration/common/filesConfigurationService';
import { openEditorWith, getAllAvailableEditors } from 'vs/workbench/services/editor/common/editorOpenWith';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { EditorOverride } from 'vs/platform/editor/common/editor';
export class ExecuteCommandAction extends Action {
@@ -79,7 +78,7 @@ export class BaseSplitEditorAction extends Action {
export class SplitEditorAction extends BaseSplitEditorAction {
static readonly ID = 'workbench.action.splitEditor';
static readonly LABEL = nls.localize('splitEditor', "Split Editor");
static readonly LABEL = localize('splitEditor', "Split Editor");
constructor(
id: string,
@@ -94,7 +93,7 @@ export class SplitEditorAction extends BaseSplitEditorAction {
export class SplitEditorOrthogonalAction extends BaseSplitEditorAction {
static readonly ID = 'workbench.action.splitEditorOrthogonal';
static readonly LABEL = nls.localize('splitEditorOrthogonal', "Split Editor Orthogonal");
static readonly LABEL = localize('splitEditorOrthogonal', "Split Editor Orthogonal");
constructor(
id: string,
@@ -115,7 +114,7 @@ export class SplitEditorOrthogonalAction extends BaseSplitEditorAction {
export class SplitEditorLeftAction extends ExecuteCommandAction {
static readonly ID = SPLIT_EDITOR_LEFT;
static readonly LABEL = nls.localize('splitEditorGroupLeft', "Split Editor Left");
static readonly LABEL = localize('splitEditorGroupLeft', "Split Editor Left");
constructor(
id: string,
@@ -129,7 +128,7 @@ export class SplitEditorLeftAction extends ExecuteCommandAction {
export class SplitEditorRightAction extends ExecuteCommandAction {
static readonly ID = SPLIT_EDITOR_RIGHT;
static readonly LABEL = nls.localize('splitEditorGroupRight', "Split Editor Right");
static readonly LABEL = localize('splitEditorGroupRight', "Split Editor Right");
constructor(
id: string,
@@ -143,7 +142,7 @@ export class SplitEditorRightAction extends ExecuteCommandAction {
export class SplitEditorUpAction extends ExecuteCommandAction {
static readonly ID = SPLIT_EDITOR_UP;
static readonly LABEL = nls.localize('splitEditorGroupUp', "Split Editor Up");
static readonly LABEL = localize('splitEditorGroupUp', "Split Editor Up");
constructor(
id: string,
@@ -157,7 +156,7 @@ export class SplitEditorUpAction extends ExecuteCommandAction {
export class SplitEditorDownAction extends ExecuteCommandAction {
static readonly ID = SPLIT_EDITOR_DOWN;
static readonly LABEL = nls.localize('splitEditorGroupDown', "Split Editor Down");
static readonly LABEL = localize('splitEditorGroupDown', "Split Editor Down");
constructor(
id: string,
@@ -171,7 +170,7 @@ export class SplitEditorDownAction extends ExecuteCommandAction {
export class JoinTwoGroupsAction extends Action {
static readonly ID = 'workbench.action.joinTwoGroups';
static readonly LABEL = nls.localize('joinTwoGroups', "Join Editor Group with Next Group");
static readonly LABEL = localize('joinTwoGroups', "Join Editor Group with Next Group");
constructor(
id: string,
@@ -206,7 +205,7 @@ export class JoinTwoGroupsAction extends Action {
export class JoinAllGroupsAction extends Action {
static readonly ID = 'workbench.action.joinAllGroups';
static readonly LABEL = nls.localize('joinAllGroups', "Join All Editor Groups");
static readonly LABEL = localize('joinAllGroups', "Join All Editor Groups");
constructor(
id: string,
@@ -224,7 +223,7 @@ export class JoinAllGroupsAction extends Action {
export class NavigateBetweenGroupsAction extends Action {
static readonly ID = 'workbench.action.navigateEditorGroups';
static readonly LABEL = nls.localize('navigateEditorGroups', "Navigate Between Editor Groups");
static readonly LABEL = localize('navigateEditorGroups', "Navigate Between Editor Groups");
constructor(
id: string,
@@ -243,7 +242,7 @@ export class NavigateBetweenGroupsAction extends Action {
export class FocusActiveGroupAction extends Action {
static readonly ID = 'workbench.action.focusActiveEditorGroup';
static readonly LABEL = nls.localize('focusActiveEditorGroup', "Focus Active Editor Group");
static readonly LABEL = localize('focusActiveEditorGroup', "Focus Active Editor Group");
constructor(
id: string,
@@ -280,7 +279,7 @@ export abstract class BaseFocusGroupAction extends Action {
export class FocusFirstGroupAction extends BaseFocusGroupAction {
static readonly ID = 'workbench.action.focusFirstEditorGroup';
static readonly LABEL = nls.localize('focusFirstEditorGroup', "Focus First Editor Group");
static readonly LABEL = localize('focusFirstEditorGroup', "Focus First Editor Group");
constructor(
id: string,
@@ -294,7 +293,7 @@ export class FocusFirstGroupAction extends BaseFocusGroupAction {
export class FocusLastGroupAction extends BaseFocusGroupAction {
static readonly ID = 'workbench.action.focusLastEditorGroup';
static readonly LABEL = nls.localize('focusLastEditorGroup', "Focus Last Editor Group");
static readonly LABEL = localize('focusLastEditorGroup', "Focus Last Editor Group");
constructor(
id: string,
@@ -308,7 +307,7 @@ export class FocusLastGroupAction extends BaseFocusGroupAction {
export class FocusNextGroup extends BaseFocusGroupAction {
static readonly ID = 'workbench.action.focusNextGroup';
static readonly LABEL = nls.localize('focusNextGroup', "Focus Next Editor Group");
static readonly LABEL = localize('focusNextGroup', "Focus Next Editor Group");
constructor(
id: string,
@@ -322,7 +321,7 @@ export class FocusNextGroup extends BaseFocusGroupAction {
export class FocusPreviousGroup extends BaseFocusGroupAction {
static readonly ID = 'workbench.action.focusPreviousGroup';
static readonly LABEL = nls.localize('focusPreviousGroup', "Focus Previous Editor Group");
static readonly LABEL = localize('focusPreviousGroup', "Focus Previous Editor Group");
constructor(
id: string,
@@ -336,7 +335,7 @@ export class FocusPreviousGroup extends BaseFocusGroupAction {
export class FocusLeftGroup extends BaseFocusGroupAction {
static readonly ID = 'workbench.action.focusLeftGroup';
static readonly LABEL = nls.localize('focusLeftGroup', "Focus Left Editor Group");
static readonly LABEL = localize('focusLeftGroup', "Focus Left Editor Group");
constructor(
id: string,
@@ -350,7 +349,7 @@ export class FocusLeftGroup extends BaseFocusGroupAction {
export class FocusRightGroup extends BaseFocusGroupAction {
static readonly ID = 'workbench.action.focusRightGroup';
static readonly LABEL = nls.localize('focusRightGroup', "Focus Right Editor Group");
static readonly LABEL = localize('focusRightGroup', "Focus Right Editor Group");
constructor(
id: string,
@@ -364,7 +363,7 @@ export class FocusRightGroup extends BaseFocusGroupAction {
export class FocusAboveGroup extends BaseFocusGroupAction {
static readonly ID = 'workbench.action.focusAboveGroup';
static readonly LABEL = nls.localize('focusAboveGroup', "Focus Above Editor Group");
static readonly LABEL = localize('focusAboveGroup', "Focus Above Editor Group");
constructor(
id: string,
@@ -378,7 +377,7 @@ export class FocusAboveGroup extends BaseFocusGroupAction {
export class FocusBelowGroup extends BaseFocusGroupAction {
static readonly ID = 'workbench.action.focusBelowGroup';
static readonly LABEL = nls.localize('focusBelowGroup', "Focus Below Editor Group");
static readonly LABEL = localize('focusBelowGroup', "Focus Below Editor Group");
constructor(
id: string,
@@ -392,7 +391,7 @@ export class FocusBelowGroup extends BaseFocusGroupAction {
export class CloseEditorAction extends Action {
static readonly ID = 'workbench.action.closeActiveEditor';
static readonly LABEL = nls.localize('closeEditor', "Close Editor");
static readonly LABEL = localize('closeEditor', "Close Editor");
constructor(
id: string,
@@ -410,7 +409,7 @@ export class CloseEditorAction extends Action {
export class UnpinEditorAction extends Action {
static readonly ID = 'workbench.action.unpinActiveEditor';
static readonly LABEL = nls.localize('unpinEditor', "Unpin Editor");
static readonly LABEL = localize('unpinEditor', "Unpin Editor");
constructor(
id: string,
@@ -428,7 +427,7 @@ export class UnpinEditorAction extends Action {
export class CloseOneEditorAction extends Action {
static readonly ID = 'workbench.action.closeActiveEditor';
static readonly LABEL = nls.localize('closeOneEditor', "Close");
static readonly LABEL = localize('closeOneEditor', "Close");
constructor(
id: string,
@@ -471,7 +470,7 @@ export class CloseOneEditorAction extends Action {
export class RevertAndCloseEditorAction extends Action {
static readonly ID = 'workbench.action.revertAndCloseActiveEditor';
static readonly LABEL = nls.localize('revertAndCloseActiveEditor', "Revert and Close Editor");
static readonly LABEL = localize('revertAndCloseActiveEditor', "Revert and Close Editor");
constructor(
id: string,
@@ -498,7 +497,7 @@ export class RevertAndCloseEditorAction extends Action {
await this.editorService.revert({ editor, groupId: group.id }, { soft: true });
}
group.closeEditor(editor);
return group.closeEditor(editor);
}
}
}
@@ -506,7 +505,7 @@ export class RevertAndCloseEditorAction extends Action {
export class CloseLeftEditorsInGroupAction extends Action {
static readonly ID = 'workbench.action.closeEditorsToTheLeft';
static readonly LABEL = nls.localize('closeEditorsToTheLeft', "Close Editors to the Left in Group");
static readonly LABEL = localize('closeEditorsToTheLeft', "Close Editors to the Left in Group");
constructor(
id: string,
@@ -572,7 +571,7 @@ abstract class BaseCloseAllAction extends Action {
// Otherwise ask for combined confirmation and make sure
// to bring each dirty editor to the front so that the user
// can review if the files should be changed or not.
await Promise.all(this.groupsToClose.map(async groupToClose => {
await Promise.all(this.groupsToClose.map(groupToClose => {
for (const editor of groupToClose.getEditors(EditorsOrder.MOST_RECENTLY_ACTIVE, { excludeSticky: this.excludeSticky })) {
if (editor.isDirty() && !editor.isSaving() /* ignore editors that are being saved */) {
return groupToClose.openEditor(editor);
@@ -649,7 +648,7 @@ abstract class BaseCloseAllAction extends Action {
export class CloseAllEditorsAction extends BaseCloseAllAction {
static readonly ID = 'workbench.action.closeAllEditors';
static readonly LABEL = nls.localize('closeAllEditors', "Close All Editors");
static readonly LABEL = localize('closeAllEditors', "Close All Editors");
constructor(
id: string,
@@ -675,7 +674,7 @@ export class CloseAllEditorsAction extends BaseCloseAllAction {
export class CloseAllEditorGroupsAction extends BaseCloseAllAction {
static readonly ID = 'workbench.action.closeAllGroups';
static readonly LABEL = nls.localize('closeAllGroups', "Close All Editor Groups");
static readonly LABEL = localize('closeAllGroups', "Close All Editor Groups");
constructor(
id: string,
@@ -696,14 +695,16 @@ export class CloseAllEditorGroupsAction extends BaseCloseAllAction {
protected async doCloseAll(): Promise<void> {
await Promise.all(this.groupsToClose.map(group => group.closeAllEditors()));
this.groupsToClose.forEach(group => this.editorGroupService.removeGroup(group));
for (const groupToClose of this.groupsToClose) {
this.editorGroupService.removeGroup(groupToClose);
}
}
}
export class CloseEditorsInOtherGroupsAction extends Action {
static readonly ID = 'workbench.action.closeEditorsInOtherGroups';
static readonly LABEL = nls.localize('closeEditorsInOtherGroups', "Close Editors in Other Groups");
static readonly LABEL = localize('closeEditorsInOtherGroups', "Close Editors in Other Groups");
constructor(
id: string,
@@ -728,7 +729,7 @@ export class CloseEditorsInOtherGroupsAction extends Action {
export class CloseEditorInAllGroupsAction extends Action {
static readonly ID = 'workbench.action.closeEditorInAllGroups';
static readonly LABEL = nls.localize('closeEditorInAllGroups', "Close Editor in All Groups");
static readonly LABEL = localize('closeEditorInAllGroups', "Close Editor in All Groups");
constructor(
id: string,
@@ -827,7 +828,7 @@ class BaseMoveGroupAction extends BaseMoveCopyGroupAction {
export class MoveGroupLeftAction extends BaseMoveGroupAction {
static readonly ID = 'workbench.action.moveActiveEditorGroupLeft';
static readonly LABEL = nls.localize('moveActiveGroupLeft', "Move Editor Group Left");
static readonly LABEL = localize('moveActiveGroupLeft', "Move Editor Group Left");
constructor(
id: string,
@@ -841,7 +842,7 @@ export class MoveGroupLeftAction extends BaseMoveGroupAction {
export class MoveGroupRightAction extends BaseMoveGroupAction {
static readonly ID = 'workbench.action.moveActiveEditorGroupRight';
static readonly LABEL = nls.localize('moveActiveGroupRight', "Move Editor Group Right");
static readonly LABEL = localize('moveActiveGroupRight', "Move Editor Group Right");
constructor(
id: string,
@@ -855,7 +856,7 @@ export class MoveGroupRightAction extends BaseMoveGroupAction {
export class MoveGroupUpAction extends BaseMoveGroupAction {
static readonly ID = 'workbench.action.moveActiveEditorGroupUp';
static readonly LABEL = nls.localize('moveActiveGroupUp', "Move Editor Group Up");
static readonly LABEL = localize('moveActiveGroupUp', "Move Editor Group Up");
constructor(
id: string,
@@ -869,7 +870,7 @@ export class MoveGroupUpAction extends BaseMoveGroupAction {
export class MoveGroupDownAction extends BaseMoveGroupAction {
static readonly ID = 'workbench.action.moveActiveEditorGroupDown';
static readonly LABEL = nls.localize('moveActiveGroupDown', "Move Editor Group Down");
static readonly LABEL = localize('moveActiveGroupDown', "Move Editor Group Down");
constructor(
id: string,
@@ -895,7 +896,7 @@ class BaseDuplicateGroupAction extends BaseMoveCopyGroupAction {
export class DuplicateGroupLeftAction extends BaseDuplicateGroupAction {
static readonly ID = 'workbench.action.duplicateActiveEditorGroupLeft';
static readonly LABEL = nls.localize('duplicateActiveGroupLeft', "Duplicate Editor Group Left");
static readonly LABEL = localize('duplicateActiveGroupLeft', "Duplicate Editor Group Left");
constructor(
id: string,
@@ -909,7 +910,7 @@ export class DuplicateGroupLeftAction extends BaseDuplicateGroupAction {
export class DuplicateGroupRightAction extends BaseDuplicateGroupAction {
static readonly ID = 'workbench.action.duplicateActiveEditorGroupRight';
static readonly LABEL = nls.localize('duplicateActiveGroupRight', "Duplicate Editor Group Right");
static readonly LABEL = localize('duplicateActiveGroupRight', "Duplicate Editor Group Right");
constructor(
id: string,
@@ -923,7 +924,7 @@ export class DuplicateGroupRightAction extends BaseDuplicateGroupAction {
export class DuplicateGroupUpAction extends BaseDuplicateGroupAction {
static readonly ID = 'workbench.action.duplicateActiveEditorGroupUp';
static readonly LABEL = nls.localize('duplicateActiveGroupUp', "Duplicate Editor Group Up");
static readonly LABEL = localize('duplicateActiveGroupUp', "Duplicate Editor Group Up");
constructor(
id: string,
@@ -937,7 +938,7 @@ export class DuplicateGroupUpAction extends BaseDuplicateGroupAction {
export class DuplicateGroupDownAction extends BaseDuplicateGroupAction {
static readonly ID = 'workbench.action.duplicateActiveEditorGroupDown';
static readonly LABEL = nls.localize('duplicateActiveGroupDown', "Duplicate Editor Group Down");
static readonly LABEL = localize('duplicateActiveGroupDown', "Duplicate Editor Group Down");
constructor(
id: string,
@@ -951,7 +952,7 @@ export class DuplicateGroupDownAction extends BaseDuplicateGroupAction {
export class MinimizeOtherGroupsAction extends Action {
static readonly ID = 'workbench.action.minimizeOtherEditors';
static readonly LABEL = nls.localize('minimizeOtherEditorGroups', "Maximize Editor Group");
static readonly LABEL = localize('minimizeOtherEditorGroups', "Maximize Editor Group");
constructor(id: string, label: string, @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService) {
super(id, label);
@@ -965,7 +966,7 @@ export class MinimizeOtherGroupsAction extends Action {
export class ResetGroupSizesAction extends Action {
static readonly ID = 'workbench.action.evenEditorWidths';
static readonly LABEL = nls.localize('evenEditorGroups', "Reset Editor Group Sizes");
static readonly LABEL = localize('evenEditorGroups', "Reset Editor Group Sizes");
constructor(id: string, label: string, @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService) {
super(id, label);
@@ -979,7 +980,7 @@ export class ResetGroupSizesAction extends Action {
export class ToggleGroupSizesAction extends Action {
static readonly ID = 'workbench.action.toggleEditorWidths';
static readonly LABEL = nls.localize('toggleEditorWidths', "Toggle Editor Group Sizes");
static readonly LABEL = localize('toggleEditorWidths', "Toggle Editor Group Sizes");
constructor(id: string, label: string, @IEditorGroupsService private readonly editorGroupService: IEditorGroupsService) {
super(id, label);
@@ -993,7 +994,7 @@ export class ToggleGroupSizesAction extends Action {
export class MaximizeGroupAction extends Action {
static readonly ID = 'workbench.action.maximizeEditor';
static readonly LABEL = nls.localize('maximizeEditor', "Maximize Editor Group and Hide Side Bar");
static readonly LABEL = localize('maximizeEditor', "Maximize Editor Group and Hide Side Bar");
constructor(
id: string,
@@ -1047,7 +1048,7 @@ export abstract class BaseNavigateEditorAction extends Action {
export class OpenNextEditor extends BaseNavigateEditorAction {
static readonly ID = 'workbench.action.nextEditor';
static readonly LABEL = nls.localize('openNextEditor', "Open Next Editor");
static readonly LABEL = localize('openNextEditor', "Open Next Editor");
constructor(
id: string,
@@ -1082,7 +1083,7 @@ export class OpenNextEditor extends BaseNavigateEditorAction {
export class OpenPreviousEditor extends BaseNavigateEditorAction {
static readonly ID = 'workbench.action.previousEditor';
static readonly LABEL = nls.localize('openPreviousEditor', "Open Previous Editor");
static readonly LABEL = localize('openPreviousEditor', "Open Previous Editor");
constructor(
id: string,
@@ -1117,7 +1118,7 @@ export class OpenPreviousEditor extends BaseNavigateEditorAction {
export class OpenNextEditorInGroup extends BaseNavigateEditorAction {
static readonly ID = 'workbench.action.nextEditorInGroup';
static readonly LABEL = nls.localize('nextEditorInGroup', "Open Next Editor in Group");
static readonly LABEL = localize('nextEditorInGroup', "Open Next Editor in Group");
constructor(
id: string,
@@ -1140,7 +1141,7 @@ export class OpenNextEditorInGroup extends BaseNavigateEditorAction {
export class OpenPreviousEditorInGroup extends BaseNavigateEditorAction {
static readonly ID = 'workbench.action.previousEditorInGroup';
static readonly LABEL = nls.localize('openPreviousEditorInGroup', "Open Previous Editor in Group");
static readonly LABEL = localize('openPreviousEditorInGroup', "Open Previous Editor in Group");
constructor(
id: string,
@@ -1163,7 +1164,7 @@ export class OpenPreviousEditorInGroup extends BaseNavigateEditorAction {
export class OpenFirstEditorInGroup extends BaseNavigateEditorAction {
static readonly ID = 'workbench.action.firstEditorInGroup';
static readonly LABEL = nls.localize('firstEditorInGroup', "Open First Editor in Group");
static readonly LABEL = localize('firstEditorInGroup', "Open First Editor in Group");
constructor(
id: string,
@@ -1185,7 +1186,7 @@ export class OpenFirstEditorInGroup extends BaseNavigateEditorAction {
export class OpenLastEditorInGroup extends BaseNavigateEditorAction {
static readonly ID = 'workbench.action.lastEditorInGroup';
static readonly LABEL = nls.localize('lastEditorInGroup', "Open Last Editor in Group");
static readonly LABEL = localize('lastEditorInGroup', "Open Last Editor in Group");
constructor(
id: string,
@@ -1207,7 +1208,7 @@ export class OpenLastEditorInGroup extends BaseNavigateEditorAction {
export class NavigateForwardAction extends Action {
static readonly ID = 'workbench.action.navigateForward';
static readonly LABEL = nls.localize('navigateNext', "Go Forward");
static readonly LABEL = localize('navigateNext', "Go Forward");
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
super(id, label);
@@ -1221,7 +1222,7 @@ export class NavigateForwardAction extends Action {
export class NavigateBackwardsAction extends Action {
static readonly ID = 'workbench.action.navigateBack';
static readonly LABEL = nls.localize('navigatePrevious', "Go Back");
static readonly LABEL = localize('navigatePrevious', "Go Back");
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
super(id, label);
@@ -1235,7 +1236,7 @@ export class NavigateBackwardsAction extends Action {
export class NavigateToLastEditLocationAction extends Action {
static readonly ID = 'workbench.action.navigateToLastEditLocation';
static readonly LABEL = nls.localize('navigateToLastEditLocation', "Go to Last Edit Location");
static readonly LABEL = localize('navigateToLastEditLocation', "Go to Last Edit Location");
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
super(id, label);
@@ -1249,7 +1250,7 @@ export class NavigateToLastEditLocationAction extends Action {
export class NavigateLastAction extends Action {
static readonly ID = 'workbench.action.navigateLast';
static readonly LABEL = nls.localize('navigateLast', "Go Last");
static readonly LABEL = localize('navigateLast', "Go Last");
constructor(id: string, label: string, @IHistoryService private readonly historyService: IHistoryService) {
super(id, label);
@@ -1263,7 +1264,7 @@ export class NavigateLastAction extends Action {
export class ReopenClosedEditorAction extends Action {
static readonly ID = 'workbench.action.reopenClosedEditor';
static readonly LABEL = nls.localize('reopenClosedEditor', "Reopen Closed Editor");
static readonly LABEL = localize('reopenClosedEditor', "Reopen Closed Editor");
constructor(
id: string,
@@ -1281,7 +1282,7 @@ export class ReopenClosedEditorAction extends Action {
export class ClearRecentFilesAction extends Action {
static readonly ID = 'workbench.action.clearRecentFiles';
static readonly LABEL = nls.localize('clearRecentFiles', "Clear Recently Opened");
static readonly LABEL = localize('clearRecentFiles', "Clear Recently Opened");
constructor(
id: string,
@@ -1305,7 +1306,7 @@ export class ClearRecentFilesAction extends Action {
export class ShowEditorsInActiveGroupByMostRecentlyUsedAction extends Action {
static readonly ID = 'workbench.action.showEditorsInActiveGroup';
static readonly LABEL = nls.localize('showEditorsInActiveGroup', "Show Editors in Active Group By Most Recently Used");
static readonly LABEL = localize('showEditorsInActiveGroup', "Show Editors in Active Group By Most Recently Used");
constructor(
id: string,
@@ -1323,7 +1324,7 @@ export class ShowEditorsInActiveGroupByMostRecentlyUsedAction extends Action {
export class ShowAllEditorsByAppearanceAction extends Action {
static readonly ID = 'workbench.action.showAllEditors';
static readonly LABEL = nls.localize('showAllEditors', "Show All Editors By Appearance");
static readonly LABEL = localize('showAllEditors', "Show All Editors By Appearance");
constructor(
id: string,
@@ -1341,7 +1342,7 @@ export class ShowAllEditorsByAppearanceAction extends Action {
export class ShowAllEditorsByMostRecentlyUsedAction extends Action {
static readonly ID = 'workbench.action.showAllEditorsByMostRecentlyUsed';
static readonly LABEL = nls.localize('showAllEditorsByMostRecentlyUsed', "Show All Editors By Most Recently Used");
static readonly LABEL = localize('showAllEditorsByMostRecentlyUsed', "Show All Editors By Most Recently Used");
constructor(
id: string,
@@ -1382,7 +1383,7 @@ export class BaseQuickAccessEditorAction extends Action {
export class QuickAccessPreviousRecentlyUsedEditorAction extends BaseQuickAccessEditorAction {
static readonly ID = 'workbench.action.quickOpenPreviousRecentlyUsedEditor';
static readonly LABEL = nls.localize('quickOpenPreviousRecentlyUsedEditor', "Quick Open Previous Recently Used Editor");
static readonly LABEL = localize('quickOpenPreviousRecentlyUsedEditor', "Quick Open Previous Recently Used Editor");
constructor(
id: string,
@@ -1397,7 +1398,7 @@ export class QuickAccessPreviousRecentlyUsedEditorAction extends BaseQuickAccess
export class QuickAccessLeastRecentlyUsedEditorAction extends BaseQuickAccessEditorAction {
static readonly ID = 'workbench.action.quickOpenLeastRecentlyUsedEditor';
static readonly LABEL = nls.localize('quickOpenLeastRecentlyUsedEditor', "Quick Open Least Recently Used Editor");
static readonly LABEL = localize('quickOpenLeastRecentlyUsedEditor', "Quick Open Least Recently Used Editor");
constructor(
id: string,
@@ -1412,7 +1413,7 @@ export class QuickAccessLeastRecentlyUsedEditorAction extends BaseQuickAccessEdi
export class QuickAccessPreviousRecentlyUsedEditorInGroupAction extends BaseQuickAccessEditorAction {
static readonly ID = 'workbench.action.quickOpenPreviousRecentlyUsedEditorInGroup';
static readonly LABEL = nls.localize('quickOpenPreviousRecentlyUsedEditorInGroup', "Quick Open Previous Recently Used Editor in Group");
static readonly LABEL = localize('quickOpenPreviousRecentlyUsedEditorInGroup', "Quick Open Previous Recently Used Editor in Group");
constructor(
id: string,
@@ -1427,7 +1428,7 @@ export class QuickAccessPreviousRecentlyUsedEditorInGroupAction extends BaseQuic
export class QuickAccessLeastRecentlyUsedEditorInGroupAction extends BaseQuickAccessEditorAction {
static readonly ID = 'workbench.action.quickOpenLeastRecentlyUsedEditorInGroup';
static readonly LABEL = nls.localize('quickOpenLeastRecentlyUsedEditorInGroup', "Quick Open Least Recently Used Editor in Group");
static readonly LABEL = localize('quickOpenLeastRecentlyUsedEditorInGroup', "Quick Open Least Recently Used Editor in Group");
constructor(
id: string,
@@ -1442,7 +1443,7 @@ export class QuickAccessLeastRecentlyUsedEditorInGroupAction extends BaseQuickAc
export class QuickAccessPreviousEditorFromHistoryAction extends Action {
static readonly ID = 'workbench.action.openPreviousEditorFromHistory';
static readonly LABEL = nls.localize('navigateEditorHistoryByInput', "Quick Open Previous Editor from History");
static readonly LABEL = localize('navigateEditorHistoryByInput', "Quick Open Previous Editor from History");
constructor(
id: string,
@@ -1471,7 +1472,7 @@ export class QuickAccessPreviousEditorFromHistoryAction extends Action {
export class OpenNextRecentlyUsedEditorAction extends Action {
static readonly ID = 'workbench.action.openNextRecentlyUsedEditor';
static readonly LABEL = nls.localize('openNextRecentlyUsedEditor', "Open Next Recently Used Editor");
static readonly LABEL = localize('openNextRecentlyUsedEditor', "Open Next Recently Used Editor");
constructor(
id: string,
@@ -1489,7 +1490,7 @@ export class OpenNextRecentlyUsedEditorAction extends Action {
export class OpenPreviousRecentlyUsedEditorAction extends Action {
static readonly ID = 'workbench.action.openPreviousRecentlyUsedEditor';
static readonly LABEL = nls.localize('openPreviousRecentlyUsedEditor', "Open Previous Recently Used Editor");
static readonly LABEL = localize('openPreviousRecentlyUsedEditor', "Open Previous Recently Used Editor");
constructor(
id: string,
@@ -1507,7 +1508,7 @@ export class OpenPreviousRecentlyUsedEditorAction extends Action {
export class OpenNextRecentlyUsedEditorInGroupAction extends Action {
static readonly ID = 'workbench.action.openNextRecentlyUsedEditorInGroup';
static readonly LABEL = nls.localize('openNextRecentlyUsedEditorInGroup', "Open Next Recently Used Editor In Group");
static readonly LABEL = localize('openNextRecentlyUsedEditorInGroup', "Open Next Recently Used Editor In Group");
constructor(
id: string,
@@ -1526,7 +1527,7 @@ export class OpenNextRecentlyUsedEditorInGroupAction extends Action {
export class OpenPreviousRecentlyUsedEditorInGroupAction extends Action {
static readonly ID = 'workbench.action.openPreviousRecentlyUsedEditorInGroup';
static readonly LABEL = nls.localize('openPreviousRecentlyUsedEditorInGroup', "Open Previous Recently Used Editor In Group");
static readonly LABEL = localize('openPreviousRecentlyUsedEditorInGroup', "Open Previous Recently Used Editor In Group");
constructor(
id: string,
@@ -1545,7 +1546,7 @@ export class OpenPreviousRecentlyUsedEditorInGroupAction extends Action {
export class ClearEditorHistoryAction extends Action {
static readonly ID = 'workbench.action.clearEditorHistory';
static readonly LABEL = nls.localize('clearEditorHistory', "Clear Editor History");
static readonly LABEL = localize('clearEditorHistory', "Clear Editor History");
constructor(
id: string,
@@ -1565,7 +1566,7 @@ export class ClearEditorHistoryAction extends Action {
export class MoveEditorLeftInGroupAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.moveEditorLeftInGroup';
static readonly LABEL = nls.localize('moveEditorLeft', "Move Editor Left");
static readonly LABEL = localize('moveEditorLeft', "Move Editor Left");
constructor(
id: string,
@@ -1579,7 +1580,7 @@ export class MoveEditorLeftInGroupAction extends ExecuteCommandAction {
export class MoveEditorRightInGroupAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.moveEditorRightInGroup';
static readonly LABEL = nls.localize('moveEditorRight', "Move Editor Right");
static readonly LABEL = localize('moveEditorRight', "Move Editor Right");
constructor(
id: string,
@@ -1593,7 +1594,7 @@ export class MoveEditorRightInGroupAction extends ExecuteCommandAction {
export class MoveEditorToPreviousGroupAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.moveEditorToPreviousGroup';
static readonly LABEL = nls.localize('moveEditorToPreviousGroup', "Move Editor into Previous Group");
static readonly LABEL = localize('moveEditorToPreviousGroup', "Move Editor into Previous Group");
constructor(
id: string,
@@ -1607,7 +1608,7 @@ export class MoveEditorToPreviousGroupAction extends ExecuteCommandAction {
export class MoveEditorToNextGroupAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.moveEditorToNextGroup';
static readonly LABEL = nls.localize('moveEditorToNextGroup', "Move Editor into Next Group");
static readonly LABEL = localize('moveEditorToNextGroup', "Move Editor into Next Group");
constructor(
id: string,
@@ -1621,7 +1622,7 @@ export class MoveEditorToNextGroupAction extends ExecuteCommandAction {
export class MoveEditorToAboveGroupAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.moveEditorToAboveGroup';
static readonly LABEL = nls.localize('moveEditorToAboveGroup', "Move Editor into Above Group");
static readonly LABEL = localize('moveEditorToAboveGroup', "Move Editor into Above Group");
constructor(
id: string,
@@ -1635,7 +1636,7 @@ export class MoveEditorToAboveGroupAction extends ExecuteCommandAction {
export class MoveEditorToBelowGroupAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.moveEditorToBelowGroup';
static readonly LABEL = nls.localize('moveEditorToBelowGroup', "Move Editor into Below Group");
static readonly LABEL = localize('moveEditorToBelowGroup', "Move Editor into Below Group");
constructor(
id: string,
@@ -1649,7 +1650,7 @@ export class MoveEditorToBelowGroupAction extends ExecuteCommandAction {
export class MoveEditorToLeftGroupAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.moveEditorToLeftGroup';
static readonly LABEL = nls.localize('moveEditorToLeftGroup', "Move Editor into Left Group");
static readonly LABEL = localize('moveEditorToLeftGroup', "Move Editor into Left Group");
constructor(
id: string,
@@ -1663,7 +1664,7 @@ export class MoveEditorToLeftGroupAction extends ExecuteCommandAction {
export class MoveEditorToRightGroupAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.moveEditorToRightGroup';
static readonly LABEL = nls.localize('moveEditorToRightGroup', "Move Editor into Right Group");
static readonly LABEL = localize('moveEditorToRightGroup', "Move Editor into Right Group");
constructor(
id: string,
@@ -1677,7 +1678,7 @@ export class MoveEditorToRightGroupAction extends ExecuteCommandAction {
export class MoveEditorToFirstGroupAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.moveEditorToFirstGroup';
static readonly LABEL = nls.localize('moveEditorToFirstGroup', "Move Editor into First Group");
static readonly LABEL = localize('moveEditorToFirstGroup', "Move Editor into First Group");
constructor(
id: string,
@@ -1691,7 +1692,7 @@ export class MoveEditorToFirstGroupAction extends ExecuteCommandAction {
export class MoveEditorToLastGroupAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.moveEditorToLastGroup';
static readonly LABEL = nls.localize('moveEditorToLastGroup', "Move Editor into Last Group");
static readonly LABEL = localize('moveEditorToLastGroup', "Move Editor into Last Group");
constructor(
id: string,
@@ -1705,7 +1706,7 @@ export class MoveEditorToLastGroupAction extends ExecuteCommandAction {
export class EditorLayoutSingleAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.editorLayoutSingle';
static readonly LABEL = nls.localize('editorLayoutSingle', "Single Column Editor Layout");
static readonly LABEL = localize('editorLayoutSingle', "Single Column Editor Layout");
constructor(
id: string,
@@ -1719,7 +1720,7 @@ export class EditorLayoutSingleAction extends ExecuteCommandAction {
export class EditorLayoutTwoColumnsAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.editorLayoutTwoColumns';
static readonly LABEL = nls.localize('editorLayoutTwoColumns', "Two Columns Editor Layout");
static readonly LABEL = localize('editorLayoutTwoColumns', "Two Columns Editor Layout");
constructor(
id: string,
@@ -1733,7 +1734,7 @@ export class EditorLayoutTwoColumnsAction extends ExecuteCommandAction {
export class EditorLayoutThreeColumnsAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.editorLayoutThreeColumns';
static readonly LABEL = nls.localize('editorLayoutThreeColumns', "Three Columns Editor Layout");
static readonly LABEL = localize('editorLayoutThreeColumns', "Three Columns Editor Layout");
constructor(
id: string,
@@ -1747,7 +1748,7 @@ export class EditorLayoutThreeColumnsAction extends ExecuteCommandAction {
export class EditorLayoutTwoRowsAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.editorLayoutTwoRows';
static readonly LABEL = nls.localize('editorLayoutTwoRows', "Two Rows Editor Layout");
static readonly LABEL = localize('editorLayoutTwoRows', "Two Rows Editor Layout");
constructor(
id: string,
@@ -1761,7 +1762,7 @@ export class EditorLayoutTwoRowsAction extends ExecuteCommandAction {
export class EditorLayoutThreeRowsAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.editorLayoutThreeRows';
static readonly LABEL = nls.localize('editorLayoutThreeRows', "Three Rows Editor Layout");
static readonly LABEL = localize('editorLayoutThreeRows', "Three Rows Editor Layout");
constructor(
id: string,
@@ -1775,7 +1776,7 @@ export class EditorLayoutThreeRowsAction extends ExecuteCommandAction {
export class EditorLayoutTwoByTwoGridAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.editorLayoutTwoByTwoGrid';
static readonly LABEL = nls.localize('editorLayoutTwoByTwoGrid', "Grid Editor Layout (2x2)");
static readonly LABEL = localize('editorLayoutTwoByTwoGrid', "Grid Editor Layout (2x2)");
constructor(
id: string,
@@ -1789,7 +1790,7 @@ export class EditorLayoutTwoByTwoGridAction extends ExecuteCommandAction {
export class EditorLayoutTwoColumnsBottomAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.editorLayoutTwoColumnsBottom';
static readonly LABEL = nls.localize('editorLayoutTwoColumnsBottom', "Two Columns Bottom Editor Layout");
static readonly LABEL = localize('editorLayoutTwoColumnsBottom', "Two Columns Bottom Editor Layout");
constructor(
id: string,
@@ -1803,7 +1804,7 @@ export class EditorLayoutTwoColumnsBottomAction extends ExecuteCommandAction {
export class EditorLayoutTwoRowsRightAction extends ExecuteCommandAction {
static readonly ID = 'workbench.action.editorLayoutTwoRowsRight';
static readonly LABEL = nls.localize('editorLayoutTwoRowsRight', "Two Rows Right Editor Layout");
static readonly LABEL = localize('editorLayoutTwoRowsRight', "Two Rows Right Editor Layout");
constructor(
id: string,
@@ -1833,7 +1834,7 @@ export class BaseCreateEditorGroupAction extends Action {
export class NewEditorGroupLeftAction extends BaseCreateEditorGroupAction {
static readonly ID = 'workbench.action.newGroupLeft';
static readonly LABEL = nls.localize('newEditorLeft', "New Editor Group to the Left");
static readonly LABEL = localize('newEditorLeft', "New Editor Group to the Left");
constructor(
id: string,
@@ -1847,7 +1848,7 @@ export class NewEditorGroupLeftAction extends BaseCreateEditorGroupAction {
export class NewEditorGroupRightAction extends BaseCreateEditorGroupAction {
static readonly ID = 'workbench.action.newGroupRight';
static readonly LABEL = nls.localize('newEditorRight', "New Editor Group to the Right");
static readonly LABEL = localize('newEditorRight', "New Editor Group to the Right");
constructor(
id: string,
@@ -1861,7 +1862,7 @@ export class NewEditorGroupRightAction extends BaseCreateEditorGroupAction {
export class NewEditorGroupAboveAction extends BaseCreateEditorGroupAction {
static readonly ID = 'workbench.action.newGroupAbove';
static readonly LABEL = nls.localize('newEditorAbove', "New Editor Group Above");
static readonly LABEL = localize('newEditorAbove', "New Editor Group Above");
constructor(
id: string,
@@ -1875,7 +1876,7 @@ export class NewEditorGroupAboveAction extends BaseCreateEditorGroupAction {
export class NewEditorGroupBelowAction extends BaseCreateEditorGroupAction {
static readonly ID = 'workbench.action.newGroupBelow';
static readonly LABEL = nls.localize('newEditorBelow', "New Editor Group Below");
static readonly LABEL = localize('newEditorBelow', "New Editor Group Below");
constructor(
id: string,
@@ -1889,13 +1890,12 @@ export class NewEditorGroupBelowAction extends BaseCreateEditorGroupAction {
export class ReopenResourcesAction extends Action {
static readonly ID = 'workbench.action.reopenWithEditor';
static readonly LABEL = nls.localize('workbench.action.reopenWithEditor', "Reopen Editor With...");
static readonly LABEL = localize('workbench.action.reopenWithEditor', "Reopen Editor With...");
constructor(
id: string,
label: string,
@IEditorService private readonly editorService: IEditorService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IEditorService private readonly editorService: IEditorService
) {
super(id, label);
}
@@ -1913,14 +1913,14 @@ export class ReopenResourcesAction extends Action {
const options = activeEditorPane.options;
const group = activeEditorPane.group;
await this.instantiationService.invokeFunction(openEditorWith, activeInput, undefined, options, group);
await this.editorService.openEditor(activeInput, { ...options, override: EditorOverride.PICK }, group);
}
}
export class ToggleEditorTypeAction extends Action {
static readonly ID = 'workbench.action.toggleEditorType';
static readonly LABEL = nls.localize('workbench.action.toggleEditorType', "Toggle Editor Type");
static readonly LABEL = localize('workbench.action.toggleEditorType', "Toggle Editor Type");
constructor(
id: string,
@@ -1944,7 +1944,7 @@ export class ToggleEditorTypeAction extends Action {
const options = activeEditorPane.options;
const group = activeEditorPane.group;
const overrides = getAllAvailableEditors(activeEditorResource, undefined, options, group, this.editorService);
const overrides = this.editorService.getEditorOverrides(activeEditorResource, options, group);
const firstNonActiveOverride = overrides.find(([_, entry]) => !entry.active);
if (!firstNonActiveOverride) {
return;

View File

@@ -39,7 +39,9 @@ export class EditorAutoSave extends Disposable implements IWorkbenchContribution
this.onAutoSaveConfigurationChange(filesConfigurationService.getAutoSaveConfiguration(), false);
// Fill in initial dirty working copies
this.workingCopyService.dirtyWorkingCopies.forEach(workingCopy => this.onDidRegister(workingCopy));
for (const dirtyWorkingCopy of this.workingCopyService.dirtyWorkingCopies) {
this.onDidRegister(dirtyWorkingCopy);
}
this.registerListeners();
}

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { isObject, isString, isUndefined, isNumber, withNullAsUndefined } from 'vs/base/common/types';
import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
@@ -25,7 +25,6 @@ import { MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
import { ActiveGroupEditorsByMostRecentlyUsedQuickAccess } from 'vs/workbench/browser/parts/editor/editorQuickAccess';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
import { openEditorWith } from 'vs/workbench/services/editor/common/editorOpenWith';
export const CLOSE_SAVED_EDITORS_COMMAND_ID = 'workbench.action.closeUnmodifiedEditors';
export const CLOSE_EDITORS_IN_GROUP_COMMAND_ID = 'workbench.action.closeEditorsInGroup';
@@ -103,11 +102,11 @@ function registerActiveEditorMoveCommand(): void {
primary: 0,
handler: (accessor, args) => moveActiveEditor(args, accessor),
description: {
description: nls.localize('editorCommand.activeEditorMove.description', "Move the active editor by tabs or groups"),
description: localize('editorCommand.activeEditorMove.description', "Move the active editor by tabs or groups"),
args: [
{
name: nls.localize('editorCommand.activeEditorMove.arg.name', "Active editor move argument"),
description: nls.localize('editorCommand.activeEditorMove.arg.description', "Argument Properties:\n\t* 'to': String value providing where to move.\n\t* 'by': String value providing the unit for move (by tab or by group).\n\t* 'value': Number value providing how many positions or an absolute position to move."),
name: localize('editorCommand.activeEditorMove.arg.name', "Active editor move argument"),
description: localize('editorCommand.activeEditorMove.arg.description', "Argument Properties:\n\t* 'to': String value providing where to move.\n\t* 'by': String value providing the unit for move (by tab or by group).\n\t* 'value': Number value providing how many positions or an absolute position to move."),
constraint: isActiveEditorMoveArg,
schema: {
'type': 'object',
@@ -282,13 +281,13 @@ function registerEditorGroupsLayoutCommand(): void {
export function mergeAllGroups(editorGroupService: IEditorGroupsService): void {
const target = editorGroupService.activeGroup;
editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE).forEach(group => {
for (const group of editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE)) {
if (group === target) {
return; // keep target
continue; // keep target
}
editorGroupService.mergeGroup(group, target);
});
}
}
function registerDiffEditorCommands(): void {
@@ -408,10 +407,10 @@ function registerDiffEditorCommands(): void {
command: {
id: TOGGLE_DIFF_SIDE_BY_SIDE,
title: {
value: nls.localize('toggleInlineView', "Toggle Inline View"),
value: localize('toggleInlineView', "Toggle Inline View"),
original: 'Compare: Toggle Inline View'
},
category: nls.localize('compare', "Compare")
category: localize('compare', "Compare")
},
when: ContextKeyExpr.has('textCompareEditorActive')
});
@@ -499,10 +498,8 @@ function registerOpenEditorAPICommands(): void {
group = editorGroupsService.getGroup(viewColumnToEditorGroup(editorGroupsService, columnArg)) ?? editorGroupsService.activeGroup;
}
const textOptions: ITextEditorOptions = optionsArg ? { ...optionsArg, override: false } : { override: false };
const input = editorService.createEditorInput({ resource: URI.revive(resource) });
return openEditorWith(accessor, input, id, textOptions, group);
return editorService.openEditor(input, { ...optionsArg, override: id }, group);
});
}

View File

@@ -31,8 +31,8 @@ export class EditorControl extends Disposable {
private readonly _onDidFocus = this._register(new Emitter<void>());
readonly onDidFocus = this._onDidFocus.event;
private _onDidSizeConstraintsChange = this._register(new Emitter<{ width: number; height: number; } | undefined>());
readonly onDidSizeConstraintsChange = this._onDidSizeConstraintsChange.event;
private _onDidChangeSizeConstraints = this._register(new Emitter<{ width: number; height: number; } | undefined>());
readonly onDidChangeSizeConstraints = this._onDidChangeSizeConstraints.event;
private _activeEditorPane: EditorPane | null = null;
get activeEditorPane(): IVisibleEditorPane | null { return this._activeEditorPane as IVisibleEditorPane | null; }
@@ -139,12 +139,12 @@ export class EditorControl extends Disposable {
// Listen to editor pane changes
if (editorPane) {
this.activeEditorPaneDisposables.add(editorPane.onDidSizeConstraintsChange(e => this._onDidSizeConstraintsChange.fire(e)));
this.activeEditorPaneDisposables.add(editorPane.onDidChangeSizeConstraints(e => this._onDidChangeSizeConstraints.fire(e)));
this.activeEditorPaneDisposables.add(editorPane.onDidFocus(() => this._onDidFocus.fire()));
}
// Indicate that size constraints could have changed due to new editor
this._onDidSizeConstraintsChange.fire(undefined);
this._onDidChangeSizeConstraints.fire(undefined);
}
private async doSetInput(editorPane: EditorPane, editor: EditorInput, options: EditorOptions | undefined, context: IEditorOpenContext): Promise<boolean> {

View File

@@ -26,6 +26,7 @@ import { assertIsDefined, assertAllDefined } from 'vs/base/common/types';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { localize } from 'vs/nls';
import { ByteSize } from 'vs/platform/files/common/files';
import { EditorOverride } from 'vs/platform/editor/common/editor';
interface IDropOperation {
splitDirection?: GroupDirection;
@@ -284,7 +285,7 @@ class DropOverlay extends Themable {
const options = getActiveTextEditorOptions(sourceGroup, draggedEditor.editor, EditorOptions.create({
pinned: true, // always pin dropped editor
sticky: sourceGroup.isSticky(draggedEditor.editor), // preserve sticky state
override: false, // Use `draggedEditor.editor` as is. If it is already a custom editor, it will stay so.
override: EditorOverride.DISABLED // preserve editor type
}));
const copyEditor = this.isCopyOperation(event, draggedEditor);
targetGroup.openEditor(draggedEditor.editor, options, copyEditor ? OpenEditorContext.COPY_EDITOR : OpenEditorContext.MOVE_EDITOR);
@@ -521,7 +522,7 @@ class DropOverlay extends Themable {
// With tabs and opened editors: use the area below tabs as drop target
if (!this.groupView.isEmpty && this.accessor.partOptions.showTabs) {
return this.groupView.titleDimensions.offset;
return this.groupView.titleHeight.offset;
}
// Without tabs or empty group: use entire editor area as drop target

View File

@@ -22,15 +22,15 @@ import { EditorControl } from 'vs/workbench/browser/parts/editor/editorControl';
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
import { EditorProgressIndicator } from 'vs/workbench/services/progress/browser/progressIndicator';
import { localize } from 'vs/nls';
import { isPromiseCanceledError } from 'vs/base/common/errors';
import { isErrorWithActions, isPromiseCanceledError } from 'vs/base/common/errors';
import { dispose, MutableDisposable } from 'vs/base/common/lifecycle';
import { Severity, INotificationService } from 'vs/platform/notification/common/notification';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { RunOnceWorker } from 'vs/base/common/async';
import { Promises, RunOnceWorker } from 'vs/base/common/async';
import { EventType as TouchEventType, GestureEvent } from 'vs/base/browser/touch';
import { TitleControl } from 'vs/workbench/browser/parts/editor/titleControl';
import { IEditorGroupsAccessor, IEditorGroupView, getActiveTextEditorOptions, IEditorOpeningEvent, EditorServiceImpl, IEditorGroupTitleDimensions } from 'vs/workbench/browser/parts/editor/editor';
import { IEditorGroupsAccessor, IEditorGroupView, getActiveTextEditorOptions, IEditorOpeningEvent, EditorServiceImpl, IEditorGroupTitleHeight } from 'vs/workbench/browser/parts/editor/editor';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { ActionRunner, IAction, Action } from 'vs/base/common/actions';
@@ -40,7 +40,6 @@ import { IMenuService, MenuId, IMenu } from 'vs/platform/actions/common/actions'
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { isErrorWithActions, IErrorWithActions } from 'vs/base/common/errorsWithActions';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { withNullAsUndefined, withUndefinedAsNull } from 'vs/base/common/types';
import { hash } from 'vs/base/common/hash';
@@ -200,7 +199,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Editor control
this.editorControl = this._register(this.scopedInstantiationService.createInstance(EditorControl, this.editorContainer, this));
this._onDidChange.input = this.editorControl.onDidSizeConstraintsChange;
this._onDidChange.input = this.editorControl.onDidChangeSizeConstraints;
// Track Focus
this.doTrackFocus();
@@ -490,7 +489,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
this._register(this._group.onDidEditorLabelChange(editor => this.onDidEditorLabelChange(editor)));
// Option Changes
this._register(this.accessor.onDidEditorPartOptionsChange(e => this.onDidEditorPartOptionsChange(e)));
this._register(this.accessor.onDidChangeEditorPartOptions(e => this.onDidChangeEditorPartOptions(e)));
// Visibility
this._register(this.accessor.onDidVisibilityChange(e => this.onDidVisibilityChange(e)));
@@ -598,16 +597,18 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Split between visible and hidden editors
let activeEditor: EditorInput | undefined;
const inactiveEditors: EditorInput[] = [];
editors.forEach(editor => {
for (const editor of editors) {
if (this._group.isActive(editor)) {
activeEditor = editor;
} else if (this._group.contains(editor)) {
inactiveEditors.push(editor);
}
});
}
// Close all inactive editors first to prevent UI flicker
inactiveEditors.forEach(hidden => this.doCloseEditor(hidden, false));
for (const inactiveEditor of inactiveEditors) {
this.doCloseEditor(inactiveEditor, false);
}
// Close active one last
if (activeEditor) {
@@ -615,7 +616,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
}
}
private onDidEditorPartOptionsChange(event: IEditorPartOptionsChangeEvent): void {
private onDidChangeEditorPartOptions(event: IEditorPartOptionsChangeEvent): void {
// Title container
this.updateTitleContainer();
@@ -711,8 +712,8 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
return this._group.count === 0;
}
get titleDimensions(): IEditorGroupTitleDimensions {
return this.titleAreaControl.getDimensions();
get titleHeight(): IEditorGroupTitleHeight {
return this.titleAreaControl.getHeight();
}
get isMinimized(): boolean {
@@ -1022,14 +1023,16 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Extract possible error actions from the error
let errorActions: ReadonlyArray<IAction> | undefined = undefined;
if (isErrorWithActions(error)) {
errorActions = (error as IErrorWithActions).actions;
errorActions = error.actions;
}
// If the context is USER, we try to show a modal dialog instead of a background notification
if (options?.context === EditorOpenContext.USER) {
const buttons: string[] = [];
if (Array.isArray(errorActions) && errorActions.length > 0) {
errorActions.forEach(action => buttons.push(action.label));
for (const errorAction of errorActions) {
buttons.push(errorAction.label);
}
} else {
buttons.push(localize('ok', 'OK'));
}
@@ -1110,7 +1113,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Open the other ones inactive
const startingIndex = this.getIndexOfEditor(editor) + 1;
await Promise.all(editors.map(async ({ editor, options }, index) => {
await Promises.settled(editors.map(async ({ editor, options }, index) => {
const adjustedEditorOptions = options || new EditorOptions();
adjustedEditorOptions.inactive = true;
adjustedEditorOptions.pinned = true;
@@ -1216,18 +1219,24 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
//#region closeEditor()
async closeEditor(editor: EditorInput | undefined = this.activeEditor || undefined, options?: ICloseEditorOptions): Promise<void> {
await this.doCloseEditorWithDirtyHandling(editor, options);
}
private async doCloseEditorWithDirtyHandling(editor: EditorInput | undefined = this.activeEditor || undefined, options?: ICloseEditorOptions): Promise<boolean> {
if (!editor) {
return;
return false;
}
// Check for dirty and veto
const veto = await this.handleDirtyClosing([editor]);
if (veto) {
return;
return false;
}
// Do close
this.doCloseEditor(editor, options?.preserveFocus ? false : undefined);
return true;
}
private doCloseEditor(editor: EditorInput, focusNext = (this.accessor.activeGroup === this), fromError?: boolean): void {
@@ -1347,10 +1356,12 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
this.mapEditorToPendingConfirmation.set(editor, handleDirtyClosingPromise);
}
const veto = await handleDirtyClosingPromise;
// Make sure to remove from our map of cached pending confirmations
this.mapEditorToPendingConfirmation.delete(editor);
let veto: boolean;
try {
veto = await handleDirtyClosingPromise;
} finally {
this.mapEditorToPendingConfirmation.delete(editor);
}
// Return for the first veto we got
if (veto) {
@@ -1521,13 +1532,13 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Close all inactive editors first
let closeActiveEditor = false;
editors.forEach(editor => {
for (const editor of editors) {
if (!this.isActive(editor)) {
this.doCloseInactiveEditor(editor);
} else {
closeActiveEditor = true;
}
});
}
// Close active editor last if contained in editors list to close
if (closeActiveEditor) {
@@ -1571,13 +1582,13 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Close all inactive editors first
const editorsToClose: EditorInput[] = [];
this._group.getEditors(EditorsOrder.SEQUENTIAL, options).forEach(editor => {
for (const editor of this._group.getEditors(EditorsOrder.SEQUENTIAL, options)) {
if (!this.isActive(editor)) {
this.doCloseInactiveEditor(editor);
}
editorsToClose.push(editor);
});
}
// Close active editor last (unless we skip it, e.g. because it is sticky)
if (this.activeEditor && editorsToClose.includes(this.activeEditor)) {
@@ -1599,11 +1610,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Extract active vs. inactive replacements
let activeReplacement: EditorReplacement | undefined;
const inactiveReplacements: EditorReplacement[] = [];
editors.forEach(({ editor, replacement, options }) => {
if (editor.isDirty() && !editor.isSaving()) {
return; // we do not handle dirty in this method, so ignore all dirty
}
for (let { editor, replacement, options } of editors) {
const index = this.getIndexOfEditor(editor);
if (index >= 0) {
const isActiveEditor = this.isActive(editor);
@@ -1625,20 +1632,22 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
inactiveReplacements.push(editorToReplace);
}
}
});
}
// Handle inactive first
inactiveReplacements.forEach(async ({ editor, replacement, options }) => {
for (const { editor, replacement, options } of inactiveReplacements) {
// Open inactive editor
await this.doOpenEditor(replacement, options);
// Close replaced inactive editor unless they match
if (!editor.matches(replacement)) {
this.doCloseInactiveEditor(editor);
this.titleAreaControl.closeEditor(editor);
const closed = await this.doCloseEditorWithDirtyHandling(editor, { preserveFocus: true });
if (!closed) {
return; // canceled
}
}
});
}
// Handle active last
if (activeReplacement) {
@@ -1648,8 +1657,7 @@ export class EditorGroupView extends Themable implements IEditorGroupView {
// Close replaced active editor unless they match
if (!activeReplacement.editor.matches(activeReplacement.replacement)) {
this.doCloseInactiveEditor(activeReplacement.editor);
this.titleAreaControl.closeEditor(activeReplacement.editor);
await this.doCloseEditorWithDirtyHandling(activeReplacement.editor, { preserveFocus: true });
}
await openEditorResult;

View File

@@ -8,12 +8,12 @@ import { EditorInput, EditorOptions, IEditorPane, GroupIdentifier, IEditorMement
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { CancellationToken } from 'vs/base/common/cancellation';
import { IEditorGroup, IEditorGroupsService, GroupsOrder } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { LRUCache, Touch } from 'vs/base/common/map';
import { URI } from 'vs/base/common/uri';
import { Event } from 'vs/base/common/event';
import { isEmptyObject, isUndefinedOrNull } from 'vs/base/common/types';
import { isEmptyObject } from 'vs/base/common/types';
import { DEFAULT_EDITOR_MIN_DIMENSIONS, DEFAULT_EDITOR_MAX_DIMENSIONS } from 'vs/workbench/browser/parts/editor/editor';
import { MementoObject } from 'vs/workbench/common/memento';
import { joinPath, IExtUri, isEqual } from 'vs/base/common/resources';
@@ -51,7 +51,7 @@ export abstract class EditorPane extends Composite implements IEditorPane {
get minimumHeight() { return DEFAULT_EDITOR_MIN_DIMENSIONS.height; }
get maximumHeight() { return DEFAULT_EDITOR_MAX_DIMENSIONS.height; }
readonly onDidSizeConstraintsChange = Event.None;
readonly onDidChangeSizeConstraints = Event.None;
protected _input: EditorInput | undefined;
get input(): EditorInput | undefined { return this._input; }
@@ -166,11 +166,11 @@ export abstract class EditorPane extends Composite implements IEditorPane {
protected saveState(): void {
// Save all editor memento for this editor type
EditorPane.EDITOR_MEMENTOS.forEach(editorMemento => {
for (const [, editorMemento] of EditorPane.EDITOR_MEMENTOS) {
if (editorMemento.id === this.getId()) {
editorMemento.saveState();
}
});
}
super.saveState();
}
@@ -224,9 +224,9 @@ export class EditorMemento<T> implements IEditorMemento<T> {
}
}
loadEditorState(group: IEditorGroup, resource: URI, fallbackToOtherGroupState?: boolean): T | undefined;
loadEditorState(group: IEditorGroup, editor: EditorInput, fallbackToOtherGroupState?: boolean): T | undefined;
loadEditorState(group: IEditorGroup, resourceOrEditor: URI | EditorInput, fallbackToOtherGroupState?: boolean): T | undefined {
loadEditorState(group: IEditorGroup, resource: URI): T | undefined;
loadEditorState(group: IEditorGroup, editor: EditorInput): T | undefined;
loadEditorState(group: IEditorGroup, resourceOrEditor: URI | EditorInput): T | undefined {
const resource = this.doGetResource(resourceOrEditor);
if (!resource || !group) {
return; // we are not in a good state to load any state for a resource
@@ -236,18 +236,7 @@ export class EditorMemento<T> implements IEditorMemento<T> {
const mementoForResource = cache.get(resource.toString());
if (mementoForResource) {
let mementoForResourceAndGroup = mementoForResource[group.id];
if (!fallbackToOtherGroupState || !isUndefinedOrNull(mementoForResourceAndGroup)) {
return mementoForResourceAndGroup;
}
// Fallback to retrieve state from the most recently active editor group as instructed
for (const group of this.editorGroupService.getGroups(GroupsOrder.MOST_RECENTLY_ACTIVE)) {
mementoForResourceAndGroup = mementoForResource[group.id];
if (!isUndefinedOrNull(mementoForResourceAndGroup)) {
return mementoForResourceAndGroup;
}
}
return mementoForResource[group.id];
}
return;

View File

@@ -3,7 +3,6 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/workbench/browser/parts/editor/editor.contribution';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { Part } from 'vs/workbench/browser/part';
import { Dimension, isAncestor, $, EventHelper, addDisposableGenericMouseDownListner } from 'vs/base/browser/dom';
@@ -32,6 +31,7 @@ import { MementoObject } from 'vs/workbench/common/memento';
import { assertIsDefined } from 'vs/base/common/types';
import { IBoundarySashes } from 'vs/base/browser/ui/grid/gridview';
import { CompositeDragAndDropObserver } from 'vs/workbench/browser/dnd';
import { Promises } from 'vs/base/common/async';
interface IEditorPartUIState {
serializedGrid: ISerializedGrid;
@@ -93,11 +93,11 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
private readonly _onDidLayout = this._register(new Emitter<Dimension>());
readonly onDidLayout = this._onDidLayout.event;
private readonly _onDidActiveGroupChange = this._register(new Emitter<IEditorGroupView>());
readonly onDidActiveGroupChange = this._onDidActiveGroupChange.event;
private readonly _onDidChangeActiveGroup = this._register(new Emitter<IEditorGroupView>());
readonly onDidChangeActiveGroup = this._onDidChangeActiveGroup.event;
private readonly _onDidGroupIndexChange = this._register(new Emitter<IEditorGroupView>());
readonly onDidGroupIndexChange = this._onDidGroupIndexChange.event;
private readonly _onDidChangeGroupIndex = this._register(new Emitter<IEditorGroupView>());
readonly onDidChangeGroupIndex = this._onDidChangeGroupIndex.event;
private readonly _onDidActivateGroup = this._register(new Emitter<IEditorGroupView>());
readonly onDidActivateGroup = this._onDidActivateGroup.event;
@@ -113,11 +113,11 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
private readonly onDidSetGridWidget = this._register(new Emitter<{ width: number; height: number; } | undefined>());
private readonly _onDidSizeConstraintsChange = this._register(new Relay<{ width: number; height: number; } | undefined>());
readonly onDidSizeConstraintsChange = Event.any(this.onDidSetGridWidget.event, this._onDidSizeConstraintsChange.event);
private readonly _onDidChangeSizeConstraints = this._register(new Relay<{ width: number; height: number; } | undefined>());
readonly onDidChangeSizeConstraints = Event.any(this.onDidSetGridWidget.event, this._onDidChangeSizeConstraints.event);
private readonly _onDidEditorPartOptionsChange = this._register(new Emitter<IEditorPartOptionsChangeEvent>());
readonly onDidEditorPartOptionsChange = this._onDidEditorPartOptionsChange.event;
private readonly _onDidChangeEditorPartOptions = this._register(new Emitter<IEditorPartOptionsChangeEvent>());
readonly onDidChangeEditorPartOptions = this._onDidChangeEditorPartOptions.event;
//#endregion
@@ -177,7 +177,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
this._partOptions = newPartOptions;
this._onDidEditorPartOptionsChange.fire({ oldPartOptions, newPartOptions });
this._onDidChangeEditorPartOptions.fire({ oldPartOptions, newPartOptions });
}
//#region IEditorGroupsService
@@ -550,7 +550,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
this.updateContainer();
break;
case GroupChangeKind.GROUP_INDEX:
this._onDidGroupIndexChange.fire(groupView);
this._onDidChangeGroupIndex.fire(groupView);
break;
}
}));
@@ -588,7 +588,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
this.doRestoreGroup(group);
// Event
this._onDidActiveGroupChange.fire(group);
this._onDidChangeActiveGroup.fire(group);
}
private doRestoreGroup(group: IEditorGroupView): void {
@@ -944,7 +944,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
}
// Signal restored
Promise.all(this.groups.map(group => group.whenRestored)).finally(() => {
Promises.settled(this.groups.map(group => group.whenRestored)).finally(() => {
if (this.whenRestoredResolve) {
this.whenRestoredResolve();
}
@@ -1046,7 +1046,7 @@ export class EditorPart extends Part implements IEditorGroupsService, IEditorGro
this.gridWidget.boundarySashes = boundarySashes;
this.gridWidgetView.gridWidget = gridWidget;
this._onDidSizeConstraintsChange.input = gridWidget.onDidChange;
this._onDidChangeSizeConstraints.input = gridWidget.onDidChange;
this.onDidSetGridWidget.fire(undefined);
}

View File

@@ -10,7 +10,7 @@ import { format, compare, splitLines } from 'vs/base/common/strings';
import { extname, basename, isEqual } from 'vs/base/common/resources';
import { areFunctions, withNullAsUndefined, withUndefinedAsNull } from 'vs/base/common/types';
import { URI } from 'vs/base/common/uri';
import { Action } from 'vs/base/common/actions';
import { Action, WorkbenchActionExecutedClassification, WorkbenchActionExecutedEvent } from 'vs/base/common/actions';
import { Language } from 'vs/base/common/platform';
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
import { IFileEditorInput, EncodingMode, IEncodingSupport, EditorResourceAccessor, SideBySideEditorInput, IEditorPane, IEditorInput, SideBySideEditor, IModeSupport } from 'vs/workbench/common/editor';
@@ -52,6 +52,7 @@ import { IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment, IStatus
import { IMarker, IMarkerService, MarkerSeverity, IMarkerData } from 'vs/platform/markers/common/markers';
import { STATUS_BAR_PROMINENT_ITEM_BACKGROUND, STATUS_BAR_PROMINENT_ITEM_FOREGROUND } from 'vs/workbench/common/theme';
import { themeColorFromId } from 'vs/platform/theme/common/themeService';
import { ITelemetryData, ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
class SideBySideEditorEncodingSupport implements IEncodingSupport {
constructor(private primary: IEncodingSupport, private secondary: IEncodingSupport) { }
@@ -696,7 +697,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
}
binaryEditors.forEach(editor => {
this.activeEditorListeners.add(editor.onMetadataChanged(metadata => {
this.activeEditorListeners.add(editor.onDidChangeMetadata(metadata => {
this.onMetadataChange(activeEditorPane);
}));
@@ -753,7 +754,7 @@ export class EditorStatus extends Disposable implements IWorkbenchContribution {
private onColumnSelectionModeChange(editorWidget: ICodeEditor | undefined): void {
const info: StateDelta = { type: 'columnSelectionMode', columnSelectionMode: false };
if (editorWidget && editorWidget.getOption(EditorOption.columnSelection)) {
if (editorWidget?.getOption(EditorOption.columnSelection)) {
info.columnSelectionMode = true;
}
@@ -1063,12 +1064,13 @@ export class ChangeModeAction extends Action {
@IPreferencesService private readonly preferencesService: IPreferencesService,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ITextFileService private readonly textFileService: ITextFileService,
@ICommandService private readonly commandService: ICommandService
@ICommandService private readonly commandService: ICommandService,
@ITelemetryService private readonly telemetryService: ITelemetryService
) {
super(actionId, actionLabel);
}
async run(): Promise<void> {
async run(event: any, data: ITelemetryData): Promise<void> {
const activeEditorPane = this.editorService.activeEditorPane as unknown as { isNotebookEditor?: boolean } | undefined;
if (activeEditorPane?.isNotebookEditor) { // TODO@rebornix TODO@jrieken debt: https://github.com/microsoft/vscode/issues/114554
// it's inside notebook editor
@@ -1198,6 +1200,10 @@ export class ChangeModeAction extends Action {
}
activeTextEditorControl.focus();
this.telemetryService.publicLog2<WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification>('workbenchActionExecuted', {
id: ChangeModeAction.ID,
from: data?.from || 'quick open'
});
}
}

View File

@@ -67,7 +67,7 @@ export class EditorsObserver extends Disposable {
private registerListeners(): void {
this._register(this.storageService.onWillSaveState(() => this.saveState()));
this._register(this.editorGroupsService.onDidAddGroup(group => this.onGroupAdded(group)));
this._register(this.editorGroupsService.onDidEditorPartOptionsChange(e => this.onDidEditorPartOptionsChange(e)));
this._register(this.editorGroupsService.onDidChangeEditorPartOptions(e => this.onDidChangeEditorPartOptions(e)));
this.editorGroupsService.whenRestored.then(() => this.loadState());
}
@@ -142,7 +142,7 @@ export class EditorsObserver extends Disposable {
Event.once(group.onWillDispose)(() => dispose(groupDisposables));
}
private onDidEditorPartOptionsChange(event: IEditorPartOptionsChangeEvent): void {
private onDidChangeEditorPartOptions(event: IEditorPartOptionsChangeEvent): void {
if (!equals(event.newPartOptions.limit, event.oldPartOptions.limit)) {
const activeGroup = this.editorGroupsService.activeGroup;
let exclude: IEditorIdentifier | undefined = undefined;

View File

@@ -245,7 +245,7 @@
position: relative;
}
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink > .tab-label::after {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink > .tab-label > .monaco-icon-label-container::after {
content: ''; /* enables a linear gradient to overlay the end of the label when tabs overflow */
position: absolute;
right: 0;
@@ -258,10 +258,14 @@
height: calc(100% - 2px);
}
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink:focus > .tab-label::after {
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink:focus > .tab-label > .monaco-icon-label-container::after {
opacity: 0; /* when tab has the focus this shade breaks the tab border (fixes https://github.com/microsoft/vscode/issues/57819) */
}
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sizing-shrink > .tab-label.tab-label-has-badge::after {
padding-right: 5px; /* with tab sizing shrink and badges, we want a right-padding because the close button is hidden */
}
.monaco-workbench .part.editor > .content .editor-group-container > .title .tabs-container > .tab.sticky-compact:not(.has-icon) .monaco-icon-label {
text-align: center; /* ensure that sticky-compact tabs without icon have label centered */
}

View File

@@ -14,8 +14,9 @@ import { IAction } from 'vs/base/common/actions';
import { CLOSE_EDITOR_COMMAND_ID } from 'vs/workbench/browser/parts/editor/editorCommands';
import { Color } from 'vs/base/common/color';
import { withNullAsUndefined, assertIsDefined, assertAllDefined } from 'vs/base/common/types';
import { IEditorGroupTitleDimensions } from 'vs/workbench/browser/parts/editor/editor';
import { IEditorGroupTitleHeight } from 'vs/workbench/browser/parts/editor/editor';
import { equals } from 'vs/base/common/objects';
import { toDisposable } from 'vs/base/common/lifecycle';
interface IRenderedEditorLabel {
editor?: IEditorInput;
@@ -51,7 +52,7 @@ export class NoTabsTitleControl extends TitleControl {
// Breadcrumbs
this.createBreadcrumbsControl(labelContainer, { showFileIcons: false, showSymbolIcons: true, showDecorationColors: false, breadcrumbsBackground: () => Color.transparent });
titleContainer.classList.toggle('breadcrumbs', Boolean(this.breadcrumbsControl));
this._register({ dispose: () => titleContainer.classList.remove('breadcrumbs') }); // important to remove because the container is a shared dom node
this._register(toDisposable(() => titleContainer.classList.remove('breadcrumbs'))); // important to remove because the container is a shared dom node
// Right Actions Container
const actionsContainer = document.createElement('div');
@@ -200,8 +201,8 @@ export class NoTabsTitleControl extends TitleControl {
protected handleBreadcrumbsEnablementChange(): void {
const titleContainer = assertIsDefined(this.titleContainer);
titleContainer.classList.toggle('breadcrumbs', Boolean(this.breadcrumbsControl));
this.redraw();
}
@@ -332,18 +333,16 @@ export class NoTabsTitleControl extends TitleControl {
return { primaryEditorActions: editorActions.primary.filter(action => action.id === CLOSE_EDITOR_COMMAND_ID), secondaryEditorActions: [] };
}
getDimensions(): IEditorGroupTitleDimensions {
getHeight(): IEditorGroupTitleHeight {
return {
height: NoTabsTitleControl.HEIGHT,
total: NoTabsTitleControl.HEIGHT,
offset: 0
};
}
layout(dimensions: ITitleControlDimensions): Dimension {
if (this.breadcrumbsControl) {
this.breadcrumbsControl.layout(undefined);
}
this.breadcrumbsControl?.layout(undefined);
return new Dimension(dimensions.container.width, this.getDimensions().height);
return new Dimension(dimensions.container.width, this.getHeight().total);
}
}

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as DOM from 'vs/base/browser/dom';
import { Dimension, $, clearNode } from 'vs/base/browser/dom';
import { Registry } from 'vs/platform/registry/common/platform';
import { EditorInput, EditorOptions, SideBySideEditorInput, IEditorControl, IEditorPane, IEditorOpenContext } from 'vs/workbench/common/editor';
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
@@ -51,12 +51,12 @@ export class SideBySideEditor extends EditorPane {
private secondaryEditorContainer: HTMLElement | undefined;
private splitview: SplitView | undefined;
private dimension: DOM.Dimension = new DOM.Dimension(0, 0);
private dimension: Dimension = new Dimension(0, 0);
private onDidCreateEditors = this._register(new Emitter<{ width: number; height: number; } | undefined>());
private _onDidSizeConstraintsChange = this._register(new Relay<{ width: number; height: number; } | undefined>());
readonly onDidSizeConstraintsChange = Event.any(this.onDidCreateEditors.event, this._onDidSizeConstraintsChange.event);
private _onDidChangeSizeConstraints = this._register(new Relay<{ width: number; height: number; } | undefined>());
readonly onDidChangeSizeConstraints = Event.any(this.onDidCreateEditors.event, this._onDidChangeSizeConstraints.event);
constructor(
@ITelemetryService telemetryService: ITelemetryService,
@@ -73,19 +73,19 @@ export class SideBySideEditor extends EditorPane {
const splitview = this.splitview = this._register(new SplitView(parent, { orientation: Orientation.HORIZONTAL }));
this._register(this.splitview.onDidSashReset(() => splitview.distributeViewSizes()));
this.secondaryEditorContainer = DOM.$('.secondary-editor-container');
this.secondaryEditorContainer = $('.secondary-editor-container');
this.splitview.addView({
element: this.secondaryEditorContainer,
layout: size => this.secondaryEditorPane && this.secondaryEditorPane.layout(new DOM.Dimension(size, this.dimension.height)),
layout: size => this.secondaryEditorPane?.layout(new Dimension(size, this.dimension.height)),
minimumSize: 220,
maximumSize: Number.POSITIVE_INFINITY,
onDidChange: Event.None
}, Sizing.Distribute);
this.primaryEditorContainer = DOM.$('.primary-editor-container');
this.primaryEditorContainer = $('.primary-editor-container');
this.splitview.addView({
element: this.primaryEditorContainer,
layout: size => this.primaryEditorPane && this.primaryEditorPane.layout(new DOM.Dimension(size, this.dimension.height)),
layout: size => this.primaryEditorPane?.layout(new Dimension(size, this.dimension.height)),
minimumSize: 220,
maximumSize: Number.POSITIVE_INFINITY,
onDidChange: Event.None
@@ -139,7 +139,7 @@ export class SideBySideEditor extends EditorPane {
}
}
layout(dimension: DOM.Dimension): void {
layout(dimension: Dimension): void {
this.dimension = dimension;
const splitview = assertIsDefined(this.splitview);
@@ -205,9 +205,9 @@ export class SideBySideEditor extends EditorPane {
this.secondaryEditorPane = secondary;
this.primaryEditorPane = primary;
this._onDidSizeConstraintsChange.input = Event.any(
Event.map(secondary.onDidSizeConstraintsChange, () => undefined),
Event.map(primary.onDidSizeConstraintsChange, () => undefined)
this._onDidChangeSizeConstraints.input = Event.any(
Event.map(secondary.onDidChangeSizeConstraints, () => undefined),
Event.map(primary.onDidChangeSizeConstraints, () => undefined)
);
this.onDidCreateEditors.fire(undefined);
@@ -238,11 +238,11 @@ export class SideBySideEditor extends EditorPane {
}
if (this.secondaryEditorContainer) {
DOM.clearNode(this.secondaryEditorContainer);
clearNode(this.secondaryEditorContainer);
}
if (this.primaryEditorContainer) {
DOM.clearNode(this.primaryEditorContainer);
clearNode(this.primaryEditorContainer);
}
}

View File

@@ -33,7 +33,7 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { MergeGroupMode, IMergeGroupOptions, GroupsArrangement, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { addDisposableListener, EventType, EventHelper, Dimension, scheduleAtNextAnimationFrame, findParentWithClass, clearNode } from 'vs/base/browser/dom';
import { localize } from 'vs/nls';
import { IEditorGroupsAccessor, IEditorGroupView, EditorServiceImpl, IEditorGroupTitleDimensions } from 'vs/workbench/browser/parts/editor/editor';
import { IEditorGroupsAccessor, IEditorGroupView, EditorServiceImpl, IEditorGroupTitleHeight } from 'vs/workbench/browser/parts/editor/editor';
import { CloseOneEditorAction, UnpinEditorAction } from 'vs/workbench/browser/parts/editor/editorActions';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { BreadcrumbsControl } from 'vs/workbench/browser/parts/editor/breadcrumbsControl';
@@ -44,7 +44,7 @@ import { basenameOrAuthority } from 'vs/base/common/resources';
import { RunOnceScheduler } from 'vs/base/common/async';
import { IPathService } from 'vs/workbench/services/path/common/pathService';
import { IPath, win32, posix } from 'vs/base/common/path';
import { insert } from 'vs/base/common/arrays';
import { coalesce, insert } from 'vs/base/common/arrays';
import { ColorScheme } from 'vs/platform/theme/common/theme';
import { isSafari } from 'vs/base/browser/browser';
import { equals } from 'vs/base/common/objects';
@@ -199,16 +199,6 @@ export class TabsTitleControl extends TitleControl {
return TabsTitleControl.SCROLLBAR_SIZES.large;
}
private updateBreadcrumbsControl(): void {
if (this.breadcrumbsControl && this.breadcrumbsControl.update()) {
this.group.relayout(); // relayout when we have a breadcrumbs and when update changed its hidden-status
}
}
protected handleBreadcrumbsEnablementChange(): void {
this.group.relayout(); // relayout when breadcrumbs are enable/disabled
}
private registerTabsContainerListeners(tabsContainer: HTMLElement, tabsScrollbar: ScrollableElement): void {
// Group dragging
@@ -411,7 +401,7 @@ export class TabsTitleControl extends TitleControl {
this.redraw();
// Update Breadcrumbs
this.updateBreadcrumbsControl();
this.breadcrumbsControl?.update();
}
closeEditor(editor: IEditorInput): void {
@@ -419,9 +409,13 @@ export class TabsTitleControl extends TitleControl {
}
closeEditors(editors: IEditorInput[]): void {
// Cleanup closed editors
this.handleClosedEditors();
// Update Breadcrumbs when last editor closed
if (this.group.count === 0) {
this.updateBreadcrumbsControl();
this.breadcrumbsControl?.update();
}
}
@@ -509,8 +503,8 @@ export class TabsTitleControl extends TitleControl {
setActive(isGroupActive: boolean): void {
// Activity has an impact on each tab's active indication
this.forEachTab((editor, index, tabContainer, tabLabelWidget, tabLabel) => {
this.redrawTabActiveAndDirty(isGroupActive, editor, tabContainer, tabLabelWidget);
this.forEachTab((editor, index, tabContainer, tabLabelWidget, tabLabel, tabActionBar) => {
this.redrawTabActiveAndDirty(isGroupActive, editor, tabContainer, tabActionBar);
});
// Activity has an impact on the toolbar, so we need to update and layout
@@ -545,7 +539,7 @@ export class TabsTitleControl extends TitleControl {
}
updateEditorDirty(editor: IEditorInput): void {
this.withTab(editor, (editor, index, tabContainer, tabLabelWidget) => this.redrawTabActiveAndDirty(this.accessor.activeGroup === this.group, editor, tabContainer, tabLabelWidget));
this.withTab(editor, (editor, index, tabContainer, tabLabelWidget, tabLabel, tabActionBar) => this.redrawTabActiveAndDirty(this.accessor.activeGroup === this.group, editor, tabContainer, tabActionBar));
}
updateOptions(oldOptions: IEditorPartOptions, newOptions: IEditorPartOptions): void {
@@ -606,7 +600,6 @@ export class TabsTitleControl extends TitleControl {
// Tab Container
const tabContainer = document.createElement('div');
tabContainer.draggable = true;
tabContainer.tabIndex = 0;
tabContainer.setAttribute('role', 'tab');
tabContainer.classList.add('tab');
@@ -1120,7 +1113,7 @@ export class TabsTitleControl extends TitleControl {
this.redrawTabBorders(index, tabContainer);
// Active / dirty state
this.redrawTabActiveAndDirty(this.accessor.activeGroup === this.group, editor, tabContainer, tabLabelWidget);
this.redrawTabActiveAndDirty(this.accessor.activeGroup === this.group, editor, tabContainer, tabActionBar);
}
private redrawTabLabel(editor: IEditorInput, index: number, tabContainer: HTMLElement, tabLabelWidget: IResourceLabel, tabLabel: IEditorInputLabel): void {
@@ -1131,14 +1124,14 @@ export class TabsTitleControl extends TitleControl {
// or their first character of the name otherwise
let name: string | undefined;
let forceLabel = false;
let forceDisableBadgeDecorations = false;
let fileDecorationBadges = Boolean(options.decorations?.badges);
let description: string;
if (options.pinnedTabSizing === 'compact' && this.group.isSticky(index)) {
const isShowingIcons = options.showIcons && options.hasIcons;
name = isShowingIcons ? '' : tabLabel.name?.charAt(0).toUpperCase();
description = '';
forceLabel = true;
forceDisableBadgeDecorations = true; // not enough space when sticky tabs are compact
fileDecorationBadges = false; // not enough space when sticky tabs are compact
} else {
name = tabLabel.name;
description = tabLabel.description || '';
@@ -1159,12 +1152,12 @@ export class TabsTitleControl extends TitleControl {
{ name, description, resource: EditorResourceAccessor.getOriginalUri(editor, { supportSideBySide: SideBySideEditor.BOTH }) },
{
title,
extraClasses: ['tab-label'],
extraClasses: coalesce(['tab-label', fileDecorationBadges ? 'tab-label-has-badge' : undefined]),
italic: !this.group.isPinned(editor),
forceLabel,
fileDecorations: {
colors: Boolean(options.decorations?.colors),
badges: forceDisableBadgeDecorations ? false : Boolean(options.decorations?.badges)
badges: fileDecorationBadges
}
}
);
@@ -1178,15 +1171,15 @@ export class TabsTitleControl extends TitleControl {
}
}
private redrawTabActiveAndDirty(isGroupActive: boolean, editor: IEditorInput, tabContainer: HTMLElement, tabLabelWidget: IResourceLabel): void {
private redrawTabActiveAndDirty(isGroupActive: boolean, editor: IEditorInput, tabContainer: HTMLElement, tabActionBar: ActionBar): void {
const isTabActive = this.group.isActive(editor);
const hasModifiedBorderTop = this.doRedrawTabDirty(isGroupActive, isTabActive, editor, tabContainer);
this.doRedrawTabActive(isGroupActive, !hasModifiedBorderTop, editor, tabContainer, tabLabelWidget);
this.doRedrawTabActive(isGroupActive, !hasModifiedBorderTop, editor, tabContainer, tabActionBar);
}
private doRedrawTabActive(isGroupActive: boolean, allowBorderTop: boolean, editor: IEditorInput, tabContainer: HTMLElement, tabLabelWidget: IResourceLabel): void {
private doRedrawTabActive(isGroupActive: boolean, allowBorderTop: boolean, editor: IEditorInput, tabContainer: HTMLElement, tabActionBar: ActionBar): void {
// Tab is active
if (this.group.isActive(editor)) {
@@ -1194,6 +1187,7 @@ export class TabsTitleControl extends TitleControl {
// Container
tabContainer.classList.add('active');
tabContainer.setAttribute('aria-selected', 'true');
tabContainer.tabIndex = 0; // Only active tab can be focused into
tabContainer.style.backgroundColor = this.getColor(isGroupActive ? TAB_ACTIVE_BACKGROUND : TAB_UNFOCUSED_ACTIVE_BACKGROUND) || '';
const activeTabBorderColorBottom = this.getColor(isGroupActive ? TAB_ACTIVE_BORDER : TAB_UNFOCUSED_ACTIVE_BORDER);
@@ -1216,6 +1210,9 @@ export class TabsTitleControl extends TitleControl {
// Label
tabContainer.style.color = this.getColor(isGroupActive ? TAB_ACTIVE_FOREGROUND : TAB_UNFOCUSED_ACTIVE_FOREGROUND) || '';
// Actions
tabActionBar.setFocusable(true);
}
// Tab is inactive
@@ -1224,11 +1221,15 @@ export class TabsTitleControl extends TitleControl {
// Container
tabContainer.classList.remove('active');
tabContainer.setAttribute('aria-selected', 'false');
tabContainer.tabIndex = -1; // Only active tab can be focused into
tabContainer.style.backgroundColor = this.getColor(isGroupActive ? TAB_INACTIVE_BACKGROUND : TAB_UNFOCUSED_INACTIVE_BACKGROUND) || '';
tabContainer.style.boxShadow = '';
// Label
tabContainer.style.color = this.getColor(isGroupActive ? TAB_INACTIVE_FOREGROUND : TAB_UNFOCUSED_INACTIVE_FOREGROUND) || '';
// Actions
tabActionBar.setFocusable(false);
}
}
@@ -1283,25 +1284,42 @@ export class TabsTitleControl extends TitleControl {
tabContainer.style.outlineColor = this.getColor(activeContrastBorder) || '';
}
getDimensions(): IEditorGroupTitleDimensions {
let height: number;
getHeight(): IEditorGroupTitleHeight {
const showsBreadcrumbs = this.breadcrumbsControl && !this.breadcrumbsControl.isHidden();
// Return quickly if our used dimensions are known
if (this.dimensions.used) {
return {
total: this.dimensions.used.height,
offset: showsBreadcrumbs ? this.dimensions.used.height - BreadcrumbsControl.HEIGHT : this.dimensions.used.height
};
}
// Otherwise compute via browser APIs
else {
return this.computeHeight();
}
}
private computeHeight(): IEditorGroupTitleHeight {
let total: number;
// Wrap: we need to ask `offsetHeight` to get
// the real height of the title area with wrapping.
if (this.accessor.partOptions.wrapTabs && this.tabsAndActionsContainer?.classList.contains('wrapping')) {
height = this.tabsAndActionsContainer.offsetHeight;
total = this.tabsAndActionsContainer.offsetHeight;
} else {
height = TabsTitleControl.TAB_HEIGHT;
total = TabsTitleControl.TAB_HEIGHT;
}
const offset = height;
const offset = total;
// Account for breadcrumbs if visible
if (this.breadcrumbsControl && !this.breadcrumbsControl.isHidden()) {
height += BreadcrumbsControl.HEIGHT; // Account for breadcrumbs if visible
total += BreadcrumbsControl.HEIGHT; // Account for breadcrumbs if visible
}
return { height, offset };
return { total, offset };
}
layout(dimensions: ITitleControlDimensions): Dimension {
@@ -1322,7 +1340,7 @@ export class TabsTitleControl extends TitleControl {
// First time layout: compute the dimensions and store it
if (!this.dimensions.used) {
this.dimensions.used = new Dimension(dimensions.container.width, this.getDimensions().height);
this.dimensions.used = new Dimension(dimensions.container.width, this.computeHeight().total);
}
return this.dimensions.used;
@@ -1346,7 +1364,7 @@ export class TabsTitleControl extends TitleControl {
// return it fast from the `layout` call without having to
// compute it over and over again
const oldDimension = this.dimensions.used;
const newDimension = this.dimensions.used = new Dimension(dimensions.container.width, this.getDimensions().height);
const newDimension = this.dimensions.used = new Dimension(dimensions.container.width, this.computeHeight().total);
// In case the height of the title control changed from before
// (currently only possible if wrapping changed on/off), we need
@@ -1357,6 +1375,10 @@ export class TabsTitleControl extends TitleControl {
}
}
protected handleBreadcrumbsEnablementChange(): void {
this.group.relayout(); // relayout when breadcrumbs are enable/disabled
}
private doLayoutBreadcrumbs(dimensions: ITitleControlDimensions): void {
if (this.breadcrumbsControl && !this.breadcrumbsControl.isHidden()) {
this.breadcrumbsControl.layout(new Dimension(dimensions.container.width, BreadcrumbsControl.HEIGHT));
@@ -1408,7 +1430,14 @@ export class TabsTitleControl extends TitleControl {
return true; // no tab always fits
}
return lastTab.offsetWidth <= (dimensions.available.width - editorToolbarContainer.offsetWidth);
const lastTabOverlapWithToolbarWidth = lastTab.offsetWidth + editorToolbarContainer.offsetWidth - dimensions.available.width;
if (lastTabOverlapWithToolbarWidth > 1) {
// Allow for slight rounding errors related to zooming here
// https://github.com/microsoft/vscode/issues/116385
return false;
}
return true;
};
// If tabs wrap or should start to wrap (when width exceeds visible width)
@@ -1846,11 +1875,11 @@ registerThemingParticipant((theme, collector) => {
// Adjust gradient for focused and unfocused hover background
const makeTabHoverBackgroundRule = (color: Color, colorDrag: Color, hasFocus = false) => `
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${hasFocus ? '.active' : ''} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label::after {
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${hasFocus ? '.active' : ''} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
background: linear-gradient(to left, ${color}, transparent) !important;
}
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${hasFocus ? '.active' : ''} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label::after {
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${hasFocus ? '.active' : ''} > .title .tabs-container > .tab.sizing-shrink:not(.dragged):not(.sticky-compact):hover > .tab-label > .monaco-icon-label-container::after {
background: linear-gradient(to left, ${colorDrag}, transparent) !important;
}
`;
@@ -1873,19 +1902,19 @@ registerThemingParticipant((theme, collector) => {
if (editorDragAndDropBackground && adjustedTabDragBackground) {
const adjustedColorDrag = editorDragAndDropBackground.flatten(adjustedTabDragBackground);
collector.addRule(`
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.active):not(.dragged):not(.sticky-compact) > .tab-label::after,
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.dragged):not(.sticky-compact) > .tab-label::after {
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container.active > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.active):not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after,
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container:not(.active) > .title .tabs-container > .tab.sizing-shrink.dragged-over:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
background: linear-gradient(to left, ${adjustedColorDrag}, transparent) !important;
}
`);
}
const makeTabBackgroundRule = (color: Color, colorDrag: Color, focused: boolean, active: boolean) => `
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${focused ? '.active' : ':not(.active)'} > .title .tabs-container > .tab.sizing-shrink${active ? '.active' : ''}:not(.dragged):not(.sticky-compact) > .tab-label::after {
.monaco-workbench .part.editor > .content:not(.dragged-over) .editor-group-container${focused ? '.active' : ':not(.active)'} > .title .tabs-container > .tab.sizing-shrink${active ? '.active' : ''}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
background: linear-gradient(to left, ${color}, transparent);
}
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${focused ? '.active' : ':not(.active)'} > .title .tabs-container > .tab.sizing-shrink${active ? '.active' : ''}:not(.dragged):not(.sticky-compact) > .tab-label::after {
.monaco-workbench .part.editor > .content.dragged-over .editor-group-container${focused ? '.active' : ':not(.active)'} > .title .tabs-container > .tab.sizing-shrink${active ? '.active' : ''}:not(.dragged):not(.sticky-compact) > .tab-label > .monaco-icon-label-container::after {
background: linear-gradient(to left, ${colorDrag}, transparent);
}
`;

View File

@@ -3,8 +3,8 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import * as objects from 'vs/base/common/objects';
import { localize } from 'vs/nls';
import { deepClone } from 'vs/base/common/objects';
import { isFunction, isObject, isArray, assertIsDefined, withUndefinedAsNull } from 'vs/base/common/types';
import { IDiffEditor } from 'vs/editor/browser/editorBrowser';
import { IDiffEditorOptions, IEditorOptions as ICodeEditorOptions } from 'vs/editor/common/config/editorOptions';
@@ -99,7 +99,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
return this.input.getName();
}
return nls.localize('textDiffEditor', "Text Diff Editor");
return localize('textDiffEditor', "Text Diff Editor");
}
createEditorControl(parent: HTMLElement, configuration: ICodeEditorOptions): IDiffEditor {
@@ -236,7 +236,7 @@ export class TextDiffEditor extends BaseTextEditor implements ITextDiffEditorPan
// Handle diff editor specially by merging in diffEditor configuration
if (isObject(configuration.diffEditor)) {
const diffEditorConfiguration = <IDiffEditorOptions>objects.deepClone(configuration.diffEditor);
const diffEditorConfiguration: IDiffEditorOptions = deepClone(configuration.diffEditor);
// User settings defines `diffEditor.codeLens`, but here we rename that to `diffEditor.diffCodeLens` to avoid collisions with `editor.codeLens`.
diffEditorConfiguration.diffCodeLens = diffEditorConfiguration.codeLens;

View File

@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { assertIsDefined, isFunction, withNullAsUndefined } from 'vs/base/common/types';
import { ICodeEditor, getCodeEditor, IPasteEvent } from 'vs/editor/browser/editorBrowser';
import { TextEditorOptions, EditorInput, EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
@@ -50,7 +50,7 @@ export class AbstractTextResourceEditor extends BaseTextEditor {
return this.input.getName();
}
return nls.localize('textEditor', "Text Editor");
return localize('textEditor', "Text Editor");
}
async setInput(input: EditorInput, options: EditorOptions | undefined, context: IEditorOpenContext, token: CancellationToken): Promise<void> {

View File

@@ -7,9 +7,9 @@ import 'vs/css!./media/titlecontrol';
import { applyDragImage, DataTransfers } from 'vs/base/browser/dnd';
import { addDisposableListener, Dimension, EventType } from 'vs/base/browser/dom';
import { StandardMouseEvent } from 'vs/base/browser/mouseEvent';
import { ActionsOrientation, prepareActions } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionsOrientation, IActionViewItem, prepareActions } from 'vs/base/browser/ui/actionbar/actionbar';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { IAction, WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification, IActionViewItem } from 'vs/base/common/actions';
import { IAction, WorkbenchActionExecutedEvent, WorkbenchActionExecutedClassification, SubmenuAction } from 'vs/base/common/actions';
import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
import { dispose, DisposableStore } from 'vs/base/common/lifecycle';
import { isCodeEditor } from 'vs/editor/browser/editorBrowser';
@@ -30,7 +30,7 @@ import { DraggedEditorGroupIdentifier, DraggedEditorIdentifier, fillResourceData
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
import { BreadcrumbsConfig } from 'vs/workbench/browser/parts/editor/breadcrumbs';
import { BreadcrumbsControl, IBreadcrumbsControlOptions } from 'vs/workbench/browser/parts/editor/breadcrumbsControl';
import { IEditorGroupsAccessor, IEditorGroupTitleDimensions, IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
import { IEditorGroupsAccessor, IEditorGroupTitleHeight, IEditorGroupView } from 'vs/workbench/browser/parts/editor/editor';
import { EditorCommandsContextActionRunner, IEditorCommandsContext, IEditorInput, EditorResourceAccessor, IEditorPartOptions, SideBySideEditor, ActiveEditorPinnedContext, ActiveEditorStickyContext } from 'vs/workbench/common/editor';
import { ResourceContextKey } from 'vs/workbench/common/resources';
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
@@ -124,7 +124,7 @@ export abstract class TitleControl extends Themable {
}
this._register(this.fileService.onDidChangeFileSystemProviderRegistrations(() => {
if (this.breadcrumbsControl && this.breadcrumbsControl.update()) {
if (this.breadcrumbsControl?.update()) {
this.handleBreadcrumbsEnablementChange();
}
}));
@@ -218,13 +218,19 @@ export abstract class TitleControl extends Themable {
const activeEditorPane = this.group.activeEditorPane;
if (activeEditorPane instanceof EditorPane) {
const scopedContextKeyService = activeEditorPane.scopedContextKeyService ?? this.contextKeyService;
const titleBarMenu = this.menuService.createMenu(MenuId.EditorTitle, scopedContextKeyService);
const titleBarMenu = this.menuService.createMenu(MenuId.EditorTitle, scopedContextKeyService, true);
this.editorToolBarMenuDisposables.add(titleBarMenu);
this.editorToolBarMenuDisposables.add(titleBarMenu.onDidChange(() => {
this.updateEditorActionsToolbar(); // Update editor toolbar whenever contributed actions change
}));
this.editorToolBarMenuDisposables.add(createAndFillInActionBarActions(titleBarMenu, { arg: this.resourceContext.get(), shouldForwardArgs: true }, { primary, secondary }, (group: string) => group === 'navigation' || group === '1_run'));
const isPrimaryGroup = (group: string) => group === 'navigation' || group === '1_run';
const shouldInlineGroup = (action: SubmenuAction, group: string) => isPrimaryGroup(group) && action.actions.length <= 1;
this.editorToolBarMenuDisposables.add(createAndFillInActionBarActions(
titleBarMenu, { arg: this.resourceContext.get(), shouldForwardArgs: true }, { primary, secondary },
isPrimaryGroup, 9, shouldInlineGroup
));
}
return { primary, secondary };
@@ -384,7 +390,7 @@ export abstract class TitleControl extends Themable {
abstract layout(dimensions: ITitleControlDimensions): Dimension;
abstract getDimensions(): IEditorGroupTitleDimensions;
abstract getHeight(): IEditorGroupTitleHeight;
dispose(): void {
dispose(this.breadcrumbsControl);

View File

@@ -0,0 +1,176 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as dom from 'vs/base/browser/dom';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition } from 'vs/editor/browser/editorBrowser';
import { localize } from 'vs/nls';
import { DEFAULT_FONT_FAMILY } from 'vs/workbench/browser/style';
import { IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { inputPlaceholderForeground } from 'vs/platform/theme/common/colorRegistry';
import { ChangeModeAction } from 'vs/workbench/browser/parts/editor/editorStatus';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { PLAINTEXT_MODE_ID } from 'vs/editor/common/modes/modesRegistry';
import { IEditorContribution } from 'vs/editor/common/editorCommon';
import { Schemas } from 'vs/base/common/network';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { FloatingClickWidget } from 'vs/workbench/browser/codeeditor';
const $ = dom.$;
const untitledHintSetting = 'workbench.editor.untitled.hint';
export class UntitledHintContribution implements IEditorContribution {
public static readonly ID = 'editor.contrib.untitledHint';
private toDispose: IDisposable[];
private untitledHintContentWidget: UntitledHintContentWidget | undefined;
private button: FloatingClickWidget | undefined;
constructor(
private editor: ICodeEditor,
@ICommandService private readonly commandService: ICommandService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IKeybindingService private readonly keybindingService: IKeybindingService,
@IThemeService private readonly themeService: IThemeService
) {
this.toDispose = [];
this.toDispose.push(this.editor.onDidChangeModel(() => this.update()));
this.toDispose.push(this.editor.onDidChangeModelLanguage(() => this.update()));
this.toDispose.push(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectsConfiguration(untitledHintSetting)) {
this.update();
}
}));
this.update();
}
private update(): void {
this.untitledHintContentWidget?.dispose();
this.button?.dispose();
const untitledHintMode = this.configurationService.getValue(untitledHintSetting);
const model = this.editor.getModel();
if (model && model.uri.scheme === Schemas.untitled && model.getModeId() === PLAINTEXT_MODE_ID) {
if (untitledHintMode === 'text') {
this.untitledHintContentWidget = new UntitledHintContentWidget(this.editor, this.commandService, this.configurationService, this.keybindingService);
}
if (untitledHintMode === 'button') {
this.button = new FloatingClickWidget(this.editor, localize('selectALanguage', "Select a Language"), ChangeModeAction.ID, this.keybindingService, this.themeService);
this.toDispose.push(this.button.onClick(async () => {
// Need to focus editor before so current editor becomes active and the command is properly executed
this.editor.focus();
await this.commandService.executeCommand(ChangeModeAction.ID, { from: 'button' });
this.editor.focus();
}));
this.button.render();
}
}
}
dispose(): void {
dispose(this.toDispose);
this.untitledHintContentWidget?.dispose();
}
}
class UntitledHintContentWidget implements IContentWidget {
private static readonly ID = 'editor.widget.untitledHint';
private domNode: HTMLElement | undefined;
private toDispose: IDisposable[];
constructor(
private readonly editor: ICodeEditor,
private readonly commandService: ICommandService,
private readonly configurationService: IConfigurationService,
private readonly keybindingService: IKeybindingService
) {
this.toDispose = [];
this.toDispose.push(editor.onDidChangeModelContent(() => this.onDidChangeModelContent()));
this.onDidChangeModelContent();
}
private onDidChangeModelContent(): void {
if (this.editor.getValue() === '') {
this.editor.addContentWidget(this);
} else {
this.editor.removeContentWidget(this);
}
}
getId(): string {
return UntitledHintContentWidget.ID;
}
// Select a language to get started. Start typing to dismiss, or don't show this again.
getDomNode(): HTMLElement {
if (!this.domNode) {
this.domNode = $('.untitled-hint');
this.domNode.style.width = 'max-content';
const language = $('span.language-mode.detected-link-active');
const keybinding = this.keybindingService.lookupKeybinding(ChangeModeAction.ID);
const keybindingLabel = keybinding?.getLabel();
const keybindingWithBrackets = keybindingLabel ? `(${keybindingLabel})` : '';
language.innerText = localize('selectAlanguage', "Select a language {0}", keybindingWithBrackets);
this.domNode.appendChild(language);
const toGetStarted = $('span');
toGetStarted.innerText = localize('toGetStarted', " to get started. Start typing to dismiss, or ",);
this.domNode.appendChild(toGetStarted);
const dontShow = $('span.detected-link-active');
dontShow.innerText = localize('dontshow', "don't show");
this.domNode.appendChild(dontShow);
const thisAgain = $('span');
thisAgain.innerText = localize('thisAgain', " this again.");
this.domNode.appendChild(thisAgain);
this.toDispose.push(dom.addDisposableListener(language, 'click', async e => {
e.stopPropagation();
// Need to focus editor before so current editor becomes active and the command is properly executed
this.editor.focus();
await this.commandService.executeCommand(ChangeModeAction.ID, { from: 'hint' });
this.editor.focus();
}));
this.toDispose.push(dom.addDisposableListener(dontShow, 'click', () => {
this.configurationService.updateValue(untitledHintSetting, 'hidden');
this.dispose();
this.editor.focus();
}));
this.toDispose.push(dom.addDisposableListener(this.domNode, 'click', () => {
this.editor.focus();
}));
this.domNode.style.fontFamily = DEFAULT_FONT_FAMILY;
this.domNode.style.fontStyle = 'italic';
this.domNode.style.paddingLeft = '4px';
}
return this.domNode;
}
getPosition(): IContentWidgetPosition | null {
return {
position: { lineNumber: 1, column: 1 },
preference: [ContentWidgetPositionPreference.EXACT]
};
}
dispose(): void {
this.editor.removeContentWidget(this);
dispose(this.toDispose);
}
}
registerThemingParticipant((theme, collector) => {
const inputPlaceholderForegroundColor = theme.getColor(inputPlaceholderForeground);
if (inputPlaceholderForegroundColor) {
collector.addRule(`.monaco-editor .contentWidgets .untitled-hint { color: ${inputPlaceholderForegroundColor}; }`);
}
});

View File

@@ -59,7 +59,7 @@ export class NotificationsCenter extends Themable implements INotificationsCente
private registerListeners(): void {
this._register(this.model.onDidChangeNotification(e => this.onDidChangeNotification(e)));
this._register(this.layoutService.onLayout(dimension => this.layout(Dimension.lift(dimension))));
this._register(this.layoutService.onDidLayout(dimension => this.layout(Dimension.lift(dimension))));
}
get isVisible(): boolean {

View File

@@ -18,7 +18,7 @@ export const HIDE_NOTIFICATIONS_CENTER = 'notifications.hideList';
const TOGGLE_NOTIFICATIONS_CENTER = 'notifications.toggleList';
// Toasts
const HIDE_NOTIFICATION_TOAST = 'notifications.hideToasts';
export const HIDE_NOTIFICATION_TOAST = 'notifications.hideToasts';
const FOCUS_NOTIFICATION_TOAST = 'notifications.focusToasts';
const FOCUS_NEXT_NOTIFICATION_TOAST = 'notifications.focusNextToast';
const FOCUS_PREVIOUS_NOTIFICATION_TOAST = 'notifications.focusPreviousToast';
@@ -32,9 +32,9 @@ const TOGGLE_NOTIFICATION = 'notification.toggle';
export const CLEAR_NOTIFICATION = 'notification.clear';
export const CLEAR_ALL_NOTIFICATIONS = 'notifications.clearAll';
export const NotificationFocusedContext = new RawContextKey<boolean>('notificationFocus', true);
export const NotificationsCenterVisibleContext = new RawContextKey<boolean>('notificationCenterVisible', false);
export const NotificationsToastsVisibleContext = new RawContextKey<boolean>('notificationToastsVisible', false);
export const NotificationFocusedContext = new RawContextKey<boolean>('notificationFocus', true, localize('notificationFocus', "Whether a notification has keyboard focus"));
export const NotificationsCenterVisibleContext = new RawContextKey<boolean>('notificationCenterVisible', false, localize('notificationCenterVisible', "Whether the notifications center is visible"));
export const NotificationsToastsVisibleContext = new RawContextKey<boolean>('notificationToastsVisible', false, localize('notificationToastsVisible', "Whether a notification toast is visible"));
export interface INotificationsCenterController {
readonly isVisible: boolean;

View File

@@ -91,7 +91,7 @@ export class NotificationsToasts extends Themable implements INotificationsToast
private registerListeners(): void {
// Layout
this._register(this.layoutService.onLayout(dimension => this.layout(Dimension.lift(dimension))));
this._register(this.layoutService.onDidLayout(dimension => this.layout(Dimension.lift(dimension))));
// Delay some tasks until after we can show notifications
this.onCanShowNotifications().then(() => {

View File

@@ -12,7 +12,7 @@ import { ButtonBar } from 'vs/base/browser/ui/button/button';
import { attachButtonStyler, attachProgressBarStyler } from 'vs/platform/theme/common/styler';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionRunner, ActionWithMenuAction, IAction, IActionRunner } from 'vs/base/common/actions';
import { ActionRunner, IAction, IActionRunner } from 'vs/base/common/actions';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { dispose, DisposableStore, Disposable } from 'vs/base/common/lifecycle';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
@@ -457,8 +457,7 @@ export class NotificationTemplateRenderer extends Disposable {
const buttonToolbar = this.inputDisposables.add(new ButtonBar(this.template.buttonsContainer));
for (const action of primaryActions) {
const buttonOptions = { title: true, /* assign titles to buttons in case they overflow */ };
const dropdownActions = action instanceof ChoiceAction ? action.menu
: action instanceof ActionWithMenuAction ? action.actions : undefined;
const dropdownActions = action instanceof ChoiceAction ? action.menu : undefined;
const button = this.inputDisposables.add(
dropdownActions
? buttonToolbar.addButtonWithDropdown({

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/panelpart';
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
import { Action } from 'vs/base/common/actions';
import { Registry } from 'vs/platform/registry/common/platform';
@@ -21,14 +21,14 @@ import { registerIcon } from 'vs/platform/theme/common/iconRegistry';
import { ServicesAccessor } from 'vs/editor/browser/editorExtensions';
import { ViewContainerLocationToString, ViewContainerLocation } from 'vs/workbench/common/views';
const maximizeIcon = registerIcon('panel-maximize', Codicon.chevronUp, nls.localize('maximizeIcon', 'Icon to maximize a panel.'));
const restoreIcon = registerIcon('panel-restore', Codicon.chevronDown, nls.localize('restoreIcon', 'Icon to restore a panel.'));
const closeIcon = registerIcon('panel-close', Codicon.close, nls.localize('closeIcon', 'Icon to close a panel.'));
const maximizeIcon = registerIcon('panel-maximize', Codicon.chevronUp, localize('maximizeIcon', 'Icon to maximize a panel.'));
const restoreIcon = registerIcon('panel-restore', Codicon.chevronDown, localize('restoreIcon', 'Icon to restore a panel.'));
const closeIcon = registerIcon('panel-close', Codicon.close, localize('closeIcon', 'Icon to close a panel.'));
export class TogglePanelAction extends Action {
static readonly ID = 'workbench.action.togglePanel';
static readonly LABEL = nls.localize('togglePanel', "Toggle Panel");
static readonly LABEL = localize('togglePanel', "Toggle Panel");
constructor(
id: string,
@@ -46,7 +46,7 @@ export class TogglePanelAction extends Action {
class FocusPanelAction extends Action {
static readonly ID = 'workbench.action.focusPanel';
static readonly LABEL = nls.localize('focusPanel', "Focus into Panel");
static readonly LABEL = localize('focusPanel', "Focus into Panel");
constructor(
id: string,
@@ -97,9 +97,9 @@ function createPositionPanelActionConfig(id: string, alias: string, label: strin
}
export const PositionPanelActionConfigs: PanelActionConfig<Position>[] = [
createPositionPanelActionConfig(PositionPanelActionId.LEFT, 'View: Move Panel Left', nls.localize('positionPanelLeft', 'Move Panel Left'), Position.LEFT),
createPositionPanelActionConfig(PositionPanelActionId.RIGHT, 'View: Move Panel Right', nls.localize('positionPanelRight', 'Move Panel Right'), Position.RIGHT),
createPositionPanelActionConfig(PositionPanelActionId.BOTTOM, 'View: Move Panel To Bottom', nls.localize('positionPanelBottom', 'Move Panel To Bottom'), Position.BOTTOM),
createPositionPanelActionConfig(PositionPanelActionId.LEFT, 'View: Move Panel Left', localize('positionPanelLeft', 'Move Panel Left'), Position.LEFT),
createPositionPanelActionConfig(PositionPanelActionId.RIGHT, 'View: Move Panel Right', localize('positionPanelRight', 'Move Panel Right'), Position.RIGHT),
createPositionPanelActionConfig(PositionPanelActionId.BOTTOM, 'View: Move Panel To Bottom', localize('positionPanelBottom', 'Move Panel To Bottom'), Position.BOTTOM),
];
const positionByActionId = new Map(PositionPanelActionConfigs.map(config => [config.id, config.value]));
@@ -191,7 +191,7 @@ export class SwitchPanelViewAction extends Action {
export class PreviousPanelViewAction extends SwitchPanelViewAction {
static readonly ID = 'workbench.action.previousPanelView';
static readonly LABEL = nls.localize('previousPanelView', 'Previous Panel View');
static readonly LABEL = localize('previousPanelView', 'Previous Panel View');
constructor(
id: string,
@@ -209,7 +209,7 @@ export class PreviousPanelViewAction extends SwitchPanelViewAction {
export class NextPanelViewAction extends SwitchPanelViewAction {
static readonly ID = 'workbench.action.nextPanelView';
static readonly LABEL = nls.localize('nextPanelView', 'Next Panel View');
static readonly LABEL = localize('nextPanelView', 'Next Panel View');
constructor(
id: string,
@@ -234,12 +234,12 @@ registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.toggleMaximizedPanel',
title: { value: nls.localize('toggleMaximizedPanel', "Toggle Maximized Panel"), original: 'Toggle Maximized Panel' },
tooltip: nls.localize('maximizePanel', "Maximize Panel Size"),
title: { value: localize('toggleMaximizedPanel', "Toggle Maximized Panel"), original: 'Toggle Maximized Panel' },
tooltip: localize('maximizePanel', "Maximize Panel Size"),
category: CATEGORIES.View,
f1: true,
icon: maximizeIcon,
toggled: { condition: PanelMaximizedContext, icon: restoreIcon, tooltip: nls.localize('minimizePanel', "Restore Panel Size") },
toggled: { condition: PanelMaximizedContext, icon: restoreIcon, tooltip: localize('minimizePanel', "Restore Panel Size") },
menu: [{
id: MenuId.PanelTitle,
group: 'navigation',
@@ -266,7 +266,7 @@ registerAction2(class extends Action2 {
constructor() {
super({
id: 'workbench.action.closePanel',
title: { value: nls.localize('closePanel', "Close Panel"), original: 'Close Panel' },
title: { value: localize('closePanel', "Close Panel"), original: 'Close Panel' },
category: CATEGORIES.View,
icon: closeIcon,
menu: [{
@@ -291,7 +291,7 @@ MenuRegistry.appendMenuItems([
group: '2_workbench_layout',
command: {
id: TogglePanelAction.ID,
title: nls.localize({ key: 'miShowPanel', comment: ['&& denotes a mnemonic'] }, "Show &&Panel"),
title: localize({ key: 'miShowPanel', comment: ['&& denotes a mnemonic'] }, "Show &&Panel"),
toggled: ActivePanelContext
},
order: 5
@@ -302,7 +302,7 @@ MenuRegistry.appendMenuItems([
group: '3_workbench_layout_move',
command: {
id: TogglePanelAction.ID,
title: { value: nls.localize('hidePanel', "Hide Panel"), original: 'Hide Panel' },
title: { value: localize('hidePanel', "Hide Panel"), original: 'Hide Panel' },
},
when: ContextKeyExpr.and(PanelVisibleContext, ContextKeyExpr.equals('viewLocation', ViewContainerLocationToString(ViewContainerLocation.Panel))),
order: 2

View File

@@ -33,7 +33,7 @@ import { IContextKey, IContextKeyService, ContextKeyExpr } from 'vs/platform/con
import { isUndefinedOrNull, assertIsDefined } from 'vs/base/common/types';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { ViewContainer, IViewDescriptorService, IViewContainerModel, ViewContainerLocation } from 'vs/workbench/common/views';
import { ViewContainer, IViewDescriptorService, IViewContainerModel, ViewContainerLocation, getEnabledViewContainerContextKey } from 'vs/workbench/common/views';
import { IPaneComposite } from 'vs/workbench/common/panecomposite';
import { Before2D, CompositeDragAndDropObserver, ICompositeDragAndDrop, toggleDropEffect } from 'vs/workbench/browser/dnd';
import { IActivity } from 'vs/workbench/common/activity';
@@ -103,6 +103,8 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
private dndHandler: ICompositeDragAndDrop;
private readonly enabledViewContainersContextKeys: Map<string, IContextKey<boolean>> = new Map<string, IContextKey<boolean>>();
constructor(
@INotificationService notificationService: INotificationService,
@IStorageService storageService: IStorageService,
@@ -245,10 +247,10 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
const viewContainer = this.getViewContainer(panel.id)!;
const viewContainerModel = this.viewDescriptorService.getViewContainerModel(viewContainer);
this.updateActivity(viewContainer, viewContainerModel);
this.onDidChangeActiveViews(viewContainer, viewContainerModel);
this.showOrHideViewContainer(viewContainer, viewContainerModel);
const disposables = new DisposableStore();
disposables.add(viewContainerModel.onDidChangeActiveViewDescriptors(() => this.onDidChangeActiveViews(viewContainer, viewContainerModel)));
disposables.add(viewContainerModel.onDidChangeActiveViewDescriptors(() => this.showOrHideViewContainer(viewContainer, viewContainerModel)));
disposables.add(viewContainerModel.onDidChangeContainerInfo(() => this.updateActivity(viewContainer, viewContainerModel)));
this.panelDisposables.set(panel.id, disposables);
@@ -284,7 +286,7 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
const activity: IActivity = {
id: viewContainer.id,
name: this.extensionsRegistered || cachedTitle === undefined ? viewContainerModel.title : cachedTitle,
keybindingId: viewContainer.focusCommand?.id
keybindingId: viewContainerModel.keybindingId
};
const { activityAction, pinnedAction } = this.getCompositeActions(viewContainer.id);
@@ -300,10 +302,17 @@ export class PanelPart extends CompositePart<Panel> implements IPanelService {
}
}
private onDidChangeActiveViews(viewContainer: ViewContainer, viewContainerModel: IViewContainerModel): void {
private showOrHideViewContainer(viewContainer: ViewContainer, viewContainerModel: IViewContainerModel): void {
let contextKey = this.enabledViewContainersContextKeys.get(viewContainer.id);
if (!contextKey) {
contextKey = this.contextKeyService.createKey(getEnabledViewContainerContextKey(viewContainer.id), false);
this.enabledViewContainersContextKeys.set(viewContainer.id, contextKey);
}
if (viewContainerModel.activeViewDescriptors.length) {
this.compositeBar.addComposite(viewContainer);
contextKey.set(true);
this.compositeBar.addComposite({ id: viewContainer.id, name: viewContainer.title, order: viewContainer.order, requestedIndex: viewContainer.requestedIndex });
} else if (viewContainer.hideIfEmpty) {
contextKey.set(false);
this.hideComposite(viewContainer.id);
}
}

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/sidebarpart';
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { Registry } from 'vs/platform/registry/common/platform';
import { CompositePart } from 'vs/workbench/browser/parts/compositePart';
import { Viewlet, ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor } from 'vs/workbench/browser/viewlet';
@@ -307,7 +307,7 @@ class FocusSideBarAction extends Action2 {
constructor() {
super({
id: 'workbench.action.focusSideBar',
title: { value: nls.localize('focusSideBar', "Focus into Side Bar"), original: 'Focus into Side Bar' },
title: { value: localize('focusSideBar', "Focus into Side Bar"), original: 'Focus into Side Bar' },
category: CATEGORIES.View,
f1: true,
keybinding: {

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/statusbarpart';
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { toErrorMessage } from 'vs/base/common/errorMessage';
import { dispose, IDisposable, Disposable, toDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
import { SimpleIconLabel } from 'vs/base/browser/ui/iconLabel/simpleIconLabel';
@@ -58,7 +58,7 @@ interface IStatusbarViewModelEntry {
labelContainer: HTMLElement;
}
const CONTEXT_STATUS_BAR_FOCUSED = new RawContextKey<boolean>('statusBarFocused', false);
const CONTEXT_STATUS_BAR_FOCUSED = new RawContextKey<boolean>('statusBarFocused', false, localize('statusBarFocused', "Whether the status bar has keyboard focus"));
class StatusbarViewModel extends Disposable {
@@ -364,7 +364,7 @@ class ToggleStatusbarEntryVisibilityAction extends Action {
class HideStatusbarEntryAction extends Action {
constructor(id: string, name: string, private model: StatusbarViewModel) {
super(id, nls.localize('hide', "Hide '{0}'", name), undefined, true);
super(id, localize('hide', "Hide '{0}'", name), undefined, true);
}
async run(): Promise<void> {
@@ -613,7 +613,7 @@ export class StatusbarPart extends Part implements IStatusbarService {
const actions: IAction[] = [];
// Provide an action to hide the status bar at last
actions.push(this.instantiationService.createInstance(ToggleStatusbarVisibilityAction, ToggleStatusbarVisibilityAction.ID, nls.localize('hideStatusBar', "Hide Status Bar")));
actions.push(this.instantiationService.createInstance(ToggleStatusbarVisibilityAction, ToggleStatusbarVisibilityAction.ID, localize('hideStatusBar', "Hide Status Bar")));
actions.push(new Separator());
// Show an entry per known status entry

View File

@@ -3,13 +3,13 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { IMenuService, MenuId, IMenu, SubmenuItemAction, registerAction2, Action2, MenuRegistry, MenuItemAction } from 'vs/platform/actions/common/actions';
import { localize } from 'vs/nls';
import { IMenuService, MenuId, IMenu, SubmenuItemAction, registerAction2, Action2, MenuItemAction } from 'vs/platform/actions/common/actions';
import { registerThemingParticipant, IThemeService } from 'vs/platform/theme/common/themeService';
import { MenuBarVisibility, getTitleBarStyle, IWindowOpenable, getMenuBarVisibility } from 'vs/platform/windows/common/windows';
import { ContextKeyExpr, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { IAction, Action, SubmenuAction, Separator } from 'vs/base/common/actions';
import * as DOM from 'vs/base/browser/dom';
import { addDisposableListener, Dimension, EventType } from 'vs/base/browser/dom';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { isMacintosh, isWeb, isIOS, isNative } from 'vs/base/common/platform';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
@@ -63,14 +63,14 @@ export abstract class MenubarControl extends Disposable {
};
protected topLevelTitles: { [menu: string]: string } = {
'File': nls.localize({ key: 'mFile', comment: ['&& denotes a mnemonic'] }, "&&File"),
'Edit': nls.localize({ key: 'mEdit', comment: ['&& denotes a mnemonic'] }, "&&Edit"),
'Selection': nls.localize({ key: 'mSelection', comment: ['&& denotes a mnemonic'] }, "&&Selection"),
'View': nls.localize({ key: 'mView', comment: ['&& denotes a mnemonic'] }, "&&View"),
'Go': nls.localize({ key: 'mGoto', comment: ['&& denotes a mnemonic'] }, "&&Go"),
'Run': nls.localize({ key: 'mRun', comment: ['&& denotes a mnemonic'] }, "&&Run"),
'Terminal': nls.localize({ key: 'mTerminal', comment: ['&& denotes a mnemonic'] }, "&&Terminal"),
'Help': nls.localize({ key: 'mHelp', comment: ['&& denotes a mnemonic'] }, "&&Help")
'File': localize({ key: 'mFile', comment: ['&& denotes a mnemonic'] }, "&&File"),
'Edit': localize({ key: 'mEdit', comment: ['&& denotes a mnemonic'] }, "&&Edit"),
'Selection': localize({ key: 'mSelection', comment: ['&& denotes a mnemonic'] }, "&&Selection"),
'View': localize({ key: 'mView', comment: ['&& denotes a mnemonic'] }, "&&View"),
'Go': localize({ key: 'mGoto', comment: ['&& denotes a mnemonic'] }, "&&Go"),
'Run': localize({ key: 'mRun', comment: ['&& denotes a mnemonic'] }, "&&Run"),
'Terminal': localize({ key: 'mTerminal', comment: ['&& denotes a mnemonic'] }, "&&Terminal"),
'Help': localize({ key: 'mHelp', comment: ['&& denotes a mnemonic'] }, "&&Help")
};
protected recentlyOpened: IRecentlyOpened = { files: [], workspaces: [] };
@@ -127,13 +127,13 @@ export abstract class MenubarControl extends Disposable {
this.updateService.onStateChange(() => this.onUpdateStateChange());
// Listen for changes in recently opened menu
this._register(this.workspacesService.onRecentlyOpenedChange(() => { this.onRecentlyOpenedChange(); }));
this._register(this.workspacesService.onDidChangeRecentlyOpened(() => { this.onDidChangeRecentlyOpened(); }));
// Listen to keybindings change
this._register(this.keybindingService.onDidUpdateKeybindings(() => this.updateMenubar()));
// Update recent menu items on formatter registration
this._register(this.labelService.onDidChangeFormatters(() => { this.onRecentlyOpenedChange(); }));
this._register(this.labelService.onDidChangeFormatters(() => { this.onDidChangeRecentlyOpened(); }));
}
protected updateMenubar(): void {
@@ -189,7 +189,7 @@ export abstract class MenubarControl extends Disposable {
protected onDidChangeWindowFocus(hasFocus: boolean): void {
// When we regain focus, update the recent menu items
if (hasFocus) {
this.onRecentlyOpenedChange();
this.onDidChangeRecentlyOpened();
}
}
@@ -205,7 +205,7 @@ export abstract class MenubarControl extends Disposable {
// Since we try not update when hidden, we should
// try to update the recently opened list on visibility changes
if (event.affectsConfiguration('window.menuBarVisibility')) {
this.onRecentlyOpenedChange();
this.onDidChangeRecentlyOpened();
}
}
@@ -213,7 +213,7 @@ export abstract class MenubarControl extends Disposable {
return isMacintosh && isNative ? false : getMenuBarVisibility(this.configurationService) === 'hidden';
}
protected onRecentlyOpenedChange(): void {
protected onDidChangeRecentlyOpened(): void {
// Do not update recently opened when the menubar is hidden #108712
if (!this.menubarHidden) {
@@ -271,10 +271,10 @@ export abstract class MenubarControl extends Disposable {
return;
}
const message = nls.localize('menubar.customTitlebarAccessibilityNotification', "Accessibility support is enabled for you. For the most accessible experience, we recommend the custom title bar style.");
const message = localize('menubar.customTitlebarAccessibilityNotification', "Accessibility support is enabled for you. For the most accessible experience, we recommend the custom title bar style.");
this.notificationService.prompt(Severity.Info, message, [
{
label: nls.localize('goToSetting', "Open Settings"),
label: localize('goToSetting', "Open Settings"),
run: () => {
return this.preferencesService.openGlobalSettings(undefined, { query: 'window.titleBarStyle' });
}
@@ -291,6 +291,7 @@ export class CustomMenubarControl extends MenubarControl {
private alwaysOnMnemonics: boolean = false;
private focusInsideMenubar: boolean = false;
private visible: boolean = true;
private readonly webNavigationMenu = this._register(this.menuService.createMenu(MenuId.MenubarHomeMenu, this.contextKeyService));
private readonly _onVisibilityChange: Emitter<boolean>;
private readonly _onFocusStateChange: Emitter<boolean>;
@@ -326,16 +327,6 @@ export class CustomMenubarControl extends MenubarControl {
this.registerActions();
// Register web menu actions to the file menu when its in the title
this.getWebNavigationMenuItemActions().forEach(actionItem => {
this._register(MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
command: actionItem.item,
title: actionItem.item.title,
group: 'z_Web',
when: ContextKeyExpr.and(IsWebContext, ContextKeyExpr.notEquals('config.window.menuBarVisibility', 'compact'))
}));
});
registerThemingParticipant((theme, collector) => {
const menubarActiveWindowFgColor = theme.getColor(TITLE_BAR_ACTIVE_FOREGROUND);
if (menubarActiveWindowFgColor) {
@@ -441,7 +432,7 @@ export class CustomMenubarControl extends MenubarControl {
constructor() {
super({
id: `workbench.actions.menubar.focus`,
title: { value: nls.localize('focusMenu', "Focus Application Menu"), original: 'Focus Application Menu' },
title: { value: localize('focusMenu', "Focus Application Menu"), original: 'Focus Application Menu' },
keybinding: {
primary: KeyCode.F10,
weight: KeybindingWeight.WorkbenchContrib,
@@ -468,28 +459,28 @@ export class CustomMenubarControl extends MenubarControl {
return null;
case StateType.Idle:
return new Action('update.check', nls.localize({ key: 'checkForUpdates', comment: ['&& denotes a mnemonic'] }, "Check for &&Updates..."), undefined, true, () =>
return new Action('update.check', localize({ key: 'checkForUpdates', comment: ['&& denotes a mnemonic'] }, "Check for &&Updates..."), undefined, true, () =>
this.updateService.checkForUpdates(this.environmentService.sessionId));
case StateType.CheckingForUpdates:
return new Action('update.checking', nls.localize('checkingForUpdates', "Checking for Updates..."), undefined, false);
return new Action('update.checking', localize('checkingForUpdates', "Checking for Updates..."), undefined, false);
case StateType.AvailableForDownload:
return new Action('update.downloadNow', nls.localize({ key: 'download now', comment: ['&& denotes a mnemonic'] }, "D&&ownload Update"), undefined, true, () =>
return new Action('update.downloadNow', localize({ key: 'download now', comment: ['&& denotes a mnemonic'] }, "D&&ownload Update"), undefined, true, () =>
this.updateService.downloadUpdate());
case StateType.Downloading:
return new Action('update.downloading', nls.localize('DownloadingUpdate', "Downloading Update..."), undefined, false);
return new Action('update.downloading', localize('DownloadingUpdate', "Downloading Update..."), undefined, false);
case StateType.Downloaded:
return new Action('update.install', nls.localize({ key: 'installUpdate...', comment: ['&& denotes a mnemonic'] }, "Install &&Update..."), undefined, true, () =>
return new Action('update.install', localize({ key: 'installUpdate...', comment: ['&& denotes a mnemonic'] }, "Install &&Update..."), undefined, true, () =>
this.updateService.applyUpdate());
case StateType.Updating:
return new Action('update.updating', nls.localize('installingUpdate', "Installing Update..."), undefined, false);
return new Action('update.updating', localize('installingUpdate', "Installing Update..."), undefined, false);
case StateType.Ready:
return new Action('update.restart', nls.localize({ key: 'restartToUpdate', comment: ['&& denotes a mnemonic'] }, "Restart to &&Update"), undefined, true, () =>
return new Action('update.restart', localize({ key: 'restartToUpdate', comment: ['&& denotes a mnemonic'] }, "Restart to &&Update"), undefined, true, () =>
this.updateService.quitAndInstall());
}
}
@@ -552,7 +543,7 @@ export class CustomMenubarControl extends MenubarControl {
private onDidVisibilityChange(visible: boolean): void {
this.visible = visible;
this.onRecentlyOpenedChange();
this.onDidChangeRecentlyOpened();
this._onVisibilityChange.fire(visible);
}
@@ -583,11 +574,11 @@ export class CustomMenubarControl extends MenubarControl {
this._register(this.menubar.onVisibilityChange(e => this.onDidVisibilityChange(e)));
// Before we focus the menubar, stop updates to it so that focus-related context keys will work
this._register(DOM.addDisposableListener(this.container, DOM.EventType.FOCUS_IN, () => {
this._register(addDisposableListener(this.container, EventType.FOCUS_IN, () => {
this.focusInsideMenubar = true;
}));
this._register(DOM.addDisposableListener(this.container, DOM.EventType.FOCUS_OUT, () => {
this._register(addDisposableListener(this.container, EventType.FOCUS_OUT, () => {
this.focusInsideMenubar = false;
}));
@@ -640,6 +631,15 @@ export class CustomMenubarControl extends MenubarControl {
target.push(new Separator());
}
// Append web navigation menu items to the file menu when not compact
if (menu === this.menus.File && this.currentCompactMenuMode === undefined) {
const webActions = this.getWebNavigationActions();
if (webActions.length) {
target.push(...webActions);
target.push(new Separator()); // to account for pop below
}
}
target.pop();
};
@@ -655,6 +655,19 @@ export class CustomMenubarControl extends MenubarControl {
}
}
}));
// For the file menu, we need to update if the web nav menu updates as well
if (menu === this.menus.File) {
this._register(this.webNavigationMenu.onDidChange(() => {
if (!this.focusInsideMenubar) {
const actions: IAction[] = [];
updateActions(menu, actions, title);
if (this.menubar) {
this.menubar.updateMenu({ actions: actions, label: mnemonicMenuLabel(this.topLevelTitles[title]) });
}
}
}));
}
}
const actions: IAction[] = [];
@@ -672,23 +685,31 @@ export class CustomMenubarControl extends MenubarControl {
}
}
private getWebNavigationMenuItemActions(): MenuItemAction[] {
private getWebNavigationActions(): IAction[] {
if (!isWeb) {
return []; // only for web
}
const webNavigationActions = [];
const webNavigationMenu = this.menuService.createMenu(MenuId.MenubarHomeMenu, this.contextKeyService);
for (const groups of webNavigationMenu.getActions()) {
for (const groups of this.webNavigationMenu.getActions()) {
const [, actions] = groups;
for (const action of actions) {
if (action instanceof MenuItemAction) {
webNavigationActions.push(action);
const title = typeof action.item.title === 'string'
? action.item.title
: action.item.title.mnemonicTitle ?? action.item.title.value;
webNavigationActions.push(new Action(action.id, mnemonicMenuLabel(title), action.class, action.enabled, async (event?: any) => {
this.commandService.executeCommand(action.id, event);
}));
}
}
webNavigationActions.push(new Separator());
}
webNavigationMenu.dispose();
if (webNavigationActions.length) {
webNavigationActions.pop();
}
return webNavigationActions;
}
@@ -706,28 +727,7 @@ export class CustomMenubarControl extends MenubarControl {
return []; // only for web
}
const webNavigationActions: IAction[] = [];
const href = this.environmentService.options?.homeIndicator?.href;
if (href) {
webNavigationActions.push(new Action('goHome', nls.localize('goHome', "Go Home"), undefined, true,
async (event?: MouseEvent) => {
if ((!isMacintosh && event?.ctrlKey) || (isMacintosh && event?.metaKey)) {
window.open(href, '_blank');
} else {
window.location.href = href;
}
}));
}
const otherActions = this.getWebNavigationMenuItemActions().map(action => {
const title = typeof action.item.title === 'string'
? action.item.title
: action.item.title.mnemonicTitle ?? action.item.title.value;
return new Action(action.id, mnemonicMenuLabel(title), action.class, action.enabled, () => this.commandService.executeCommand(action.id));
});
webNavigationActions.push(...otherActions);
return webNavigationActions;
return this.getWebNavigationActions();
}
};
}
@@ -759,12 +759,12 @@ export class CustomMenubarControl extends MenubarControl {
super.onUpdateStateChange();
}
protected onRecentlyOpenedChange(): void {
protected onDidChangeRecentlyOpened(): void {
if (!this.visible) {
return;
}
super.onRecentlyOpenedChange();
super.onDidChangeRecentlyOpened();
}
protected onUpdateKeybindings(): void {
@@ -778,7 +778,7 @@ export class CustomMenubarControl extends MenubarControl {
protected registerListeners(): void {
super.registerListeners();
this._register(DOM.addDisposableListener(window, DOM.EventType.RESIZE, () => {
this._register(addDisposableListener(window, EventType.RESIZE, () => {
if (this.menubar && !(isIOS && BrowserFeatures.pointerEvents)) {
this.menubar.blur();
}
@@ -786,7 +786,8 @@ export class CustomMenubarControl extends MenubarControl {
// Mnemonics require fullscreen in web
if (isWeb) {
this._register(this.layoutService.onFullscreenChange(e => this.updateMenubar()));
this._register(this.layoutService.onDidChangeFullscreen(e => this.updateMenubar()));
this._register(this.webNavigationMenu.onDidChange(() => this.updateMenubar()));
}
}
@@ -798,12 +799,12 @@ export class CustomMenubarControl extends MenubarControl {
return this._onFocusStateChange.event;
}
getMenubarItemsDimensions(): DOM.Dimension {
getMenubarItemsDimensions(): Dimension {
if (this.menubar) {
return new DOM.Dimension(this.menubar.getWidth(), this.menubar.getHeight());
return new Dimension(this.menubar.getWidth(), this.menubar.getHeight());
}
return new DOM.Dimension(0, 0);
return new Dimension(0, 0);
}
create(parent: HTMLElement): HTMLElement {
@@ -817,7 +818,7 @@ export class CustomMenubarControl extends MenubarControl {
return this.container;
}
layout(dimension: DOM.Dimension) {
layout(dimension: Dimension) {
if (this.container) {
this.container.style.height = `${dimension.height}px`;
}

View File

@@ -144,7 +144,7 @@ export class TitlebarPart extends Part implements ITitleService {
}
}
protected onMenubarVisibilityChanged(visible: boolean) {
protected onMenubarVisibilityChanged(visible: boolean): void {
if (isWeb || isWindows || isLinux) {
this.adjustTitleMarginToCenter();

View File

@@ -63,24 +63,35 @@
display: none;
}
.monaco-workbench .pane > .pane-body > .welcome-view .monaco-button {
margin-left: auto;
margin-right: auto;
}
.monaco-workbench .pane > .pane-body.wide > .welcome-view .monaco-button {
margin-left: inherit;
max-width: 260px;
}
.monaco-workbench .pane > .pane-body .welcome-view-content {
padding: 0 20px 0 20px;
display: flex;
flex-direction: column;
padding: 0 20px 1em 20px;
box-sizing: border-box;
align-items: center;
}
.monaco-workbench .pane > .pane-body .welcome-view-content > .button-container {
width: 100%;
max-width: 300px;
transition: 0.2s max-width ease-out;
}
.monaco-workbench .pane > .pane-body .welcome-view-content.wide > .button-container {
max-width: 100%;
}
.monaco-workbench .pane > .pane-body .welcome-view-content > .button-container > .monaco-button {
max-width: 300px;
}
.monaco-workbench .pane > .pane-body .welcome-view-content > p {
width: 100%;
}
.monaco-workbench .pane > .pane-body .welcome-view-content > * {
margin-block-start: 1em;
margin-block-end: 1em;
margin-block-end: 0;
margin-inline-start: 0px;
margin-inline-end: 0px;
}
@@ -167,6 +178,7 @@
.customview-tree .monaco-list .custom-view-tree-node-item .actions .action-label.codicon {
line-height: 22px;
height: 22px;
}
.customview-tree .monaco-list .custom-view-tree-node-item .actions .action-label.codicon::before {

View File

@@ -19,7 +19,7 @@ import { Registry } from 'vs/platform/registry/common/platform';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { Event, Emitter } from 'vs/base/common/event';
import { IAction, ActionRunner, IActionViewItemProvider } from 'vs/base/common/actions';
import { IAction, ActionRunner } from 'vs/base/common/actions';
import { createAndFillInContextMenuActions, createActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { IProgressService } from 'vs/platform/progress/common/progress';
@@ -27,7 +27,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
import { ICommandService } from 'vs/platform/commands/common/commands';
import * as DOM from 'vs/base/browser/dom';
import { ResourceLabels, IResourceLabel } from 'vs/workbench/browser/labels';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { ActionBar, IActionViewItemProvider } from 'vs/base/browser/ui/actionbar/actionbar';
import { URI } from 'vs/base/common/uri';
import { dirname, basename } from 'vs/base/common/resources';
import { FileKind } from 'vs/platform/files/common/files';
@@ -853,9 +853,6 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
this._hoverDelegate = {
showHover: (options: IHoverDelegateOptions): IDisposable | undefined => {
return this.hoverService.showHover(options);
},
hideHover: () => {
return this.hoverService.hideHover();
}
};
}
@@ -1126,18 +1123,18 @@ class TreeMenus extends Disposable implements IDisposable {
if (!this.contextKeyService) {
return { primary: [], secondary: [] };
}
const contextKeyService = this.contextKeyService.createScoped();
contextKeyService.createKey('view', this.id);
contextKeyService.createKey(context.key, context.value);
const contextKeyService = this.contextKeyService.createOverlay([
['view', this.id],
[context.key, context.value]
]);
const menu = this.menuService.createMenu(menuId, contextKeyService);
const primary: IAction[] = [];
const secondary: IAction[] = [];
const result = { primary, secondary };
createAndFillInContextMenuActions(menu, { shouldForwardArgs: true }, result, g => /^inline/.test(g));
menu.dispose();
contextKeyService.dispose();
return result;
}

View File

@@ -11,8 +11,8 @@ import { attachButtonStyler, attachLinkStyler, attachProgressBarStyler } from 'v
import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from 'vs/workbench/common/theme';
import { after, append, $, trackFocus, EventType, addDisposableListener, createCSSRule, asCSSUrl } from 'vs/base/browser/dom';
import { IDisposable, Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { IAction, IActionViewItem } from 'vs/base/common/actions';
import { ActionsOrientation, prepareActions } from 'vs/base/browser/ui/actionbar/actionbar';
import { IAction } from 'vs/base/common/actions';
import { ActionsOrientation, IActionViewItem, prepareActions } from 'vs/base/browser/ui/actionbar/actionbar';
import { Registry } from 'vs/platform/registry/common/platform';
import { ToolBar } from 'vs/base/browser/ui/toolbar/toolbar';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
@@ -21,8 +21,8 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService, ThemeIcon } from 'vs/platform/theme/common/themeService';
import { IPaneOptions, Pane, IPaneStyles } from 'vs/base/browser/ui/splitview/paneview';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { Extensions as ViewContainerExtensions, IView, FocusedViewContext, IViewDescriptorService, ViewContainerLocation, IViewsRegistry, IViewContentDescriptor, defaultViewIcon, IViewsService, ViewContainerLocationToString } from 'vs/workbench/common/views';
import { IContextKey, IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { Extensions as ViewContainerExtensions, IView, IViewDescriptorService, ViewContainerLocation, IViewsRegistry, IViewContentDescriptor, defaultViewIcon, IViewsService, ViewContainerLocationToString } from 'vs/workbench/common/views';
import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { assertIsDefined } from 'vs/base/common/types';
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { MenuId, Action2, IAction2Options, IMenuService } from 'vs/platform/actions/common/actions';
@@ -80,16 +80,12 @@ class ViewWelcomeController {
return visibleItems.map(v => v.descriptor);
}
private contextKeyService: IContextKeyService;
private disposables = new DisposableStore();
constructor(
private id: string,
@IContextKeyService contextKeyService: IContextKeyService,
@IContextKeyService private contextKeyService: IContextKeyService,
) {
this.contextKeyService = contextKeyService.createScoped();
this.disposables.add(this.contextKeyService);
contextKeyService.onDidChangeContext(this.onDidChangeContext, this, this.disposables);
Event.filter(viewsRegistry.onDidChangeViewWelcomeContent, id => id === this.id)(this.onDidChangeViewWelcomeContent, this, this.disposables);
this.onDidChangeViewWelcomeContent();
@@ -142,6 +138,7 @@ class ViewWelcomeController {
class ViewMenuActions extends CompositeMenuActions {
constructor(
element: HTMLElement,
viewId: string,
menuId: MenuId,
contextMenuId: MenuId,
@@ -149,7 +146,7 @@ class ViewMenuActions extends CompositeMenuActions {
@IMenuService menuService: IMenuService,
@IViewDescriptorService viewDescriptorService: IViewDescriptorService,
) {
const scopedContextKeyService = contextKeyService.createScoped();
const scopedContextKeyService = contextKeyService.createScoped(element);
scopedContextKeyService.createKey('view', viewId);
const viewLocationKey = scopedContextKeyService.createKey('viewLocation', ViewContainerLocationToString(viewDescriptorService.getViewLocationById(viewId)!));
super(menuId, contextMenuId, { shouldForwardArgs: true }, scopedContextKeyService, menuService);
@@ -178,8 +175,6 @@ export abstract class ViewPane extends Pane implements IView {
protected _onDidChangeViewWelcomeState = this._register(new Emitter<void>());
readonly onDidChangeViewWelcomeState: Event<void> = this._onDidChangeViewWelcomeState.event;
private focusedViewContextKey: IContextKey<string>;
private _isVisible: boolean = false;
readonly id: string;
@@ -193,7 +188,8 @@ export abstract class ViewPane extends Pane implements IView {
return this._titleDescription;
}
private readonly menuActions: ViewMenuActions;
readonly menuActions: ViewMenuActions;
private progressBar!: ProgressBar;
private progressIndicator!: IProgressIndicator;
@@ -228,9 +224,8 @@ export abstract class ViewPane extends Pane implements IView {
this._title = options.title;
this._titleDescription = options.titleDescription;
this.showActionsAlways = !!options.showActionsAlways;
this.focusedViewContextKey = FocusedViewContext.bindTo(contextKeyService);
this.menuActions = this._register(instantiationService.createInstance(ViewMenuActions, this.id, options.titleMenuId || MenuId.ViewTitle, MenuId.ViewTitleContext));
this.menuActions = this._register(this.instantiationService.createInstance(ViewMenuActions, this.element, this.id, options.titleMenuId || MenuId.ViewTitle, MenuId.ViewTitleContext));
this._register(this.menuActions.onDidChange(() => this.updateActions()));
this.viewWelcomeController = new ViewWelcomeController(this.id, contextKeyService);
@@ -280,17 +275,8 @@ export abstract class ViewPane extends Pane implements IView {
const focusTracker = trackFocus(this.element);
this._register(focusTracker);
this._register(focusTracker.onDidFocus(() => {
this.focusedViewContextKey.set(this.id);
this._onDidFocus.fire();
}));
this._register(focusTracker.onDidBlur(() => {
if (this.focusedViewContextKey.get() === this.id) {
this.focusedViewContextKey.reset();
}
this._onDidBlur.fire();
}));
this._register(focusTracker.onDidFocus(() => this._onDidFocus.fire()));
this._register(focusTracker.onDidBlur(() => this._onDidBlur.fire()));
}
protected renderHeader(container: HTMLElement): void {
@@ -453,6 +439,7 @@ export abstract class ViewPane extends Pane implements IView {
protected layoutBody(height: number, width: number): void {
this.viewWelcomeContainer.style.height = `${height}px`;
this.viewWelcomeContainer.style.width = `${width}px`;
this.viewWelcomeContainer.classList.toggle('wide', width > 640);
this.scrollableElement.scanDomNode();
}
@@ -489,7 +476,7 @@ export abstract class ViewPane extends Pane implements IView {
private setActions(): void {
if (this.toolbar) {
this.toolbar.setActions(prepareActions(this.getActions()), prepareActions(this.getSecondaryActions()));
this.toolbar.setActions(prepareActions(this.menuActions.getPrimaryActions()), prepareActions(this.menuActions.getSecondaryActions()));
this.toolbar.context = this.getActionsContext();
}
}
@@ -507,18 +494,6 @@ export abstract class ViewPane extends Pane implements IView {
this._onDidChangeTitleArea.fire();
}
getActions(): IAction[] {
return this.menuActions.getPrimaryActions();
}
getSecondaryActions(): IAction[] {
return this.menuActions.getSecondaryActions();
}
getContextMenuActions(): IAction[] {
return this.menuActions.getContextMenuActions();
}
getActionViewItem(action: IAction): IActionViewItem | undefined {
return createActionViewItem(this.instantiationService, action);
}
@@ -572,7 +547,8 @@ export abstract class ViewPane extends Pane implements IView {
if (linkedText.nodes.length === 1 && typeof linkedText.nodes[0] !== 'string') {
const node = linkedText.nodes[0];
const button = new Button(this.viewWelcomeContainer, { title: node.title, supportIcons: true });
const buttonContainer = append(this.viewWelcomeContainer, $('.button-container'));
const button = new Button(buttonContainer, { title: node.title, supportIcons: true });
button.label = node.label;
button.onDidClick(_ => {
this.telemetryService.publicLog2<{ viewId: string, uri: string }, WelcomeActionClassification>('views.welcomeAction', { viewId: this.id, uri: node.href });

View File

@@ -11,7 +11,7 @@ import { attachStyler, IColorMapping } from 'vs/platform/theme/common/styler';
import { SIDE_BAR_DRAG_AND_DROP_BACKGROUND, SIDE_BAR_SECTION_HEADER_FOREGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, SIDE_BAR_SECTION_HEADER_BORDER, PANEL_SECTION_HEADER_FOREGROUND, PANEL_SECTION_HEADER_BACKGROUND, PANEL_SECTION_HEADER_BORDER, PANEL_SECTION_DRAG_AND_DROP_BACKGROUND, PANEL_SECTION_BORDER } from 'vs/workbench/common/theme';
import { EventType, Dimension, addDisposableListener, isAncestor } from 'vs/base/browser/dom';
import { IDisposable, combinedDisposable, dispose, toDisposable } from 'vs/base/common/lifecycle';
import { IAction, IActionViewItem, Separator } from 'vs/base/common/actions';
import { IAction } from 'vs/base/common/actions';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IThemeService, Themable } from 'vs/platform/theme/common/themeService';
@@ -28,7 +28,7 @@ import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewl
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { Component } from 'vs/workbench/common/component';
import { registerAction2, Action2, IAction2Options, IMenuService, MenuId, MenuRegistry, ISubmenuItem, SubmenuItemAction } from 'vs/platform/actions/common/actions';
import { registerAction2, Action2, IAction2Options, MenuId, MenuRegistry, ISubmenuItem, IMenuService } from 'vs/platform/actions/common/actions';
import { CompositeDragAndDropObserver, DragAndDropObserver, toggleDropEffect } from 'vs/workbench/browser/dnd';
import { Orientation } from 'vs/base/browser/ui/sash/sash';
import { RunOnceScheduler } from 'vs/base/common/async';
@@ -37,6 +37,7 @@ import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegis
import { ViewPane } from 'vs/workbench/browser/parts/views/viewPane';
import { CompositeMenuActions } from 'vs/workbench/browser/menuActions';
import { createActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
export const ViewsSubMenu = new MenuId('Views');
MenuRegistry.appendMenuItem(MenuId.ViewContainerTitle, <ISubmenuItem>{
@@ -295,12 +296,13 @@ class ViewPaneDropOverlay extends Themable {
class ViewContainerMenuActions extends CompositeMenuActions {
constructor(
element: HTMLElement,
viewContainer: ViewContainer,
@IViewDescriptorService viewDescriptorService: IViewDescriptorService,
@IContextKeyService contextKeyService: IContextKeyService,
@IMenuService menuService: IMenuService,
) {
const scopedContextKeyService = contextKeyService.createScoped();
const scopedContextKeyService = contextKeyService.createScoped(element);
scopedContextKeyService.createKey('viewContainer', viewContainer.id);
const viewContainerLocationKey = scopedContextKeyService.createKey('viewContainerLocation', ViewContainerLocationToString(viewDescriptorService.getViewContainerLocation(viewContainer)!));
super(MenuId.ViewContainerTitle, MenuId.ViewContainerTitleContext, { shouldForwardArgs: true }, scopedContextKeyService, menuService);
@@ -343,11 +345,17 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
private readonly _onDidChangeViewVisibility = this._register(new Emitter<IView>());
readonly onDidChangeViewVisibility = this._onDidChangeViewVisibility.event;
private readonly _onDidFocusView = this._register(new Emitter<IView>());
readonly onDidFocusView = this._onDidFocusView.event;
private readonly _onDidBlurView = this._register(new Emitter<IView>());
readonly onDidBlurView = this._onDidBlurView.event;
get onDidSashChange(): Event<number> {
return assertIsDefined(this.paneview).onDidSashChange;
}
protected get panes(): ViewPane[] {
get panes(): ViewPane[] {
return this.paneItems.map(i => i.pane);
}
@@ -359,7 +367,10 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
return this.paneItems.length;
}
private readonly menuActions: ViewContainerMenuActions;
private _menuActions?: ViewContainerMenuActions;
get menuActions(): CompositeMenuActions | undefined {
return this._menuActions;
}
constructor(
id: string,
@@ -389,9 +400,6 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
this.visibleViewsCountFromCache = this.storageService.getNumber(this.visibleViewsStorageId, StorageScope.WORKSPACE, undefined);
this._register(toDisposable(() => this.viewDisposables = dispose(this.viewDisposables)));
this.viewContainerModel = this.viewDescriptorService.getViewContainerModel(container);
this.menuActions = this._register(instantiationService.createInstance(ViewContainerMenuActions, container));
this._register(this.menuActions.onDidChange(() => this.updateTitleArea()));
}
create(parent: HTMLElement): void {
@@ -401,6 +409,9 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
this._register(this.paneview.onDidDrop(({ from, to }) => this.movePane(from as ViewPane, to as ViewPane)));
this._register(addDisposableListener(parent, EventType.CONTEXT_MENU, (e: MouseEvent) => this.showContextMenu(new StandardMouseEvent(e))));
this._menuActions = this._register(this.instantiationService.createInstance(ViewContainerMenuActions, this.paneview.element, this.viewContainer));
this._register(this._menuActions.onDidChange(() => this.updateTitleArea()));
let overlay: ViewPaneDropOverlay | undefined;
const getOverlayBounds: () => BoundingRect = () => {
const fullSize = parent.getBoundingClientRect();
@@ -564,65 +575,10 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
let anchor: { x: number, y: number; } = { x: event.posx, y: event.posy };
this.contextMenuService.showContextMenu({
getAnchor: () => anchor,
getActions: () => [...this.getContextMenuActions2()]
getActions: () => this.menuActions?.getContextMenuActions() ?? []
});
}
getContextMenuActions2(): ReadonlyArray<IAction> {
return this.menuActions.getContextMenuActions();
}
getContextMenuActions(viewDescriptor?: IViewDescriptor): IAction[] {
return [];
}
getActions2(): IAction[] {
const result = [];
result.push(...this.menuActions.getPrimaryActions());
if (this.isViewMergedWithContainer()) {
result.push(...this.paneItems[0].pane.getActions());
}
return result;
}
getActions(): IAction[] {
return [];
}
getSecondaryActions2(): IAction[] {
const viewPaneActions = this.isViewMergedWithContainer() ? this.paneItems[0].pane.getSecondaryActions() : [];
let menuActions = this.menuActions.getSecondaryActions();
const viewsSubmenuActionIndex = menuActions.findIndex(action => action instanceof SubmenuItemAction && action.item.submenu === ViewsSubMenu);
if (viewsSubmenuActionIndex !== -1) {
const viewsSubmenuAction = <SubmenuItemAction>menuActions[viewsSubmenuActionIndex];
if (viewsSubmenuAction.actions.some(({ enabled }) => enabled)) {
if (menuActions.length === 1 && viewPaneActions.length === 0) {
menuActions = viewsSubmenuAction.actions.slice();
} else if (viewsSubmenuActionIndex !== 0) {
menuActions = [viewsSubmenuAction, ...menuActions.slice(0, viewsSubmenuActionIndex), ...menuActions.slice(viewsSubmenuActionIndex + 1)];
}
} else {
// Remove views submenu if none of the actions are enabled
menuActions.splice(viewsSubmenuActionIndex, 1);
}
}
if (menuActions.length && viewPaneActions.length) {
return [
...menuActions,
new Separator(),
...viewPaneActions
];
}
return menuActions.length ? menuActions : viewPaneActions;
}
getSecondaryActions(): IAction[] {
return [];
}
getActionsContext(): unknown {
return undefined;
}
@@ -773,7 +729,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
event.stopPropagation();
event.preventDefault();
const actions: IAction[] = viewPane.getContextMenuActions();
const actions: IAction[] = viewPane.menuActions.getContextMenuActions();
let anchor: { x: number, y: number } = { x: event.posx, y: event.posy };
this.contextMenuService.showContextMenu({
@@ -863,7 +819,11 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
}
private addPane(pane: ViewPane, size: number, index = this.paneItems.length - 1): void {
const onDidFocus = pane.onDidFocus(() => this.lastFocusedPane = pane);
const onDidFocus = pane.onDidFocus(() => {
this._onDidFocusView.fire(pane);
this.lastFocusedPane = pane;
});
const onDidBlur = pane.onDidBlur(() => this._onDidBlurView.fire(pane));
const onDidChangeTitleArea = pane.onDidChangeTitleArea(() => {
if (this.isViewMergedWithContainer()) {
this.updateTitleArea();
@@ -885,7 +845,7 @@ export class ViewPaneContainer extends Component implements IViewPaneContainer {
dropBackground: isPanel ? PANEL_SECTION_DRAG_AND_DROP_BACKGROUND : SIDE_BAR_DRAG_AND_DROP_BACKGROUND,
leftBorder: isPanel ? PANEL_SECTION_BORDER : undefined
}, pane);
const disposable = combinedDisposable(pane, onDidFocus, onDidChangeTitleArea, paneStyler, onDidChange, onDidChangeVisibility);
const disposable = combinedDisposable(pane, onDidFocus, onDidBlur, onDidChangeTitleArea, paneStyler, onDidChange, onDidChangeVisibility);
const paneItem: IViewPaneItem = { pane, disposable };
this.paneItems.splice(index, 0, paneItem);

View File

@@ -4,14 +4,14 @@
*--------------------------------------------------------------------------------------------*/
import { Disposable, IDisposable, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { IViewDescriptorService, ViewContainer, IViewDescriptor, IView, ViewContainerLocation, IViewsService, IViewPaneContainer, getVisbileViewContextKey } from 'vs/workbench/common/views';
import { IViewDescriptorService, ViewContainer, IViewDescriptor, IView, ViewContainerLocation, IViewsService, IViewPaneContainer, getVisbileViewContextKey, getEnabledViewContainerContextKey, FocusedViewContext } from 'vs/workbench/common/views';
import { Registry } from 'vs/platform/registry/common/platform';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { ContextKeyDefinedExpr, ContextKeyExpr, IContextKey, IContextKeyService, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { Event, Emitter } from 'vs/base/common/event';
import { isString } from 'vs/base/common/types';
import { MenuId, registerAction2, Action2 } from 'vs/platform/actions/common/actions';
import { MenuId, registerAction2, Action2, MenuRegistry, ICommandActionTitle, ILocalizedString } from 'vs/platform/actions/common/actions';
import { localize } from 'vs/nls';
import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
@@ -27,17 +27,19 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { Viewlet, ViewletDescriptor, ViewletRegistry, Extensions as ViewletExtensions } from 'vs/workbench/browser/viewlet';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { URI } from 'vs/base/common/uri';
import { IProgressIndicator } from 'vs/platform/progress/common/progress';
import { CATEGORIES } from 'vs/workbench/common/actions';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { FilterViewPaneContainer } from 'vs/workbench/browser/parts/views/viewsViewlet';
export class ViewsService extends Disposable implements IViewsService {
declare readonly _serviceBrand: undefined;
private readonly viewDisposable: Map<IViewDescriptor, IDisposable>;
private readonly viewPaneContainers: Map<string, { viewPaneContainer: ViewPaneContainer, disposable: IDisposable }>;
private readonly viewPaneContainers: Map<string, ViewPaneContainer>;
private readonly _onDidChangeViewVisibility: Emitter<{ id: string, visible: boolean }> = this._register(new Emitter<{ id: string, visible: boolean }>());
readonly onDidChangeViewVisibility: Event<{ id: string, visible: boolean }> = this._onDidChangeViewVisibility.event;
@@ -46,6 +48,7 @@ export class ViewsService extends Disposable implements IViewsService {
readonly onDidChangeViewContainerVisibility = this._onDidChangeViewContainerVisibility.event;
private readonly visibleViewContextKeys: Map<string, IContextKey<boolean>>;
private readonly focusedViewContextKey: IContextKey<string>;
constructor(
@IViewDescriptorService private readonly viewDescriptorService: IViewDescriptorService,
@@ -58,7 +61,7 @@ export class ViewsService extends Disposable implements IViewsService {
this.viewDisposable = new Map<IViewDescriptor, IDisposable>();
this.visibleViewContextKeys = new Map<string, IContextKey<boolean>>();
this.viewPaneContainers = new Map<string, { viewPaneContainer: ViewPaneContainer, disposable: IDisposable }>();
this.viewPaneContainers = new Map<string, ViewPaneContainer>();
this._register(toDisposable(() => {
this.viewDisposable.forEach(disposable => disposable.dispose());
@@ -75,24 +78,7 @@ export class ViewsService extends Disposable implements IViewsService {
this._register(this.viewletService.onDidViewletClose(viewlet => this._onDidChangeViewContainerVisibility.fire({ id: viewlet.getId(), visible: false, location: ViewContainerLocation.Sidebar })));
this._register(this.panelService.onDidPanelClose(panel => this._onDidChangeViewContainerVisibility.fire({ id: panel.getId(), visible: false, location: ViewContainerLocation.Panel })));
}
private registerViewPaneContainer(viewPaneContainer: ViewPaneContainer): void {
const disposable = new DisposableStore();
disposable.add(viewPaneContainer);
disposable.add(viewPaneContainer.onDidAddViews(views => this.onViewsAdded(views)));
disposable.add(viewPaneContainer.onDidChangeViewVisibility(view => this.onViewsVisibilityChanged(view, view.isBodyVisible())));
disposable.add(viewPaneContainer.onDidRemoveViews(views => this.onViewsRemoved(views)));
this.viewPaneContainers.set(viewPaneContainer.getId(), { viewPaneContainer, disposable });
}
private deregisterViewPaneContainer(id: string): void {
const viewPaneContainerItem = this.viewPaneContainers.get(id);
if (viewPaneContainerItem) {
viewPaneContainerItem.disposable.dispose();
this.viewPaneContainers.delete(id);
}
this.focusedViewContextKey = FocusedViewContext.bindTo(contextKeyService);
}
private onViewsAdded(added: IView[]): void {
@@ -139,6 +125,7 @@ export class ViewsService extends Disposable implements IViewsService {
this.onViewDescriptorsAdded(added, viewContainer);
this.onViewDescriptorsRemoved(removed);
}));
this._register(this.registerOpenViewContainerAction(viewContainer));
}
private onDidChangeContainerLocation(viewContainer: ViewContainer, from: ViewContainerLocation, to: ViewContainerLocation): void {
@@ -155,69 +142,9 @@ export class ViewsService extends Disposable implements IViewsService {
const composite = this.getComposite(container.id, location);
for (const viewDescriptor of views) {
const disposables = new DisposableStore();
disposables.add(registerAction2(class FocusViewAction extends Action2 {
constructor() {
super({
id: viewDescriptor.focusCommand ? viewDescriptor.focusCommand.id : `${viewDescriptor.id}.focus`,
title: { original: `Focus on ${viewDescriptor.name} View`, value: localize({ key: 'focus view', comment: ['{0} indicates the name of the view to be focused.'] }, "Focus on {0} View", viewDescriptor.name) },
category: composite ? composite.name : CATEGORIES.View,
menu: [{
id: MenuId.CommandPalette,
when: viewDescriptor.when,
}],
keybinding: {
when: ContextKeyExpr.has(`${viewDescriptor.id}.active`),
weight: KeybindingWeight.WorkbenchContrib,
primary: viewDescriptor.focusCommand?.keybindings?.primary,
secondary: viewDescriptor.focusCommand?.keybindings?.secondary,
linux: viewDescriptor.focusCommand?.keybindings?.linux,
mac: viewDescriptor.focusCommand?.keybindings?.mac,
win: viewDescriptor.focusCommand?.keybindings?.win
}
});
}
run(accessor: ServicesAccessor): void {
accessor.get(IViewsService).openView(viewDescriptor.id, true);
}
}));
disposables.add(registerAction2(class ResetViewLocationAction extends Action2 {
constructor() {
super({
id: `${viewDescriptor.id}.resetViewLocation`,
title: {
original: 'Reset Location',
value: localize('resetViewLocation', "Reset Location")
},
menu: [{
id: MenuId.ViewTitleContext,
when: ContextKeyExpr.or(
ContextKeyExpr.and(
ContextKeyExpr.equals('view', viewDescriptor.id),
ContextKeyExpr.equals(`${viewDescriptor.id}.defaultViewLocation`, false)
)
),
group: '1_hide',
order: 2
}],
});
}
run(accessor: ServicesAccessor): void {
const viewDescriptorService = accessor.get(IViewDescriptorService);
const defaultContainer = viewDescriptorService.getDefaultContainerById(viewDescriptor.id)!;
const containerModel = viewDescriptorService.getViewContainerModel(defaultContainer)!;
// The default container is hidden so we should try to reset its location first
if (defaultContainer.hideIfEmpty && containerModel.visibleViewDescriptors.length === 0) {
const defaultLocation = viewDescriptorService.getDefaultViewContainerLocation(defaultContainer)!;
viewDescriptorService.moveViewContainerToLocation(defaultContainer, defaultLocation);
}
viewDescriptorService.moveViewsToContainer([viewDescriptor], viewDescriptorService.getDefaultContainerById(viewDescriptor.id)!);
accessor.get(IViewsService).openView(viewDescriptor.id, true);
}
}));
disposables.add(this.registerOpenViewAction(viewDescriptor));
disposables.add(this.registerFocusViewAction(viewDescriptor, composite?.name && composite.name !== composite.id ? composite.name : CATEGORIES.View));
disposables.add(this.registerResetViewLocationAction(viewDescriptor));
this.viewDisposable.set(viewDescriptor, disposables);
}
}
@@ -328,6 +255,17 @@ export class ViewsService extends Disposable implements IViewsService {
return null;
}
getViewWithId<T extends IView>(id: string): T | null {
const viewContainer = this.viewDescriptorService.getViewContainerByViewId(id);
if (viewContainer) {
const viewPaneContainer: IViewPaneContainer | undefined = this.viewPaneContainers.get(viewContainer.id);
if (viewPaneContainer) {
return viewPaneContainer.getView(id) as T;
}
}
return null;
}
async openView<T extends IView>(id: string, focus?: boolean): Promise<T | null> {
const viewContainer = this.viewDescriptorService.getViewContainerByViewId(id);
if (!viewContainer) {
@@ -398,7 +336,7 @@ export class ViewsService extends Disposable implements IViewsService {
return undefined;
}
const viewPaneContainer = this.viewPaneContainers.get(viewContainer.id)?.viewPaneContainer;
const viewPaneContainer = this.viewPaneContainers.get(viewContainer.id);
if (!viewPaneContainer) {
return undefined;
}
@@ -419,6 +357,202 @@ export class ViewsService extends Disposable implements IViewsService {
return this.viewDescriptorService.getViewContainerLocation(viewContainer) === ViewContainerLocation.Sidebar ? this.viewletService.getProgressIndicator(viewContainer.id) : this.panelService.getProgressIndicator(viewContainer.id);
}
private registerOpenViewContainerAction(viewContainer: ViewContainer): IDisposable {
const disposables = new DisposableStore();
if (viewContainer.openCommandActionDescriptor) {
let { id, title, mnemonicTitle, keybindings, order } = viewContainer.openCommandActionDescriptor ?? { id: viewContainer.id };
title = title ?? viewContainer.title;
const that = this;
disposables.add(registerAction2(class OpenViewContainerAction extends Action2 {
constructor() {
super({
id,
get title(): ICommandActionTitle {
const viewContainerLocation = that.viewDescriptorService.getViewContainerLocation(viewContainer);
if (viewContainerLocation === ViewContainerLocation.Sidebar) {
return { value: localize('show view', "Show {0}", title), original: `Show ${title}` };
} else {
return { value: localize('toggle view', "Toggle {0}", title), original: `Toggle ${title}` };
}
},
category: CATEGORIES.View.value,
precondition: ContextKeyExpr.has(getEnabledViewContainerContextKey(viewContainer.id)),
keybinding: keybindings ? { ...keybindings, weight: KeybindingWeight.WorkbenchContrib } : undefined,
f1: true
});
}
public async run(serviceAccessor: ServicesAccessor): Promise<any> {
const editorGroupService = serviceAccessor.get(IEditorGroupsService);
const viewDescriptorService = serviceAccessor.get(IViewDescriptorService);
const layoutService = serviceAccessor.get(IWorkbenchLayoutService);
const viewsService = serviceAccessor.get(IViewsService);
const viewContainerLocation = viewDescriptorService.getViewContainerLocation(viewContainer);
switch (viewContainerLocation) {
case ViewContainerLocation.Sidebar:
if (!viewsService.isViewContainerVisible(viewContainer.id) || !layoutService.hasFocus(Parts.SIDEBAR_PART)) {
await viewsService.openViewContainer(viewContainer.id, true);
} else {
editorGroupService.activeGroup.focus();
}
break;
case ViewContainerLocation.Panel:
if (!viewsService.isViewContainerVisible(viewContainer.id) || !layoutService.hasFocus(Parts.PANEL_PART)) {
await viewsService.openViewContainer(viewContainer.id, true);
} else {
viewsService.closeViewContainer(viewContainer.id);
}
break;
}
}
}));
if (mnemonicTitle) {
const defaultLocation = this.viewDescriptorService.getDefaultViewContainerLocation(viewContainer);
disposables.add(MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
command: {
id,
title: mnemonicTitle,
},
group: defaultLocation === ViewContainerLocation.Sidebar ? '3_views' : '4_panels',
when: ContextKeyExpr.has(getEnabledViewContainerContextKey(viewContainer.id)),
order: order ?? Number.MAX_VALUE
}));
}
}
return disposables;
}
private registerOpenViewAction(viewDescriptor: IViewDescriptor): IDisposable {
const disposables = new DisposableStore();
if (viewDescriptor.openCommandActionDescriptor) {
const title = viewDescriptor.openCommandActionDescriptor.title ?? viewDescriptor.name;
const commandId = viewDescriptor.openCommandActionDescriptor.id;
const that = this;
disposables.add(registerAction2(class OpenViewAction extends Action2 {
constructor() {
super({
id: commandId,
get title(): ICommandActionTitle {
const viewContainerLocation = that.viewDescriptorService.getViewLocationById(viewDescriptor.id);
if (viewContainerLocation === ViewContainerLocation.Sidebar) {
return { value: localize('show view', "Show {0}", title), original: `Show ${title}` };
} else {
return { value: localize('toggle view', "Toggle {0}", title), original: `Toggle ${title}` };
}
},
category: CATEGORIES.View.value,
precondition: ContextKeyDefinedExpr.create(`${viewDescriptor.id}.active`),
keybinding: viewDescriptor.openCommandActionDescriptor!.keybindings ? { ...viewDescriptor.openCommandActionDescriptor!.keybindings, weight: KeybindingWeight.WorkbenchContrib } : undefined,
f1: true
});
}
public async run(serviceAccessor: ServicesAccessor): Promise<any> {
const editorGroupService = serviceAccessor.get(IEditorGroupsService);
const viewDescriptorService = serviceAccessor.get(IViewDescriptorService);
const layoutService = serviceAccessor.get(IWorkbenchLayoutService);
const viewsService = serviceAccessor.get(IViewsService);
const contextKeyService = serviceAccessor.get(IContextKeyService);
const focusedViewId = FocusedViewContext.getValue(contextKeyService);
if (focusedViewId === viewDescriptor.id) {
if (viewDescriptorService.getViewLocationById(viewDescriptor.id) === ViewContainerLocation.Sidebar) {
editorGroupService.activeGroup.focus();
} else {
layoutService.setPanelHidden(true);
}
} else {
viewsService.openView(viewDescriptor.id, true);
}
}
}));
if (viewDescriptor.openCommandActionDescriptor.mnemonicTitle) {
const defaultViewContainer = this.viewDescriptorService.getDefaultContainerById(viewDescriptor.id);
if (defaultViewContainer) {
const defaultLocation = this.viewDescriptorService.getDefaultViewContainerLocation(defaultViewContainer);
disposables.add(MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
command: {
id: commandId,
title: viewDescriptor.openCommandActionDescriptor.mnemonicTitle,
},
group: defaultLocation === ViewContainerLocation.Sidebar ? '3_views' : '4_panels',
when: ContextKeyDefinedExpr.create(`${viewDescriptor.id}.active`),
order: viewDescriptor.openCommandActionDescriptor.order ?? Number.MAX_VALUE
}));
}
}
}
return disposables;
}
private registerFocusViewAction(viewDescriptor: IViewDescriptor, category?: string | ILocalizedString): IDisposable {
return registerAction2(class FocusViewAction extends Action2 {
constructor() {
super({
id: viewDescriptor.focusCommand ? viewDescriptor.focusCommand.id : `${viewDescriptor.id}.focus`,
title: { original: `Focus on ${viewDescriptor.name} View`, value: localize({ key: 'focus view', comment: ['{0} indicates the name of the view to be focused.'] }, "Focus on {0} View", viewDescriptor.name) },
category,
menu: [{
id: MenuId.CommandPalette,
when: viewDescriptor.when,
}],
keybinding: {
when: ContextKeyExpr.has(`${viewDescriptor.id}.active`),
weight: KeybindingWeight.WorkbenchContrib,
primary: viewDescriptor.focusCommand?.keybindings?.primary,
secondary: viewDescriptor.focusCommand?.keybindings?.secondary,
linux: viewDescriptor.focusCommand?.keybindings?.linux,
mac: viewDescriptor.focusCommand?.keybindings?.mac,
win: viewDescriptor.focusCommand?.keybindings?.win
}
});
}
run(accessor: ServicesAccessor): void {
accessor.get(IViewsService).openView(viewDescriptor.id, true);
}
});
}
private registerResetViewLocationAction(viewDescriptor: IViewDescriptor): IDisposable {
return registerAction2(class ResetViewLocationAction extends Action2 {
constructor() {
super({
id: `${viewDescriptor.id}.resetViewLocation`,
title: {
original: 'Reset Location',
value: localize('resetViewLocation', "Reset Location")
},
menu: [{
id: MenuId.ViewTitleContext,
when: ContextKeyExpr.or(
ContextKeyExpr.and(
ContextKeyExpr.equals('view', viewDescriptor.id),
ContextKeyExpr.equals(`${viewDescriptor.id}.defaultViewLocation`, false)
)
),
group: '1_hide',
order: 2
}],
});
}
run(accessor: ServicesAccessor): void {
const viewDescriptorService = accessor.get(IViewDescriptorService);
const defaultContainer = viewDescriptorService.getDefaultContainerById(viewDescriptor.id)!;
const containerModel = viewDescriptorService.getViewContainerModel(defaultContainer)!;
// The default container is hidden so we should try to reset its location first
if (defaultContainer.hideIfEmpty && containerModel.visibleViewDescriptors.length === 0) {
const defaultLocation = viewDescriptorService.getDefaultViewContainerLocation(defaultContainer)!;
viewDescriptorService.moveViewContainerToLocation(defaultContainer, defaultLocation);
}
viewDescriptorService.moveViewsToContainer([viewDescriptor], viewDescriptorService.getDefaultContainerById(viewDescriptor.id)!);
accessor.get(IViewsService).openView(viewDescriptor.id, true);
}
});
}
private registerViewletOrPanel(viewContainer: ViewContainer, viewContainerLocation: ViewContainerLocation): void {
switch (viewContainerLocation) {
case ViewContainerLocation.Panel:
@@ -445,6 +579,24 @@ export class ViewsService extends Disposable implements IViewsService {
}
}
private createViewPaneContainer(element: HTMLElement, viewContainer: ViewContainer, viewContainerLocation: ViewContainerLocation, disposables: DisposableStore, instantiationService: IInstantiationService): ViewPaneContainer {
const viewPaneContainer: ViewPaneContainer = (instantiationService as any).createInstance(viewContainer.ctorDescriptor!.ctor, ...(viewContainer.ctorDescriptor!.staticArguments || []));
this.viewPaneContainers.set(viewPaneContainer.getId(), viewPaneContainer);
disposables.add(toDisposable(() => this.viewPaneContainers.delete(viewPaneContainer.getId())));
disposables.add(viewPaneContainer.onDidAddViews(views => this.onViewsAdded(views)));
disposables.add(viewPaneContainer.onDidChangeViewVisibility(view => this.onViewsVisibilityChanged(view, view.isBodyVisible())));
disposables.add(viewPaneContainer.onDidRemoveViews(views => this.onViewsRemoved(views)));
disposables.add(viewPaneContainer.onDidFocusView(view => this.focusedViewContextKey.set(view.id)));
disposables.add(viewPaneContainer.onDidBlurView(view => {
if (this.focusedViewContextKey.get() === view.id) {
this.focusedViewContextKey.reset();
}
}));
return viewPaneContainer;
}
private registerPanel(viewContainer: ViewContainer): void {
const that = this;
class PaneContainerPanel extends Panel {
@@ -457,16 +609,20 @@ export class ViewsService extends Disposable implements IViewsService {
@IExtensionService extensionService: IExtensionService,
@IWorkspaceContextService contextService: IWorkspaceContextService,
) {
super(viewContainer.id, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
}
protected createViewPaneContainer(element: HTMLElement): ViewPaneContainer {
const viewPaneContainerDisposables = this._register(new DisposableStore());
// Use composite's instantiation service to get the editor progress service for any editors instantiated within the composite
const viewPaneContainer = (instantiationService as any).createInstance(viewContainer.ctorDescriptor!.ctor, ...(viewContainer.ctorDescriptor!.staticArguments || []));
super(viewContainer.id, viewPaneContainer, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
that.registerViewPaneContainer(this.viewPaneContainer);
return that.createViewPaneContainer(element, viewContainer, ViewContainerLocation.Panel, viewPaneContainerDisposables, this.instantiationService);
}
}
Registry.as<PanelRegistry>(PanelExtensions.Panels).registerPanel(PanelDescriptor.create(
PaneContainerPanel,
viewContainer.id,
viewContainer.name,
viewContainer.title,
undefined,
viewContainer.order,
viewContainer.requestedIndex,
@@ -474,7 +630,6 @@ export class ViewsService extends Disposable implements IViewsService {
}
private deregisterPanel(viewContainer: ViewContainer): void {
this.deregisterViewPaneContainer(viewContainer.id);
Registry.as<PanelRegistry>(PanelExtensions.Panels).deregisterPanel(viewContainer.id);
}
@@ -492,16 +647,30 @@ export class ViewsService extends Disposable implements IViewsService {
@IContextMenuService contextMenuService: IContextMenuService,
@IExtensionService extensionService: IExtensionService,
) {
super(viewContainer.id, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService);
}
protected createViewPaneContainer(element: HTMLElement): ViewPaneContainer {
const viewPaneContainerDisposables = this._register(new DisposableStore());
// Use composite's instantiation service to get the editor progress service for any editors instantiated within the composite
const viewPaneContainer = (instantiationService as any).createInstance(viewContainer.ctorDescriptor!.ctor, ...(viewContainer.ctorDescriptor!.staticArguments || []));
super(viewContainer.id, viewPaneContainer, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService, layoutService, configurationService);
that.registerViewPaneContainer(this.viewPaneContainer);
const viewPaneContainer = that.createViewPaneContainer(element, viewContainer, ViewContainerLocation.Sidebar, viewPaneContainerDisposables, this.instantiationService);
// Only updateTitleArea for non-filter views: microsoft/vscode-remote-release#3676
if (!(viewPaneContainer instanceof FilterViewPaneContainer)) {
viewPaneContainerDisposables.add(Event.any(viewPaneContainer.onDidAddViews, viewPaneContainer.onDidRemoveViews, viewPaneContainer.onTitleAreaUpdate)(() => {
// Update title area since there is no better way to update secondary actions
this.updateTitleArea();
}));
}
return viewPaneContainer;
}
}
Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets).registerViewlet(ViewletDescriptor.create(
PaneContainerViewlet,
viewContainer.id,
viewContainer.name,
viewContainer.title,
isString(viewContainer.icon) ? viewContainer.icon : undefined,
viewContainer.order,
viewContainer.requestedIndex,
@@ -510,7 +679,6 @@ export class ViewsService extends Disposable implements IViewsService {
}
private deregisterViewlet(viewContainer: ViewContainer): void {
this.deregisterViewPaneContainer(viewContainer.id);
Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets).deregisterViewlet(viewContainer.id);
}
}

View File

@@ -46,6 +46,13 @@ export abstract class FilterViewPaneContainer extends ViewPaneContainer {
this.onFilterChanged(newFilterValue);
}));
this._register(this.onDidChangeViewVisibility(view => {
const descriptorMap = Array.from(this.allViews.entries()).find(entry => entry[1].has(view.id));
if (descriptorMap && !this.filterValue?.includes(descriptorMap[0])) {
this.setFilter(descriptorMap[1].get(view.id)!);
}
}));
this._register(this.viewContainerModel.onDidChangeActiveViewDescriptors(() => {
this.updateAllViews(this.viewContainerModel.activeViewDescriptors);
}));
@@ -73,6 +80,8 @@ export abstract class FilterViewPaneContainer extends ViewPaneContainer {
protected abstract getFilterOn(viewDescriptor: IViewDescriptor): string | undefined;
protected abstract setFilter(viewDescriptor: IViewDescriptor): void;
private onFilterChanged(newFilterValue: string[]) {
if (this.allViews.size === 0) {
this.updateAllViews(this.viewContainerModel.activeViewDescriptors);

View File

@@ -3,13 +3,14 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
import { ICommandHandler } from 'vs/platform/commands/common/commands';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
export const inQuickPickContextKeyValue = 'inQuickOpen';
export const InQuickPickContextKey = new RawContextKey<boolean>(inQuickPickContextKeyValue, false);
export const InQuickPickContextKey = new RawContextKey<boolean>(inQuickPickContextKeyValue, false, localize('inQuickOpen', "Whether keyboard focus is inside the quick open control"));
export const inQuickPickContext = ContextKeyExpr.has(inQuickPickContextKeyValue);
export const defaultQuickAccessContextKeyValue = 'inFilesPicker';

View File

@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/style';
import { registerThemingParticipant } from 'vs/platform/theme/common/themeService';
import { iconForeground, foreground, selectionBackground, focusBorder, scrollbarShadow, scrollbarSliderActiveBackground, scrollbarSliderBackground, scrollbarSliderHoverBackground, listHighlightForeground, inputPlaceholderForeground } from 'vs/platform/theme/common/colorRegistry';
import { WORKBENCH_BACKGROUND, TITLE_BAR_ACTIVE_BACKGROUND } from 'vs/workbench/common/theme';

View File

@@ -3,33 +3,24 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as DOM from 'vs/base/browser/dom';
import { Registry } from 'vs/platform/registry/common/platform';
import { Action } from 'vs/base/common/actions';
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
import { IViewlet } from 'vs/workbench/common/viewlet';
import { CompositeDescriptor, CompositeRegistry } from 'vs/workbench/browser/composite';
import { IConstructorSignature0, IInstantiationService, BrandedService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
import { IConstructorSignature0, IInstantiationService, BrandedService } from 'vs/platform/instantiation/common/instantiation';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
import { URI } from 'vs/base/common/uri';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { ViewPaneContainer } from 'vs/workbench/browser/parts/views/viewPaneContainer';
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IWorkspaceContextService } from 'vs/platform/workspace/common/workspace';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { PaneComposite } from 'vs/workbench/browser/panecomposite';
import { Event } from 'vs/base/common/event';
import { FilterViewPaneContainer } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { Action2 } from 'vs/platform/actions/common/actions';
export abstract class Viewlet extends PaneComposite implements IViewlet {
constructor(id: string,
viewPaneContainer: ViewPaneContainer,
@ITelemetryService telemetryService: ITelemetryService,
@IStorageService protected storageService: IStorageService,
@IInstantiationService protected instantiationService: IInstantiationService,
@@ -40,14 +31,7 @@ export abstract class Viewlet extends PaneComposite implements IViewlet {
@IWorkbenchLayoutService protected layoutService: IWorkbenchLayoutService,
@IConfigurationService protected configurationService: IConfigurationService
) {
super(id, viewPaneContainer, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
// Only updateTitleArea for non-filter views: microsoft/vscode-remote-release#3676
if (!(viewPaneContainer instanceof FilterViewPaneContainer)) {
this._register(Event.any(viewPaneContainer.onDidAddViews, viewPaneContainer.onDidRemoveViews, viewPaneContainer.onTitleAreaUpdate)(() => {
// Update title area since there is no better way to update secondary actions
this.updateTitleArea();
}));
}
super(id, telemetryService, storageService, instantiationService, themeService, contextMenuService, extensionService, contextService);
}
}
@@ -118,70 +102,3 @@ export class ViewletRegistry extends CompositeRegistry<Viewlet> {
}
Registry.add(Extensions.Viewlets, new ViewletRegistry());
/**
* A reusable action to show a viewlet with a specific id.
*/
export class ShowViewletAction extends Action {
constructor(
id: string,
name: string,
private readonly viewletId: string,
@IViewletService protected viewletService: IViewletService,
@IEditorGroupsService private readonly editorGroupService: IEditorGroupsService,
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService
) {
super(id, name);
}
async run(): Promise<void> {
// Pass focus to viewlet if not open or focused
if (otherViewletShowing(this.viewletService, this.viewletId) || !sidebarHasFocus(this.viewletService, this.layoutService)) {
await this.viewletService.openViewlet(this.viewletId, true);
return;
}
// Otherwise pass focus to editor group
this.editorGroupService.activeGroup.focus();
}
}
/**
* A reusable action to show a viewlet with a specific id.
*/
export abstract class ShowViewletAction2 extends Action2 {
/**
* Gets the viewlet ID to show.
*/
protected abstract viewletId(): string;
public async run(accessor: ServicesAccessor): Promise<void> {
const viewletService = accessor.get(IViewletService);
const editorGroupService = accessor.get(IEditorGroupsService);
const layoutService = accessor.get(IWorkbenchLayoutService);
// Pass focus to viewlet if not open or focused
if (otherViewletShowing(viewletService, this.viewletId()) || !sidebarHasFocus(viewletService, layoutService)) {
await viewletService.openViewlet(this.viewletId(), true);
return;
}
// Otherwise pass focus to editor group
editorGroupService.activeGroup.focus();
}
}
const otherViewletShowing = (viewletService: IViewletService, viewletId: string): boolean => {
const activeViewlet = viewletService.getActiveViewlet();
return !activeViewlet || activeViewlet.getId() !== viewletId;
};
const sidebarHasFocus = (viewletService: IViewletService, layoutService: IWorkbenchLayoutService): boolean => {
const activeViewlet = viewletService.getActiveViewlet();
const activeElement = document.activeElement;
const sidebarPart = layoutService.getContainer(Parts.SIDEBAR_PART);
return !!(activeViewlet && activeElement && sidebarPart && DOM.isAncestor(activeElement, sidebarPart));
};

View File

@@ -6,8 +6,8 @@
import { mark } from 'vs/base/common/performance';
import { domContentLoaded, detectFullscreen, getCookieValue } from 'vs/base/browser/dom';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { ILogService, ConsoleLogService, MultiplexLogService, getLogLevel } from 'vs/platform/log/common/log';
import { ConsoleLogInAutomationService } from 'vs/platform/log/browser/log';
import { ILogService, ConsoleLogger, MultiplexLogService, getLogLevel } from 'vs/platform/log/common/log';
import { ConsoleLogInAutomationLogger } from 'vs/platform/log/browser/log';
import { Disposable } from 'vs/base/common/lifecycle';
import { BrowserWorkbenchEnvironmentService } from 'vs/workbench/services/environment/browser/environmentService';
import { Workbench } from 'vs/workbench/browser/workbench';
@@ -36,7 +36,7 @@ import type { IWorkbenchConstructionOptions, IWorkspace, IWorkbench } from 'vs/w
import { BrowserStorageService } from 'vs/platform/storage/browser/storageService';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { BufferLogService } from 'vs/platform/log/common/bufferLog';
import { FileLogService } from 'vs/platform/log/common/fileLogService';
import { FileLogger } from 'vs/platform/log/common/fileLog';
import { toLocalISOString } from 'vs/base/common/date';
import { isWorkspaceToOpen, isFolderToOpen } from 'vs/platform/windows/common/windows';
import { initialize } from 'vs/server/browser/client';
@@ -249,10 +249,10 @@ class BrowserMain extends Disposable {
}
logService.logger = new MultiplexLogService(coalesce([
new ConsoleLogService(logService.getLevel()),
new FileLogService('window', environmentService.logFile, logService.getLevel(), fileService),
new ConsoleLogger(logService.getLevel()),
new FileLogger('window', environmentService.logFile, logService.getLevel(), fileService),
// Extension development test CLI: forward everything to test runner
environmentService.isExtensionDevelopment && !!environmentService.extensionTestsLocationURI ? new ConsoleLogInAutomationService(logService.getLevel()) : undefined
environmentService.isExtensionDevelopment && !!environmentService.extensionTestsLocationURI ? new ConsoleLogInAutomationLogger(logService.getLevel()) : undefined
]));
})();
@@ -304,10 +304,10 @@ class BrowserMain extends Disposable {
}
private async createStorageService(payload: IWorkspaceInitializationPayload, environmentService: IWorkbenchEnvironmentService, fileService: IFileService, logService: ILogService): Promise<BrowserStorageService> {
const storageService = new BrowserStorageService(environmentService, fileService);
const storageService = new BrowserStorageService(payload, environmentService, fileService);
try {
await storageService.initialize(payload);
await storageService.initialize();
return storageService;
} catch (error) {

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import * as nls from 'vs/nls';
import { localize } from 'vs/nls';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
import { isMacintosh, isWindows, isLinux, isWeb, isNative } from 'vs/base/common/platform';
import { workbenchConfigurationNodeBase } from 'vs/workbench/common/configuration';
@@ -22,53 +22,53 @@ import { isStandalone } from 'vs/base/browser/browser';
type: 'string',
enum: ['default', 'large'],
enumDescriptions: [
nls.localize('workbench.editor.titleScrollbarSizing.default', "The default size."),
nls.localize('workbench.editor.titleScrollbarSizing.large', "Increases the size, so it can be grabbed more easily with the mouse")
localize('workbench.editor.titleScrollbarSizing.default', "The default size."),
localize('workbench.editor.titleScrollbarSizing.large', "Increases the size, so it can be grabbed more easily with the mouse")
],
description: nls.localize('tabScrollbarHeight', "Controls the height of the scrollbars used for tabs and breadcrumbs in the editor title area."),
description: localize('tabScrollbarHeight', "Controls the height of the scrollbars used for tabs and breadcrumbs in the editor title area."),
default: 'default',
},
'workbench.editor.showTabs': {
'type': 'boolean',
'description': nls.localize('showEditorTabs', "Controls whether opened editors should show in tabs or not."),
'description': localize('showEditorTabs', "Controls whether opened editors should show in tabs or not."),
'default': true
},
'workbench.editor.wrapTabs': {
'type': 'boolean',
'markdownDescription': nls.localize('wrapTabs', "Controls whether tabs should be wrapped over multiple lines when exceeding available space or whether a scrollbar should appear instead. This value is ignored when `#workbench.editor.showTabs#` is disabled."),
'markdownDescription': localize('wrapTabs', "Controls whether tabs should be wrapped over multiple lines when exceeding available space or whether a scrollbar should appear instead. This value is ignored when `#workbench.editor.showTabs#` is disabled."),
'default': false
},
'workbench.editor.scrollToSwitchTabs': {
'type': 'boolean',
'markdownDescription': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'scrollToSwitchTabs' }, "Controls whether scrolling over tabs will open them or not. By default tabs will only reveal upon scrolling, but not open. You can press and hold the Shift-key while scrolling to change this behaviour for that duration. This value is ignored when `#workbench.editor.showTabs#` is disabled."),
'markdownDescription': localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'scrollToSwitchTabs' }, "Controls whether scrolling over tabs will open them or not. By default tabs will only reveal upon scrolling, but not open. You can press and hold the Shift-key while scrolling to change this behaviour for that duration. This value is ignored when `#workbench.editor.showTabs#` is disabled."),
'default': false
},
'workbench.editor.highlightModifiedTabs': {
'type': 'boolean',
'markdownDescription': nls.localize('highlightModifiedTabs', "Controls whether a top border is drawn on modified (dirty) editor tabs or not. This value is ignored when `#workbench.editor.showTabs#` is disabled."),
'markdownDescription': localize('highlightModifiedTabs', "Controls whether a top border is drawn on modified (dirty) editor tabs or not. This value is ignored when `#workbench.editor.showTabs#` is disabled."),
'default': false
},
'workbench.editor.decorations.badges': {
'type': 'boolean',
'markdownDescription': nls.localize('decorations.badges', "Controls whether editor file decorations should use badges."),
'markdownDescription': localize('decorations.badges', "Controls whether editor file decorations should use badges."),
'default': false
},
'workbench.editor.decorations.colors': {
'type': 'boolean',
'markdownDescription': nls.localize('decorations.colors', "Controls whether editor file decorations should use colors."),
'markdownDescription': localize('decorations.colors', "Controls whether editor file decorations should use colors."),
'default': false
},
'workbench.editor.labelFormat': {
'type': 'string',
'enum': ['default', 'short', 'medium', 'long'],
'enumDescriptions': [
nls.localize('workbench.editor.labelFormat.default', "Show the name of the file. When tabs are enabled and two files have the same name in one group the distinguishing sections of each file's path are added. When tabs are disabled, the path relative to the workspace folder is shown if the editor is active."),
nls.localize('workbench.editor.labelFormat.short', "Show the name of the file followed by its directory name."),
nls.localize('workbench.editor.labelFormat.medium', "Show the name of the file followed by its path relative to the workspace folder."),
nls.localize('workbench.editor.labelFormat.long', "Show the name of the file followed by its absolute path.")
localize('workbench.editor.labelFormat.default', "Show the name of the file. When tabs are enabled and two files have the same name in one group the distinguishing sections of each file's path are added. When tabs are disabled, the path relative to the workspace folder is shown if the editor is active."),
localize('workbench.editor.labelFormat.short', "Show the name of the file followed by its directory name."),
localize('workbench.editor.labelFormat.medium', "Show the name of the file followed by its path relative to the workspace folder."),
localize('workbench.editor.labelFormat.long', "Show the name of the file followed by its absolute path.")
],
'default': 'default',
'description': nls.localize({
'description': localize({
comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'],
key: 'tabDescription'
}, "Controls the format of the label for an editor."),
@@ -77,235 +77,241 @@ import { isStandalone } from 'vs/base/browser/browser';
'type': 'string',
'enum': ['content', 'name'],
'enumDescriptions': [
nls.localize('workbench.editor.untitled.labelFormat.content', "The name of the untitled file is derived from the contents of its first line unless it has an associated file path. It will fallback to the name in case the line is empty or contains no word characters."),
nls.localize('workbench.editor.untitled.labelFormat.name', "The name of the untitled file is not derived from the contents of the file."),
localize('workbench.editor.untitled.labelFormat.content', "The name of the untitled file is derived from the contents of its first line unless it has an associated file path. It will fallback to the name in case the line is empty or contains no word characters."),
localize('workbench.editor.untitled.labelFormat.name', "The name of the untitled file is not derived from the contents of the file."),
],
'default': 'content',
'description': nls.localize({
'description': localize({
comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'],
key: 'untitledLabelFormat'
}, "Controls the format of the label for an untitled editor."),
},
'workbench.editor.untitled.hint': {
'type': 'string',
'enum': ['text', 'button', 'hidden'],
'default': 'hidden',
'markdownDescription': localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'untitledHint' }, "Controls if the untitled hint should be inline text in the editor or a floating button or hidden.")
},
'workbench.editor.tabCloseButton': {
'type': 'string',
'enum': ['left', 'right', 'off'],
'default': 'right',
'markdownDescription': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'editorTabCloseButton' }, "Controls the position of the editor's tabs close buttons, or disables them when set to 'off'. This value is ignored when `#workbench.editor.showTabs#` is disabled.")
'markdownDescription': localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'editorTabCloseButton' }, "Controls the position of the editor's tabs close buttons, or disables them when set to 'off'. This value is ignored when `#workbench.editor.showTabs#` is disabled.")
},
'workbench.editor.tabSizing': {
'type': 'string',
'enum': ['fit', 'shrink'],
'default': 'fit',
'enumDescriptions': [
nls.localize('workbench.editor.tabSizing.fit', "Always keep tabs large enough to show the full editor label."),
nls.localize('workbench.editor.tabSizing.shrink', "Allow tabs to get smaller when the available space is not enough to show all tabs at once.")
localize('workbench.editor.tabSizing.fit', "Always keep tabs large enough to show the full editor label."),
localize('workbench.editor.tabSizing.shrink', "Allow tabs to get smaller when the available space is not enough to show all tabs at once.")
],
'markdownDescription': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'tabSizing' }, "Controls the sizing of editor tabs. This value is ignored when `#workbench.editor.showTabs#` is disabled.")
'markdownDescription': localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'tabSizing' }, "Controls the sizing of editor tabs. This value is ignored when `#workbench.editor.showTabs#` is disabled.")
},
'workbench.editor.pinnedTabSizing': {
'type': 'string',
'enum': ['normal', 'compact', 'shrink'],
'default': 'normal',
'enumDescriptions': [
nls.localize('workbench.editor.pinnedTabSizing.normal', "A pinned tab inherits the look of non pinned tabs."),
nls.localize('workbench.editor.pinnedTabSizing.compact', "A pinned tab will show in a compact form with only icon or first letter of the editor name."),
nls.localize('workbench.editor.pinnedTabSizing.shrink', "A pinned tab shrinks to a compact fixed size showing parts of the editor name.")
localize('workbench.editor.pinnedTabSizing.normal', "A pinned tab inherits the look of non pinned tabs."),
localize('workbench.editor.pinnedTabSizing.compact', "A pinned tab will show in a compact form with only icon or first letter of the editor name."),
localize('workbench.editor.pinnedTabSizing.shrink', "A pinned tab shrinks to a compact fixed size showing parts of the editor name.")
],
'markdownDescription': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'pinnedTabSizing' }, "Controls the sizing of pinned editor tabs. Pinned tabs are sorted to the beginning of all opened tabs and typically do not close until unpinned. This value is ignored when `#workbench.editor.showTabs#` is disabled.")
'markdownDescription': localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'pinnedTabSizing' }, "Controls the sizing of pinned editor tabs. Pinned tabs are sorted to the beginning of all opened tabs and typically do not close until unpinned. This value is ignored when `#workbench.editor.showTabs#` is disabled.")
},
'workbench.editor.splitSizing': {
'type': 'string',
'enum': ['distribute', 'split'],
'default': 'distribute',
'enumDescriptions': [
nls.localize('workbench.editor.splitSizingDistribute', "Splits all the editor groups to equal parts."),
nls.localize('workbench.editor.splitSizingSplit', "Splits the active editor group to equal parts.")
localize('workbench.editor.splitSizingDistribute', "Splits all the editor groups to equal parts."),
localize('workbench.editor.splitSizingSplit', "Splits the active editor group to equal parts.")
],
'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'splitSizing' }, "Controls the sizing of editor groups when splitting them.")
'description': localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'splitSizing' }, "Controls the sizing of editor groups when splitting them.")
},
'workbench.editor.splitOnDragAndDrop': {
'type': 'boolean',
'default': true,
'description': nls.localize('splitOnDragAndDrop', "Controls if editor groups can be split from drag and drop operations by dropping an editor or file on the edges of the editor area.")
'description': localize('splitOnDragAndDrop', "Controls if editor groups can be split from drag and drop operations by dropping an editor or file on the edges of the editor area.")
},
'workbench.editor.focusRecentEditorAfterClose': {
'type': 'boolean',
'description': nls.localize('focusRecentEditorAfterClose', "Controls whether tabs are closed in most recently used order or from left to right."),
'description': localize('focusRecentEditorAfterClose', "Controls whether tabs are closed in most recently used order or from left to right."),
'default': true
},
'workbench.editor.showIcons': {
'type': 'boolean',
'description': nls.localize('showIcons', "Controls whether opened editors should show with an icon or not. This requires a file icon theme to be enabled as well."),
'description': localize('showIcons', "Controls whether opened editors should show with an icon or not. This requires a file icon theme to be enabled as well."),
'default': true
},
'workbench.editor.enablePreview': {
'type': 'boolean',
'description': nls.localize('enablePreview', "Controls whether opened editors show as preview. Preview editors do not keep open and are reused until explicitly set to be kept open (e.g. via double click or editing) and show up with an italic font style."),
'description': localize('enablePreview', "Controls whether opened editors show as preview. Preview editors do not keep open and are reused until explicitly set to be kept open (e.g. via double click or editing) and show up with an italic font style."),
'default': true
},
'workbench.editor.enablePreviewFromQuickOpen': {
'type': 'boolean',
'markdownDescription': nls.localize('enablePreviewFromQuickOpen', "Controls whether editors opened from Quick Open show as preview. Preview editors do not keep open and are reused until explicitly set to be kept open (e.g. via double click or editing). This value is ignored when `#workbench.editor.enablePreview#` is disabled."),
'markdownDescription': localize('enablePreviewFromQuickOpen', "Controls whether editors opened from Quick Open show as preview. Preview editors do not keep open and are reused until explicitly set to be kept open (e.g. via double click or editing). This value is ignored when `#workbench.editor.enablePreview#` is disabled."),
'default': false
},
'workbench.editor.enablePreviewFromCodeNavigation': {
'type': 'boolean',
'markdownDescription': nls.localize('enablePreviewFromCodeNavigation', "Controls whether editors remain in preview when a code navigation is started from them. Preview editors do not keep open and are reused until explicitly set to be kept open (e.g. via double click or editing). This value is ignored when `#workbench.editor.enablePreview#` is disabled."),
'markdownDescription': localize('enablePreviewFromCodeNavigation', "Controls whether editors remain in preview when a code navigation is started from them. Preview editors do not keep open and are reused until explicitly set to be kept open (e.g. via double click or editing). This value is ignored when `#workbench.editor.enablePreview#` is disabled."),
'default': false
},
'workbench.editor.closeOnFileDelete': {
'type': 'boolean',
'description': nls.localize('closeOnFileDelete', "Controls whether editors showing a file that was opened during the session should close automatically when getting deleted or renamed by some other process. Disabling this will keep the editor open on such an event. Note that deleting from within the application will always close the editor and that dirty files will never close to preserve your data."),
'description': localize('closeOnFileDelete', "Controls whether editors showing a file that was opened during the session should close automatically when getting deleted or renamed by some other process. Disabling this will keep the editor open on such an event. Note that deleting from within the application will always close the editor and that dirty files will never close to preserve your data."),
'default': false
},
'workbench.editor.openPositioning': {
'type': 'string',
'enum': ['left', 'right', 'first', 'last'],
'default': 'right',
'markdownDescription': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'editorOpenPositioning' }, "Controls where editors open. Select `left` or `right` to open editors to the left or right of the currently active one. Select `first` or `last` to open editors independently from the currently active one.")
'markdownDescription': localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'editorOpenPositioning' }, "Controls where editors open. Select `left` or `right` to open editors to the left or right of the currently active one. Select `first` or `last` to open editors independently from the currently active one.")
},
'workbench.editor.openSideBySideDirection': {
'type': 'string',
'enum': ['right', 'down'],
'default': 'right',
'markdownDescription': nls.localize('sideBySideDirection', "Controls the default direction of editors that are opened side by side (e.g. from the explorer). By default, editors will open on the right hand side of the currently active one. If changed to `down`, the editors will open below the currently active one.")
'markdownDescription': localize('sideBySideDirection', "Controls the default direction of editors that are opened side by side (e.g. from the explorer). By default, editors will open on the right hand side of the currently active one. If changed to `down`, the editors will open below the currently active one.")
},
'workbench.editor.closeEmptyGroups': {
'type': 'boolean',
'description': nls.localize('closeEmptyGroups', "Controls the behavior of empty editor groups when the last tab in the group is closed. When enabled, empty groups will automatically close. When disabled, empty groups will remain part of the grid."),
'description': localize('closeEmptyGroups', "Controls the behavior of empty editor groups when the last tab in the group is closed. When enabled, empty groups will automatically close. When disabled, empty groups will remain part of the grid."),
'default': true
},
'workbench.editor.revealIfOpen': {
'type': 'boolean',
'description': nls.localize('revealIfOpen', "Controls whether an editor is revealed in any of the visible groups if opened. If disabled, an editor will prefer to open in the currently active editor group. If enabled, an already opened editor will be revealed instead of opened again in the currently active editor group. Note that there are some cases where this setting is ignored, e.g. when forcing an editor to open in a specific group or to the side of the currently active group."),
'description': localize('revealIfOpen', "Controls whether an editor is revealed in any of the visible groups if opened. If disabled, an editor will prefer to open in the currently active editor group. If enabled, an already opened editor will be revealed instead of opened again in the currently active editor group. Note that there are some cases where this setting is ignored, e.g. when forcing an editor to open in a specific group or to the side of the currently active group."),
'default': false
},
'workbench.editor.mouseBackForwardToNavigate': {
'type': 'boolean',
'description': nls.localize('mouseBackForwardToNavigate', "Navigate between open files using mouse buttons four and five if provided."),
'description': localize('mouseBackForwardToNavigate', "Navigate between open files using mouse buttons four and five if provided."),
'default': true
},
'workbench.editor.restoreViewState': {
'type': 'boolean',
'description': nls.localize('restoreViewState', "Restores the last view state (e.g. scroll position) when re-opening textual editors after they have been closed."),
'description': localize('restoreViewState', "Restores the last view state (e.g. scroll position) when re-opening textual editors after they have been closed."),
'default': true,
'scope': ConfigurationScope.LANGUAGE_OVERRIDABLE
},
'workbench.editor.centeredLayoutAutoResize': {
'type': 'boolean',
'default': true,
'description': nls.localize('centeredLayoutAutoResize', "Controls if the centered layout should automatically resize to maximum width when more than one group is open. Once only one group is open it will resize back to the original centered width.")
'description': localize('centeredLayoutAutoResize', "Controls if the centered layout should automatically resize to maximum width when more than one group is open. Once only one group is open it will resize back to the original centered width.")
},
'workbench.editor.limit.enabled': {
'type': 'boolean',
'default': false,
'description': nls.localize('limitEditorsEnablement', "Controls if the number of opened editors should be limited or not. When enabled, less recently used editors that are not dirty will close to make space for newly opening editors.")
'description': localize('limitEditorsEnablement', "Controls if the number of opened editors should be limited or not. When enabled, less recently used editors that are not dirty will close to make space for newly opening editors.")
},
'workbench.editor.limit.value': {
'type': 'number',
'default': 10,
'exclusiveMinimum': 0,
'markdownDescription': nls.localize('limitEditorsMaximum', "Controls the maximum number of opened editors. Use the `#workbench.editor.limit.perEditorGroup#` setting to control this limit per editor group or across all groups.")
'markdownDescription': localize('limitEditorsMaximum', "Controls the maximum number of opened editors. Use the `#workbench.editor.limit.perEditorGroup#` setting to control this limit per editor group or across all groups.")
},
'workbench.editor.limit.perEditorGroup': {
'type': 'boolean',
'default': false,
'description': nls.localize('perEditorGroup', "Controls if the limit of maximum opened editors should apply per editor group or across all editor groups.")
'description': localize('perEditorGroup', "Controls if the limit of maximum opened editors should apply per editor group or across all editor groups.")
},
'workbench.commandPalette.history': {
'type': 'number',
'description': nls.localize('commandHistory', "Controls the number of recently used commands to keep in history for the command palette. Set to 0 to disable command history."),
'description': localize('commandHistory', "Controls the number of recently used commands to keep in history for the command palette. Set to 0 to disable command history."),
'default': 50
},
'workbench.commandPalette.preserveInput': {
'type': 'boolean',
'description': nls.localize('preserveInput', "Controls whether the last typed input to the command palette should be restored when opening it the next time."),
'description': localize('preserveInput', "Controls whether the last typed input to the command palette should be restored when opening it the next time."),
'default': false
},
'workbench.quickOpen.closeOnFocusLost': {
'type': 'boolean',
'description': nls.localize('closeOnFocusLost', "Controls whether Quick Open should close automatically once it loses focus."),
'description': localize('closeOnFocusLost', "Controls whether Quick Open should close automatically once it loses focus."),
'default': true
},
'workbench.quickOpen.preserveInput': {
'type': 'boolean',
'description': nls.localize('workbench.quickOpen.preserveInput', "Controls whether the last typed input to Quick Open should be restored when opening it the next time."),
'description': localize('workbench.quickOpen.preserveInput', "Controls whether the last typed input to Quick Open should be restored when opening it the next time."),
'default': false
},
'workbench.settings.openDefaultSettings': {
'type': 'boolean',
'description': nls.localize('openDefaultSettings', "Controls whether opening settings also opens an editor showing all default settings."),
'description': localize('openDefaultSettings', "Controls whether opening settings also opens an editor showing all default settings."),
'default': false
},
'workbench.settings.useSplitJSON': {
'type': 'boolean',
'markdownDescription': nls.localize('useSplitJSON', "Controls whether to use the split JSON editor when editing settings as JSON."),
'markdownDescription': localize('useSplitJSON', "Controls whether to use the split JSON editor when editing settings as JSON."),
'default': false
},
'workbench.settings.openDefaultKeybindings': {
'type': 'boolean',
'description': nls.localize('openDefaultKeybindings', "Controls whether opening keybinding settings also opens an editor showing all default keybindings."),
'description': localize('openDefaultKeybindings', "Controls whether opening keybinding settings also opens an editor showing all default keybindings."),
'default': false
},
'workbench.sideBar.location': {
'type': 'string',
'enum': ['left', 'right'],
'default': 'left',
'description': nls.localize('sideBarLocation', "Controls the location of the sidebar and activity bar. They can either show on the left or right of the workbench.")
'description': localize('sideBarLocation', "Controls the location of the sidebar and activity bar. They can either show on the left or right of the workbench.")
},
'workbench.panel.defaultLocation': {
'type': 'string',
'enum': ['left', 'bottom', 'right'],
'default': 'bottom',
'description': nls.localize('panelDefaultLocation', "Controls the default location of the panel (terminal, debug console, output, problems). It can either show at the bottom, right, or left of the workbench.")
'description': localize('panelDefaultLocation', "Controls the default location of the panel (terminal, debug console, output, problems). It can either show at the bottom, right, or left of the workbench.")
},
'workbench.panel.opensMaximized': {
'type': 'string',
'enum': ['always', 'never', 'preserve'],
'default': 'preserve',
'description': nls.localize('panelOpensMaximized', "Controls whether the panel opens maximized. It can either always open maximized, never open maximized, or open to the last state it was in before being closed."),
'description': localize('panelOpensMaximized', "Controls whether the panel opens maximized. It can either always open maximized, never open maximized, or open to the last state it was in before being closed."),
'enumDescriptions': [
nls.localize('workbench.panel.opensMaximized.always', "Always maximize the panel when opening it."),
nls.localize('workbench.panel.opensMaximized.never', "Never maximize the panel when opening it. The panel will open un-maximized."),
nls.localize('workbench.panel.opensMaximized.preserve', "Open the panel to the state that it was in, before it was closed.")
localize('workbench.panel.opensMaximized.always', "Always maximize the panel when opening it."),
localize('workbench.panel.opensMaximized.never', "Never maximize the panel when opening it. The panel will open un-maximized."),
localize('workbench.panel.opensMaximized.preserve', "Open the panel to the state that it was in, before it was closed.")
]
},
'workbench.statusBar.visible': {
'type': 'boolean',
'default': true,
'description': nls.localize('statusBarVisibility', "Controls the visibility of the status bar at the bottom of the workbench.")
'description': localize('statusBarVisibility', "Controls the visibility of the status bar at the bottom of the workbench.")
},
'workbench.activityBar.visible': {
'type': 'boolean',
'default': true,
'description': nls.localize('activityBarVisibility', "Controls the visibility of the activity bar in the workbench.")
'description': localize('activityBarVisibility', "Controls the visibility of the activity bar in the workbench.")
},
'workbench.activityBar.iconClickBehavior': {
'type': 'string',
'enum': ['toggle', 'focus'],
'default': 'toggle',
'description': nls.localize('activityBarIconClickBehavior', "Controls the behavior of clicking an activity bar icon in the workbench."),
'description': localize('activityBarIconClickBehavior', "Controls the behavior of clicking an activity bar icon in the workbench."),
'enumDescriptions': [
nls.localize('workbench.activityBar.iconClickBehavior.toggle', "Hide the side bar if the clicked item is already visible."),
nls.localize('workbench.activityBar.iconClickBehavior.focus', "Focus side bar if the clicked item is already visible.")
localize('workbench.activityBar.iconClickBehavior.toggle', "Hide the side bar if the clicked item is already visible."),
localize('workbench.activityBar.iconClickBehavior.focus', "Focus side bar if the clicked item is already visible.")
]
},
'workbench.view.alwaysShowHeaderActions': {
'type': 'boolean',
'default': false,
'description': nls.localize('viewVisibility', "Controls the visibility of view header actions. View header actions may either be always visible, or only visible when that view is focused or hovered over.")
'description': localize('viewVisibility', "Controls the visibility of view header actions. View header actions may either be always visible, or only visible when that view is focused or hovered over.")
},
'workbench.fontAliasing': {
'type': 'string',
'enum': ['default', 'antialiased', 'none', 'auto'],
'default': 'default',
'description':
nls.localize('fontAliasing', "Controls font aliasing method in the workbench."),
localize('fontAliasing', "Controls font aliasing method in the workbench."),
'enumDescriptions': [
nls.localize('workbench.fontAliasing.default', "Sub-pixel font smoothing. On most non-retina displays this will give the sharpest text."),
nls.localize('workbench.fontAliasing.antialiased', "Smooth the font on the level of the pixel, as opposed to the subpixel. Can make the font appear lighter overall."),
nls.localize('workbench.fontAliasing.none', "Disables font smoothing. Text will show with jagged sharp edges."),
nls.localize('workbench.fontAliasing.auto', "Applies `default` or `antialiased` automatically based on the DPI of displays.")
localize('workbench.fontAliasing.default', "Sub-pixel font smoothing. On most non-retina displays this will give the sharpest text."),
localize('workbench.fontAliasing.antialiased', "Smooth the font on the level of the pixel, as opposed to the subpixel. Can make the font appear lighter overall."),
localize('workbench.fontAliasing.none', "Disables font smoothing. Text will show with jagged sharp edges."),
localize('workbench.fontAliasing.auto', "Applies `default` or `antialiased` automatically based on the DPI of displays.")
],
'included': isMacintosh
},
@@ -313,10 +319,10 @@ import { isStandalone } from 'vs/base/browser/browser';
'type': 'string',
'enum': ['ui', 'json'],
'enumDescriptions': [
nls.localize('settings.editor.ui', "Use the settings UI editor."),
nls.localize('settings.editor.json', "Use the JSON file editor."),
localize('settings.editor.ui', "Use the settings UI editor."),
localize('settings.editor.json', "Use the JSON file editor."),
],
'description': nls.localize('settings.editor.desc', "Determines which settings editor to use by default."),
'description': localize('settings.editor.desc', "Determines which settings editor to use by default."),
'default': 'ui',
'scope': ConfigurationScope.WINDOW
}
@@ -325,28 +331,28 @@ import { isStandalone } from 'vs/base/browser/browser';
// Window
let windowTitleDescription = nls.localize('windowTitle', "Controls the window title based on the active editor. Variables are substituted based on the context:");
let windowTitleDescription = localize('windowTitle', "Controls the window title based on the active editor. Variables are substituted based on the context:");
windowTitleDescription += '\n- ' + [
nls.localize('activeEditorShort', "`\${activeEditorShort}`: the file name (e.g. myFile.txt)."),
nls.localize('activeEditorMedium', "`\${activeEditorMedium}`: the path of the file relative to the workspace folder (e.g. myFolder/myFileFolder/myFile.txt)."),
nls.localize('activeEditorLong', "`\${activeEditorLong}`: the full path of the file (e.g. /Users/Development/myFolder/myFileFolder/myFile.txt)."),
nls.localize('activeFolderShort', "`\${activeFolderShort}`: the name of the folder the file is contained in (e.g. myFileFolder)."),
nls.localize('activeFolderMedium', "`\${activeFolderMedium}`: the path of the folder the file is contained in, relative to the workspace folder (e.g. myFolder/myFileFolder)."),
nls.localize('activeFolderLong', "`\${activeFolderLong}`: the full path of the folder the file is contained in (e.g. /Users/Development/myFolder/myFileFolder)."),
nls.localize('folderName', "`\${folderName}`: name of the workspace folder the file is contained in (e.g. myFolder)."),
nls.localize('folderPath', "`\${folderPath}`: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder)."),
nls.localize('rootName', "`\${rootName}`: name of the opened workspace or folder (e.g. myFolder or myWorkspace)."),
nls.localize('rootPath', "`\${rootPath}`: file path of the opened workspace or folder (e.g. /Users/Development/myWorkspace)."),
nls.localize('appName', "`\${appName}`: e.g. VS Code."),
nls.localize('remoteName', "`\${remoteName}`: e.g. SSH"),
nls.localize('dirty', "`\${dirty}`: a dirty indicator if the active editor is dirty."),
nls.localize('separator', "`\${separator}`: a conditional separator (\" - \") that only shows when surrounded by variables with values or static text.")
localize('activeEditorShort', "`\${activeEditorShort}`: the file name (e.g. myFile.txt)."),
localize('activeEditorMedium', "`\${activeEditorMedium}`: the path of the file relative to the workspace folder (e.g. myFolder/myFileFolder/myFile.txt)."),
localize('activeEditorLong', "`\${activeEditorLong}`: the full path of the file (e.g. /Users/Development/myFolder/myFileFolder/myFile.txt)."),
localize('activeFolderShort', "`\${activeFolderShort}`: the name of the folder the file is contained in (e.g. myFileFolder)."),
localize('activeFolderMedium', "`\${activeFolderMedium}`: the path of the folder the file is contained in, relative to the workspace folder (e.g. myFolder/myFileFolder)."),
localize('activeFolderLong', "`\${activeFolderLong}`: the full path of the folder the file is contained in (e.g. /Users/Development/myFolder/myFileFolder)."),
localize('folderName', "`\${folderName}`: name of the workspace folder the file is contained in (e.g. myFolder)."),
localize('folderPath', "`\${folderPath}`: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder)."),
localize('rootName', "`\${rootName}`: name of the opened workspace or folder (e.g. myFolder or myWorkspace)."),
localize('rootPath', "`\${rootPath}`: file path of the opened workspace or folder (e.g. /Users/Development/myWorkspace)."),
localize('appName', "`\${appName}`: e.g. VS Code."),
localize('remoteName', "`\${remoteName}`: e.g. SSH"),
localize('dirty', "`\${dirty}`: a dirty indicator if the active editor is dirty."),
localize('separator', "`\${separator}`: a conditional separator (\" - \") that only shows when surrounded by variables with values or static text.")
].join('\n- '); // intentionally concatenated to not produce a string that is too long for translations
registry.registerConfiguration({
'id': 'window',
'order': 8,
'title': nls.localize('windowConfigurationTitle', "Window"),
'title': localize('windowConfigurationTitle', "Window"),
'type': 'object',
'properties': {
'window.title': {
@@ -368,76 +374,80 @@ import { isStandalone } from 'vs/base/browser/browser';
'window.titleSeparator': {
'type': 'string',
'default': isMacintosh ? ' — ' : ' - ',
'markdownDescription': nls.localize("window.titleSeparator", "Separator used by `window.title`.")
'markdownDescription': localize("window.titleSeparator", "Separator used by `window.title`.")
},
'window.menuBarVisibility': {
'type': 'string',
'enum': ['default', 'visible', 'toggle', 'hidden', 'compact'],
'enum': ['classic', 'visible', 'toggle', 'hidden', 'compact'],
'markdownEnumDescriptions': [
nls.localize('window.menuBarVisibility.default', "Menu is only hidden in full screen mode."),
nls.localize('window.menuBarVisibility.visible', "Menu is always visible even in full screen mode."),
nls.localize('window.menuBarVisibility.toggle', "Menu is hidden but can be displayed via Alt key."),
nls.localize('window.menuBarVisibility.hidden', "Menu is always hidden."),
nls.localize('window.menuBarVisibility.compact', "Menu is displayed as a compact button in the sidebar. This value is ignored when `#window.titleBarStyle#` is `native`.")
localize('window.menuBarVisibility.classic', "Menu is displayed at the top of the window and only hidden in full screen mode."),
localize('window.menuBarVisibility.visible', "Menu is always visible at the top of the window even in full screen mode."),
isMacintosh ?
localize('window.menuBarVisibility.toggle.mac', "Menu is hidden but can be displayed at the top of the window by executing the `Focus Application Menu` command.") :
localize('window.menuBarVisibility.toggle', "Menu is hidden but can be displayed at the top of the window via the Alt key."),
localize('window.menuBarVisibility.hidden', "Menu is always hidden."),
localize('window.menuBarVisibility.compact', "Menu is displayed as a compact button in the sidebar. This value is ignored when `#window.titleBarStyle#` is `native`.")
],
'default': isWeb ? 'compact' : 'default',
'default': isWeb ? 'compact' : 'classic',
'scope': ConfigurationScope.APPLICATION,
'description': nls.localize('menuBarVisibility', "Control the visibility of the menu bar. A setting of 'toggle' means that the menu bar is hidden and a single press of the Alt key will show it. By default, the menu bar will be visible, unless the window is full screen."),
'markdownDescription': isMacintosh ?
localize('menuBarVisibility.mac', "Control the visibility of the menu bar. A setting of 'toggle' means that the menu bar is hidden and executing `Focus Application Menu` will show it. A setting of 'compact' will move the menu into the sidebar.") :
localize('menuBarVisibility', "Control the visibility of the menu bar. A setting of 'toggle' means that the menu bar is hidden and a single press of the Alt key will show it. A setting of 'compact' will move the menu into the sidebar."),
'included': isWindows || isLinux || isWeb
},
'window.enableMenuBarMnemonics': {
'type': 'boolean',
'default': !isMacintosh,
'default': true,
'scope': ConfigurationScope.APPLICATION,
'description': nls.localize('enableMenuBarMnemonics', "Controls whether the main menus can be opened via Alt-key shortcuts. Disabling mnemonics allows to bind these Alt-key shortcuts to editor commands instead."),
'included': isWindows || isLinux || isWeb
'description': localize('enableMenuBarMnemonics', "Controls whether the main menus can be opened via Alt-key shortcuts. Disabling mnemonics allows to bind these Alt-key shortcuts to editor commands instead."),
'included': isWindows || isLinux
},
'window.customMenuBarAltFocus': {
'type': 'boolean',
'default': !isMacintosh,
'default': true,
'scope': ConfigurationScope.APPLICATION,
'markdownDescription': nls.localize('customMenuBarAltFocus', "Controls whether the menu bar will be focused by pressing the Alt-key. This setting has no effect on toggling the menu bar with the Alt-key."),
'included': isWindows || isLinux || isWeb
'markdownDescription': localize('customMenuBarAltFocus', "Controls whether the menu bar will be focused by pressing the Alt-key. This setting has no effect on toggling the menu bar with the Alt-key."),
'included': isWindows || isLinux
},
'window.openFilesInNewWindow': {
'type': 'string',
'enum': ['on', 'off', 'default'],
'enumDescriptions': [
nls.localize('window.openFilesInNewWindow.on', "Files will open in a new window."),
nls.localize('window.openFilesInNewWindow.off', "Files will open in the window with the files' folder open or the last active window."),
localize('window.openFilesInNewWindow.on', "Files will open in a new window."),
localize('window.openFilesInNewWindow.off', "Files will open in the window with the files' folder open or the last active window."),
isMacintosh ?
nls.localize('window.openFilesInNewWindow.defaultMac', "Files will open in the window with the files' folder open or the last active window unless opened via the Dock or from Finder.") :
nls.localize('window.openFilesInNewWindow.default', "Files will open in a new window unless picked from within the application (e.g. via the File menu).")
localize('window.openFilesInNewWindow.defaultMac', "Files will open in the window with the files' folder open or the last active window unless opened via the Dock or from Finder.") :
localize('window.openFilesInNewWindow.default', "Files will open in a new window unless picked from within the application (e.g. via the File menu).")
],
'default': 'off',
'scope': ConfigurationScope.APPLICATION,
'markdownDescription':
isMacintosh ?
nls.localize('openFilesInNewWindowMac', "Controls whether files should open in a new window. \nNote that there can still be cases where this setting is ignored (e.g. when using the `--new-window` or `--reuse-window` command line option).") :
nls.localize('openFilesInNewWindow', "Controls whether files should open in a new window.\nNote that there can still be cases where this setting is ignored (e.g. when using the `--new-window` or `--reuse-window` command line option).")
localize('openFilesInNewWindowMac', "Controls whether files should open in a new window. \nNote that there can still be cases where this setting is ignored (e.g. when using the `--new-window` or `--reuse-window` command line option).") :
localize('openFilesInNewWindow', "Controls whether files should open in a new window.\nNote that there can still be cases where this setting is ignored (e.g. when using the `--new-window` or `--reuse-window` command line option).")
},
'window.openFoldersInNewWindow': {
'type': 'string',
'enum': ['on', 'off', 'default'],
'enumDescriptions': [
nls.localize('window.openFoldersInNewWindow.on', "Folders will open in a new window."),
nls.localize('window.openFoldersInNewWindow.off', "Folders will replace the last active window."),
nls.localize('window.openFoldersInNewWindow.default', "Folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu).")
localize('window.openFoldersInNewWindow.on', "Folders will open in a new window."),
localize('window.openFoldersInNewWindow.off', "Folders will replace the last active window."),
localize('window.openFoldersInNewWindow.default', "Folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu).")
],
'default': 'default',
'scope': ConfigurationScope.APPLICATION,
'markdownDescription': nls.localize('openFoldersInNewWindow', "Controls whether folders should open in a new window or replace the last active window.\nNote that there can still be cases where this setting is ignored (e.g. when using the `--new-window` or `--reuse-window` command line option).")
'markdownDescription': localize('openFoldersInNewWindow', "Controls whether folders should open in a new window or replace the last active window.\nNote that there can still be cases where this setting is ignored (e.g. when using the `--new-window` or `--reuse-window` command line option).")
},
'window.confirmBeforeClose': {
'type': 'string',
'enum': ['always', 'keyboardOnly', 'never'],
'enumDescriptions': [
nls.localize('window.confirmBeforeClose.always', "Always try to ask for confirmation. Note that browsers may still decide to close a tab or window without confirmation."),
nls.localize('window.confirmBeforeClose.keyboardOnly', "Only ask for confirmation if a keybinding was detected. Note that detection may not be possible in some cases."),
nls.localize('window.confirmBeforeClose.never', "Never explicitly ask for confirmation unless data loss is imminent.")
localize('window.confirmBeforeClose.always', "Always try to ask for confirmation. Note that browsers may still decide to close a tab or window without confirmation."),
localize('window.confirmBeforeClose.keyboardOnly', "Only ask for confirmation if a keybinding was detected. Note that detection may not be possible in some cases."),
localize('window.confirmBeforeClose.never', "Never explicitly ask for confirmation unless data loss is imminent.")
],
'default': isWeb && !isStandalone ? 'keyboardOnly' : 'never', // on by default in web, unless PWA
'description': nls.localize('confirmBeforeCloseWeb', "Controls whether to show a confirmation dialog before closing the browser tab or window. Note that even if enabled, browsers may still decide to close a tab or window without confirmation and that this setting is only a hint that may not work in all cases."),
'description': localize('confirmBeforeCloseWeb', "Controls whether to show a confirmation dialog before closing the browser tab or window. Note that even if enabled, browsers may still decide to close a tab or window without confirmation and that this setting is only a hint that may not work in all cases."),
'scope': ConfigurationScope.APPLICATION,
'included': isWeb
}
@@ -448,48 +458,48 @@ import { isStandalone } from 'vs/base/browser/browser';
registry.registerConfiguration({
'id': 'zenMode',
'order': 9,
'title': nls.localize('zenModeConfigurationTitle', "Zen Mode"),
'title': localize('zenModeConfigurationTitle', "Zen Mode"),
'type': 'object',
'properties': {
'zenMode.fullScreen': {
'type': 'boolean',
'default': true,
'description': nls.localize('zenMode.fullScreen', "Controls whether turning on Zen Mode also puts the workbench into full screen mode.")
'description': localize('zenMode.fullScreen', "Controls whether turning on Zen Mode also puts the workbench into full screen mode.")
},
'zenMode.centerLayout': {
'type': 'boolean',
'default': true,
'description': nls.localize('zenMode.centerLayout', "Controls whether turning on Zen Mode also centers the layout.")
'description': localize('zenMode.centerLayout', "Controls whether turning on Zen Mode also centers the layout.")
},
'zenMode.hideTabs': {
'type': 'boolean',
'default': true,
'description': nls.localize('zenMode.hideTabs', "Controls whether turning on Zen Mode also hides workbench tabs.")
'description': localize('zenMode.hideTabs', "Controls whether turning on Zen Mode also hides workbench tabs.")
},
'zenMode.hideStatusBar': {
'type': 'boolean',
'default': true,
'description': nls.localize('zenMode.hideStatusBar', "Controls whether turning on Zen Mode also hides the status bar at the bottom of the workbench.")
'description': localize('zenMode.hideStatusBar', "Controls whether turning on Zen Mode also hides the status bar at the bottom of the workbench.")
},
'zenMode.hideActivityBar': {
'type': 'boolean',
'default': true,
'description': nls.localize('zenMode.hideActivityBar', "Controls whether turning on Zen Mode also hides the activity bar either at the left or right of the workbench.")
'description': localize('zenMode.hideActivityBar', "Controls whether turning on Zen Mode also hides the activity bar either at the left or right of the workbench.")
},
'zenMode.hideLineNumbers': {
'type': 'boolean',
'default': true,
'description': nls.localize('zenMode.hideLineNumbers', "Controls whether turning on Zen Mode also hides the editor line numbers.")
'description': localize('zenMode.hideLineNumbers', "Controls whether turning on Zen Mode also hides the editor line numbers.")
},
'zenMode.restore': {
'type': 'boolean',
'default': true,
'description': nls.localize('zenMode.restore', "Controls whether a window should restore to zen mode if it was exited in zen mode.")
'description': localize('zenMode.restore', "Controls whether a window should restore to zen mode if it was exited in zen mode.")
},
'zenMode.silentNotifications': {
'type': 'boolean',
'default': true,
'description': nls.localize('zenMode.silentNotifications', "Controls whether notifications are shown while in zen mode. If true, only error notifications will pop out.")
'description': localize('zenMode.silentNotifications', "Controls whether notifications are shown while in zen mode. If true, only error notifications will pop out.")
}
}
});

View File

@@ -4,9 +4,8 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/workbench/browser/style';
import { localize } from 'vs/nls';
import { Emitter, setGlobalLeakWarningThreshold } from 'vs/base/common/event';
import { Event, Emitter, setGlobalLeakWarningThreshold } from 'vs/base/common/event';
import { runWhenIdle } from 'vs/base/common/async';
import { getZoomLevel, isFirefox, isSafari, isChrome, getPixelRatio } from 'vs/base/browser/browser';
import { mark } from 'vs/base/common/performance';
@@ -342,10 +341,10 @@ export class Workbench extends Layout {
// Create Parts
[
{ id: Parts.TITLEBAR_PART, role: 'contentinfo', classes: ['titlebar'] },
{ id: Parts.ACTIVITYBAR_PART, role: 'navigation', classes: ['activitybar', this.state.sideBar.position === Position.LEFT ? 'left' : 'right'] },
{ id: Parts.SIDEBAR_PART, role: 'complementary', classes: ['sidebar', this.state.sideBar.position === Position.LEFT ? 'left' : 'right'] },
{ id: Parts.ACTIVITYBAR_PART, role: 'none', classes: ['activitybar', this.state.sideBar.position === Position.LEFT ? 'left' : 'right'] }, // Use role 'none' for some parts to make screen readers less chatty #114892
{ id: Parts.SIDEBAR_PART, role: 'none', classes: ['sidebar', this.state.sideBar.position === Position.LEFT ? 'left' : 'right'] },
{ id: Parts.EDITOR_PART, role: 'main', classes: ['editor'], options: { restorePreviousState: this.state.editor.restoreEditors } },
{ id: Parts.PANEL_PART, role: 'complementary', classes: ['panel', positionToString(this.state.panel.position)] },
{ id: Parts.PANEL_PART, role: 'none', classes: ['panel', positionToString(this.state.panel.position)] },
{ id: Parts.STATUSBAR_PART, role: 'status', classes: ['statusbar'] }
].forEach(({ id, role, classes, options }) => {
const partContainer = this.createPart(id, role, classes);
@@ -392,6 +391,11 @@ export class Workbench extends Layout {
// Register Commands
registerNotificationCommands(notificationsCenter, notificationsToasts);
// Register with Layout
this.registerNotifications({
onDidChangeNotificationsVisibility: Event.map(Event.any(notificationsToasts.onDidChangeVisibility, notificationsCenter.onDidChangeVisibility), () => notificationsToasts.isVisible || notificationsCenter.isVisible)
});
}
private async restoreWorkbench(