main.contribution.ts 47.2 KB
Newer Older
E
Erich Gamma 已提交
1 2 3 4 5
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

6
import { Registry } from 'vs/platform/registry/common/platform';
7
import * as nls from 'vs/nls';
8
import product from 'vs/platform/node/product';
9
import * as os from 'os';
S
Sandeep Somavarapu 已提交
10
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
11
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
B
Benjamin Pasero 已提交
12
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
J
Johannes Rieken 已提交
13
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
14
import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
J
Joao Moreno 已提交
15
import { KeybindingsReferenceAction, OpenDocumentationUrlAction, OpenIntroductoryVideosUrlAction, OpenTipsAndTricksUrlAction, OpenIssueReporterAction, ReportPerformanceIssueUsingReporterAction, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleFullScreenAction, ToggleMenuBarAction, CloseWorkspaceAction, CloseCurrentWindowAction, SwitchWindow, NewWindowAction, NavigateUpAction, NavigateDownAction, NavigateLeftAction, NavigateRightAction, IncreaseViewSizeAction, DecreaseViewSizeAction, ToggleSharedProcessAction, QuickSwitchWindow, QuickOpenRecentAction, inRecentFilesPickerContextKey, ShowAboutDialogAction, InspectContextKeysAction, OpenProcessExplorer, OpenTwitterUrlAction, OpenRequestFeatureUrlAction, OpenPrivacyStatementUrlAction, OpenLicenseUrlAction, OpenRecentAction, ToggleScreencastModeAction } from 'vs/workbench/electron-browser/actions';
I
isidor 已提交
16
import { registerCommands, QUIT_ID } from 'vs/workbench/electron-browser/commands';
I
isidor 已提交
17
import { AddRootFolderAction, GlobalRemoveRootFolderAction, OpenWorkspaceAction, SaveWorkspaceAsAction, OpenWorkspaceConfigFileAction, DuplicateWorkspaceInNewWindowAction, OpenFileFolderAction, OpenFileAction, OpenFolderAction } from 'vs/workbench/browser/actions/workspaceActions';
S
Sandeep Somavarapu 已提交
18
import { ContextKeyExpr, RawContextKey } from 'vs/platform/contextkey/common/contextkey';
19
import { inQuickOpenContext, getQuickNavigateHandler } from 'vs/workbench/browser/parts/quickopen/quickopen';
20
import { KeybindingsRegistry, KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry';
S
Sandeep Somavarapu 已提交
21 22
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
I
isidor 已提交
23
import { ADD_ROOT_FOLDER_COMMAND_ID } from 'vs/workbench/browser/actions/workspaceCommands';
M
Martin Aeschlimann 已提交
24
import { IsMacContext } from 'vs/platform/workbench/common/contextkeys';
E
Erich Gamma 已提交
25

26 27
// Contribute Commands
registerCommands();
28

E
Erich Gamma 已提交
29 30
// Contribute Global Actions
const viewCategory = nls.localize('view', "View");
B
Benjamin Pasero 已提交
31
const helpCategory = nls.localize('help', "Help");
B
cleanup  
Benjamin Pasero 已提交
32
const fileCategory = nls.localize('file', "File");
B
Benjamin Pasero 已提交
33
const workbenchActionsRegistry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
34
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(NewWindowAction, NewWindowAction.ID, NewWindowAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_N }), 'New Window');
35
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseCurrentWindowAction, CloseCurrentWindowAction.ID, CloseCurrentWindowAction.LABEL, { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_W }), 'Close Window');
A
Alex Dima 已提交
36
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(SwitchWindow, SwitchWindow.ID, SwitchWindow.LABEL, { primary: 0, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_W } }), 'Switch Window...');
B
Benjamin Pasero 已提交
37 38
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(QuickSwitchWindow, QuickSwitchWindow.ID, QuickSwitchWindow.LABEL), 'Quick Switch Window...');
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenRecentAction, QuickOpenRecentAction.ID, QuickOpenRecentAction.LABEL), 'File: Quick Open Recent...', fileCategory);
39

I
isidor 已提交
40
if (isMacintosh) {
M
Martin Aeschlimann 已提交
41
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenFileFolderAction, OpenFileFolderAction.ID, OpenFileFolderAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_O }), 'File: Open...', fileCategory);
I
isidor 已提交
42
} else {
M
Martin Aeschlimann 已提交
43 44
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenFileAction, OpenFileAction.ID, OpenFileAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_O }), 'File: Open File...', fileCategory);
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenFolderAction, OpenFolderAction.ID, OpenFolderAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_O) }), 'File: Open Folder...', fileCategory);
I
isidor 已提交
45
}
46

47
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseWorkspaceAction, CloseWorkspaceAction.ID, CloseWorkspaceAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyCode.KEY_F) }), 'File: Close Workspace', fileCategory);
B
Benjamin Pasero 已提交
48
if (!!product.reportIssueUrl) {
49
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenIssueReporterAction, OpenIssueReporterAction.ID, OpenIssueReporterAction.LABEL), 'Help: Open Issue Reporter', helpCategory);
50
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ReportPerformanceIssueUsingReporterAction, ReportPerformanceIssueUsingReporterAction.ID, ReportPerformanceIssueUsingReporterAction.LABEL), 'Help: Report Performance Issue', helpCategory);
B
Benjamin Pasero 已提交
51
}
52

53
if (KeybindingsReferenceAction.AVAILABLE) {
C
Christof Marti 已提交
54
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(KeybindingsReferenceAction, KeybindingsReferenceAction.ID, KeybindingsReferenceAction.LABEL, { primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_R) }), 'Help: Keyboard Shortcuts Reference', helpCategory);
55
}
56

C
Christof Marti 已提交
57 58 59
if (OpenDocumentationUrlAction.AVAILABLE) {
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenDocumentationUrlAction, OpenDocumentationUrlAction.ID, OpenDocumentationUrlAction.LABEL), 'Help: Documentation', helpCategory);
}
60

61 62 63
if (OpenIntroductoryVideosUrlAction.AVAILABLE) {
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenIntroductoryVideosUrlAction, OpenIntroductoryVideosUrlAction.ID, OpenIntroductoryVideosUrlAction.LABEL), 'Help: Introductory Videos', helpCategory);
}
64

65 66 67
if (OpenTipsAndTricksUrlAction.AVAILABLE) {
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenTipsAndTricksUrlAction, OpenTipsAndTricksUrlAction.ID, OpenTipsAndTricksUrlAction.LABEL), 'Help: Tips and Tricks', helpCategory);
}
68

N
nathan 已提交
69
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenTwitterUrlAction, OpenTwitterUrlAction.ID, OpenTwitterUrlAction.LABEL), 'Help: Join Us on Twitter', helpCategory);
B
Benjamin Pasero 已提交
70
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenRequestFeatureUrlAction, OpenRequestFeatureUrlAction.ID, OpenRequestFeatureUrlAction.LABEL), 'Help: Search Feature Requests', helpCategory);
S
SteVen Batten 已提交
71 72
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenLicenseUrlAction, OpenLicenseUrlAction.ID, OpenLicenseUrlAction.LABEL), 'Help: View License', helpCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenPrivacyStatementUrlAction, OpenPrivacyStatementUrlAction.ID, OpenPrivacyStatementUrlAction.LABEL), 'Help: Privacy Statement', helpCategory);
J
Joao Moreno 已提交
73 74
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowAboutDialogAction, ShowAboutDialogAction.ID, ShowAboutDialogAction.LABEL), 'Help: About', helpCategory);

75 76 77 78 79
workbenchActionsRegistry.registerWorkbenchAction(
	new SyncActionDescriptor(ZoomInAction, ZoomInAction.ID, ZoomInAction.LABEL, {
		primary: KeyMod.CtrlCmd | KeyCode.US_EQUAL,
		secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_EQUAL, KeyMod.CtrlCmd | KeyCode.NUMPAD_ADD]
	}), 'View: Zoom In', viewCategory);
80

81 82 83
workbenchActionsRegistry.registerWorkbenchAction(
	new SyncActionDescriptor(ZoomOutAction, ZoomOutAction.ID, ZoomOutAction.LABEL, {
		primary: KeyMod.CtrlCmd | KeyCode.US_MINUS,
84 85
		secondary: [KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_MINUS, KeyMod.CtrlCmd | KeyCode.NUMPAD_SUBTRACT],
		linux: { primary: KeyMod.CtrlCmd | KeyCode.US_MINUS, secondary: [KeyMod.CtrlCmd | KeyCode.NUMPAD_SUBTRACT] }
86 87
	}), 'View: Zoom Out', viewCategory
);
88

89 90 91 92 93
workbenchActionsRegistry.registerWorkbenchAction(
	new SyncActionDescriptor(ZoomResetAction, ZoomResetAction.ID, ZoomResetAction.LABEL, {
		primary: KeyMod.CtrlCmd | KeyCode.NUMPAD_0
	}), 'View: Reset Zoom', viewCategory
);
94

95
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleFullScreenAction, ToggleFullScreenAction.ID, ToggleFullScreenAction.LABEL, { primary: KeyCode.F11, mac: { primary: KeyMod.CtrlCmd | KeyMod.WinCtrl | KeyCode.KEY_F } }), 'View: Toggle Full Screen', viewCategory);
96
if (isWindows || isLinux) {
97
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleMenuBarAction, ToggleMenuBarAction.ID, ToggleMenuBarAction.LABEL), 'View: Toggle Menu Bar', viewCategory);
98
}
B
Benjamin Pasero 已提交
99 100 101 102
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(NavigateUpAction, NavigateUpAction.ID, NavigateUpAction.LABEL, null), 'View: Navigate to the View Above', viewCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(NavigateDownAction, NavigateDownAction.ID, NavigateDownAction.LABEL, null), 'View: Navigate to the View Below', viewCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(NavigateLeftAction, NavigateLeftAction.ID, NavigateLeftAction.LABEL, null), 'View: Navigate to the View on the Left', viewCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(NavigateRightAction, NavigateRightAction.ID, NavigateRightAction.LABEL, null), 'View: Navigate to the View on the Right', viewCategory);
E
Erich Gamma 已提交
103

104 105
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(IncreaseViewSizeAction, IncreaseViewSizeAction.ID, IncreaseViewSizeAction.LABEL, null), 'View: Increase Current View Size', viewCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(DecreaseViewSizeAction, DecreaseViewSizeAction.ID, DecreaseViewSizeAction.LABEL, null), 'View: Decrease Current View Size', viewCategory);
106

107
const workspacesCategory = nls.localize('workspaces', "Workspaces");
M
Martin Aeschlimann 已提交
108
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(AddRootFolderAction, AddRootFolderAction.ID, AddRootFolderAction.LABEL), 'Workspaces: Add Folder to Workspace...', workspacesCategory);
109
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(GlobalRemoveRootFolderAction, GlobalRemoveRootFolderAction.ID, GlobalRemoveRootFolderAction.LABEL), 'Workspaces: Remove Folder from Workspace...', workspacesCategory);
M
Martin Aeschlimann 已提交
110 111
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenWorkspaceAction, OpenWorkspaceAction.ID, OpenWorkspaceAction.LABEL), 'Workspaces: Open Workspace...', workspacesCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(SaveWorkspaceAsAction, SaveWorkspaceAsAction.ID, SaveWorkspaceAsAction.LABEL), 'Workspaces: Save Workspace As...', workspacesCategory);
I
isidor 已提交
112
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(DuplicateWorkspaceInNewWindowAction, DuplicateWorkspaceInNewWindowAction.ID, DuplicateWorkspaceInNewWindowAction.LABEL), 'Workspaces: Duplicate Workspace in New Window', workspacesCategory);
B
Benjamin Pasero 已提交
113

S
Sandeep Somavarapu 已提交
114 115 116 117 118 119
CommandsRegistry.registerCommand(OpenWorkspaceConfigFileAction.ID, serviceAccessor => {
	serviceAccessor.get(IInstantiationService).createInstance(OpenWorkspaceConfigFileAction, OpenWorkspaceConfigFileAction.ID, OpenWorkspaceConfigFileAction.LABEL).run();
});
MenuRegistry.appendMenuItem(MenuId.CommandPalette, {
	command: {
		id: OpenWorkspaceConfigFileAction.ID,
B
Benjamin Pasero 已提交
120
		title: { value: `${workspacesCategory}: ${OpenWorkspaceConfigFileAction.LABEL}`, original: 'Workspaces: Open Workspace Configuration File' },
S
Sandeep Somavarapu 已提交
121 122 123 124
	},
	when: new RawContextKey<string>('workbenchState', '').isEqualTo('workspace')
});

125 126 127
// Developer related actions
const developerCategory = nls.localize('developer', "Developer");
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleSharedProcessAction, ToggleSharedProcessAction.ID, ToggleSharedProcessAction.LABEL), 'Developer: Toggle Shared Process', developerCategory);
J
Joao Moreno 已提交
128
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(InspectContextKeysAction, InspectContextKeysAction.ID, InspectContextKeysAction.LABEL), 'Developer: Inspect Context Keys', developerCategory);
J
Joao Moreno 已提交
129
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleScreencastModeAction, ToggleScreencastModeAction.ID, ToggleScreencastModeAction.LABEL), 'Developer: Toggle Mouse Clicks', developerCategory);
130
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenProcessExplorer, OpenProcessExplorer.ID, OpenProcessExplorer.LABEL), 'Developer: Open Process Explorer', developerCategory);
131

132 133 134 135 136
const recentFilesPickerContext = ContextKeyExpr.and(inQuickOpenContext, ContextKeyExpr.has(inRecentFilesPickerContextKey));

const quickOpenNavigateNextInRecentFilesPickerId = 'workbench.action.quickOpenNavigateNextInRecentFilesPicker';
KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: quickOpenNavigateNextInRecentFilesPickerId,
137
	weight: KeybindingWeight.WorkbenchContrib + 50,
138 139 140 141 142 143 144 145 146
	handler: getQuickNavigateHandler(quickOpenNavigateNextInRecentFilesPickerId, true),
	when: recentFilesPickerContext,
	primary: KeyMod.CtrlCmd | KeyCode.KEY_R,
	mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_R }
});

const quickOpenNavigatePreviousInRecentFilesPicker = 'workbench.action.quickOpenNavigatePreviousInRecentFilesPicker';
KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: quickOpenNavigatePreviousInRecentFilesPicker,
147
	weight: KeybindingWeight.WorkbenchContrib + 50,
148 149 150 151 152 153
	handler: getQuickNavigateHandler(quickOpenNavigatePreviousInRecentFilesPicker, false),
	when: recentFilesPickerContext,
	primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_R,
	mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_R }
});

I
isidor 已提交
154 155 156 157 158 159 160 161 162 163 164
// Menu registration - file menu

MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	group: '1_new',
	command: {
		id: NewWindowAction.ID,
		title: nls.localize({ key: 'miNewWindow', comment: ['&& denotes a mnemonic'] }, "New &&Window")
	},
	order: 2
});

I
isidor 已提交
165 166 167 168 169 170 171
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	group: '2_open',
	command: {
		id: OpenFileAction.ID,
		title: nls.localize({ key: 'miOpenFile', comment: ['&& denotes a mnemonic'] }, "&&Open File...")
	},
	order: 1,
M
Martin Aeschlimann 已提交
172
	when: IsMacContext.toNegated()
I
isidor 已提交
173
});
S
SteVen Batten 已提交
174

I
isidor 已提交
175 176 177 178 179 180 181
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	group: '2_open',
	command: {
		id: OpenFolderAction.ID,
		title: nls.localize({ key: 'miOpenFolder', comment: ['&& denotes a mnemonic'] }, "Open &&Folder...")
	},
	order: 2,
M
Martin Aeschlimann 已提交
182
	when: IsMacContext.toNegated()
I
isidor 已提交
183 184 185 186 187 188 189 190 191
});

MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	group: '2_open',
	command: {
		id: OpenFileFolderAction.ID,
		title: nls.localize({ key: 'miOpen', comment: ['&& denotes a mnemonic'] }, "&&Open...")
	},
	order: 1,
M
Martin Aeschlimann 已提交
192
	when: IsMacContext
I
isidor 已提交
193
});
I
isidor 已提交
194 195 196 197 198 199 200

MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	group: '2_open',
	command: {
		id: OpenWorkspaceAction.ID,
		title: nls.localize({ key: 'miOpenWorkspace', comment: ['&& denotes a mnemonic'] }, "Open Wor&&kspace...")
	},
M
Martin Aeschlimann 已提交
201
	order: 3
I
isidor 已提交
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
});

MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	title: nls.localize({ key: 'miOpenRecent', comment: ['&& denotes a mnemonic'] }, "Open &&Recent"),
	submenu: MenuId.MenubarRecentMenu,
	group: '2_open',
	order: 4
});


// More
MenuRegistry.appendMenuItem(MenuId.MenubarRecentMenu, {
	group: 'y_more',
	command: {
		id: OpenRecentAction.ID,
		title: nls.localize({ key: 'miMore', comment: ['&& denotes a mnemonic'] }, "&&More...")
	},
	order: 1
});

MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	group: '3_workspace',
	command: {
I
isidor 已提交
225
		id: ADD_ROOT_FOLDER_COMMAND_ID,
I
isidor 已提交
226 227
		title: nls.localize({ key: 'miAddFolderToWorkspace', comment: ['&& denotes a mnemonic'] }, "A&&dd Folder to Workspace...")
	},
M
Martin Aeschlimann 已提交
228
	order: 1
I
isidor 已提交
229 230 231 232 233 234 235 236
});

MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	group: '3_workspace',
	command: {
		id: SaveWorkspaceAsAction.ID,
		title: nls.localize('miSaveWorkspaceAs', "Save Workspace As...")
	},
M
Martin Aeschlimann 已提交
237
	order: 2
I
isidor 已提交
238 239
});

I
isidor 已提交
240 241 242 243 244 245 246
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	title: nls.localize({ key: 'miPreferences', comment: ['&& denotes a mnemonic'] }, "&&Preferences"),
	submenu: MenuId.MenubarPreferencesMenu,
	group: '5_autosave',
	order: 2,
	when: IsMacContext.toNegated()
});
I
isidor 已提交
247 248 249 250 251

MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	group: '6_close',
	command: {
		id: CloseWorkspaceAction.ID,
S
SteVen Batten 已提交
252 253
		title: nls.localize({ key: 'miCloseFolder', comment: ['&& denotes a mnemonic'] }, "Close &&Folder"),
		precondition: new RawContextKey<number>('workspaceFolderCount', 0).notEqualsTo('0')
I
isidor 已提交
254
	},
S
SteVen Batten 已提交
255 256 257 258 259 260 261 262 263 264 265 266
	order: 3,
	when: new RawContextKey<string>('workbenchState', '').notEqualsTo('workspace')
});

MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	group: '6_close',
	command: {
		id: CloseWorkspaceAction.ID,
		title: nls.localize({ key: 'miCloseWorkspace', comment: ['&& denotes a mnemonic'] }, "Close &&Workspace")
	},
	order: 3,
	when: new RawContextKey<string>('workbenchState', '').isEqualTo('workspace')
I
isidor 已提交
267 268 269 270 271 272 273 274 275 276 277
});

MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	group: '6_close',
	command: {
		id: CloseCurrentWindowAction.ID,
		title: nls.localize({ key: 'miCloseWindow', comment: ['&& denotes a mnemonic'] }, "Clos&&e Window")
	},
	order: 4
});

S
SteVen Batten 已提交
278 279 280 281 282 283 284 285 286
MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
	group: 'z_Exit',
	command: {
		id: QUIT_ID,
		title: nls.localize({ key: 'miExit', comment: ['&& denotes a mnemonic'] }, "E&&xit")
	},
	order: 1,
	when: IsMacContext.toNegated()
});
I
isidor 已提交
287

288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
// Appereance menu
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
	group: '2_appearance',
	title: nls.localize({ key: 'miAppearance', comment: ['&& denotes a mnemonic'] }, "&&Appearance"),
	submenu: MenuId.MenubarAppearanceMenu,
	order: 1
});

MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
	group: '1_toggle_view',
	command: {
		id: ToggleFullScreenAction.ID,
		title: nls.localize({ key: 'miToggleFullScreen', comment: ['&& denotes a mnemonic'] }, "Toggle &&Full Screen")
	},
	order: 1
});

MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
	group: '1_toggle_view',
	command: {
		id: ToggleMenuBarAction.ID,
		title: nls.localize({ key: 'miToggleMenuBar', comment: ['&& denotes a mnemonic'] }, "Toggle Menu &&Bar")
	},
311
	when: IsMacContext.toNegated(),
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343
	order: 4
});

// Zoom

MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
	group: '3_zoom',
	command: {
		id: ZoomInAction.ID,
		title: nls.localize({ key: 'miZoomIn', comment: ['&& denotes a mnemonic'] }, "&&Zoom In")
	},
	order: 1
});

MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
	group: '3_zoom',
	command: {
		id: ZoomOutAction.ID,
		title: nls.localize({ key: 'miZoomOut', comment: ['&& denotes a mnemonic'] }, "&&Zoom Out")
	},
	order: 2
});

MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
	group: '3_zoom',
	command: {
		id: ZoomResetAction.ID,
		title: nls.localize({ key: 'miZoomReset', comment: ['&& denotes a mnemonic'] }, "&&Reset Zoom")
	},
	order: 3
});

344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386
// Help

MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '1_welcome',
	command: {
		id: 'workbench.action.openDocumentationUrl',
		title: nls.localize({ key: 'miDocumentation', comment: ['&& denotes a mnemonic'] }, "&&Documentation")
	},
	order: 3
});

MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '1_welcome',
	command: {
		id: 'update.showCurrentReleaseNotes',
		title: nls.localize({ key: 'miReleaseNotes', comment: ['&& denotes a mnemonic'] }, "&&Release Notes")
	},
	order: 4
});

// Reference
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '2_reference',
	command: {
		id: 'workbench.action.keybindingsReference',
		title: nls.localize({ key: 'miKeyboardShortcuts', comment: ['&& denotes a mnemonic'] }, "&&Keyboard Shortcuts Reference")
	},
	order: 1
});

MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '2_reference',
	command: {
		id: 'workbench.action.openIntroductoryVideosUrl',
		title: nls.localize({ key: 'miIntroductoryVideos', comment: ['&& denotes a mnemonic'] }, "Introductory &&Videos")
	},
	order: 2
});

MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '2_reference',
	command: {
		id: 'workbench.action.openTipsAndTricksUrl',
S
SteVen Batten 已提交
387
		title: nls.localize({ key: 'miTipsAndTricks', comment: ['&& denotes a mnemonic'] }, "Tips and Tri&&cks")
388 389 390 391 392 393 394 395 396
	},
	order: 3
});

// Feedback
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '3_feedback',
	command: {
		id: 'workbench.action.openTwitterUrl',
N
nathan 已提交
397
		title: nls.localize({ key: 'miTwitter', comment: ['&& denotes a mnemonic'] }, "&&Join Us on Twitter")
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433
	},
	order: 1
});

MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '3_feedback',
	command: {
		id: 'workbench.action.openRequestFeatureUrl',
		title: nls.localize({ key: 'miUserVoice', comment: ['&& denotes a mnemonic'] }, "&&Search Feature Requests")
	},
	order: 2
});

MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '3_feedback',
	command: {
		id: 'workbench.action.openIssueReporter',
		title: nls.localize({ key: 'miReportIssue', comment: ['&& denotes a mnemonic', 'Translate this to "Report Issue in English" in all languages please!'] }, "Report &&Issue")
	},
	order: 3
});

// Legal
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '4_legal',
	command: {
		id: 'workbench.action.openLicenseUrl',
		title: nls.localize({ key: 'miLicense', comment: ['&& denotes a mnemonic'] }, "View &&License")
	},
	order: 1
});

MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '4_legal',
	command: {
		id: 'workbench.action.openPrivacyStatementUrl',
S
SteVen Batten 已提交
434
		title: nls.localize({ key: 'miPrivacyStatement', comment: ['&& denotes a mnemonic'] }, "Privac&&y Statement")
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458
	},
	order: 2
});

// Tools
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '5_tools',
	command: {
		id: 'workbench.action.toggleDevTools',
		title: nls.localize({ key: 'miToggleDevTools', comment: ['&& denotes a mnemonic'] }, "&&Toggle Developer Tools")
	},
	order: 1
});

MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: '5_tools',
	command: {
		id: 'workbench.action.openProcessExplorer',
		title: nls.localize({ key: 'miOpenProcessExplorerer', comment: ['&& denotes a mnemonic'] }, "Open &&Process Explorer")
	},
	order: 2
});

// About
I
isidor 已提交
459 460 461 462 463 464 465 466 467
MenuRegistry.appendMenuItem(MenuId.MenubarHelpMenu, {
	group: 'z_about',
	command: {
		id: 'workbench.action.showAboutDialog',
		title: nls.localize({ key: 'miAbout', comment: ['&& denotes a mnemonic'] }, "&&About")
	},
	order: 1,
	when: IsMacContext.toNegated()
});
468

469
// Configuration: Workbench
B
Benjamin Pasero 已提交
470
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
471

472 473 474 475 476
configurationRegistry.registerConfiguration({
	'id': 'workbench',
	'order': 7,
	'title': nls.localize('workbenchConfigurationTitle', "Workbench"),
	'type': 'object',
477 478 479
	'properties': {
		'workbench.editor.showTabs': {
			'type': 'boolean',
J
Jackson Kearl 已提交
480
			'description': nls.localize('showEditorTabs', "Controls whether opened editors should show in tabs or not."),
481 482
			'default': true
		},
A
Alexander 已提交
483 484 485 486 487
		'workbench.editor.highlightModifiedTabs': {
			'type': 'boolean',
			'description': nls.localize('highlightModifiedTabs', "Controls whether a top border is drawn on modified (dirty) editor tabs or not."),
			'default': false
		},
488 489 490 491
		'workbench.editor.labelFormat': {
			'type': 'string',
			'enum': ['default', 'short', 'medium', 'long'],
			'enumDescriptions': [
492 493 494 495
				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.")
496 497
			],
			'default': 'default',
P
Pine Wu 已提交
498 499 500
			'description': nls.localize({
				comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'],
				key: 'tabDescription'
R
Rob Lourens 已提交
501
			}, "Controls the format of the label for an editor."),
502 503 504 505 506
		},
		'workbench.editor.tabCloseButton': {
			'type': 'string',
			'enum': ['left', 'right', 'off'],
			'default': 'right',
J
Jackson Kearl 已提交
507
			'description': 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'.")
508 509 510 511 512
		},
		'workbench.editor.tabSizing': {
			'type': 'string',
			'enum': ['fit', 'shrink'],
			'default': 'fit',
J
Jackson Kearl 已提交
513 514 515 516 517
			'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.")
			],
			'description': 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.")
518 519 520
		},
		'workbench.editor.showIcons': {
			'type': 'boolean',
J
Jackson Kearl 已提交
521
			'description': nls.localize('showIcons', "Controls whether opened editors should show with an icon or not. This requires an icon theme to be enabled as well."),
522 523 524 525
			'default': true
		},
		'workbench.editor.enablePreview': {
			'type': 'boolean',
526
			'description': nls.localize('enablePreview', "Controls whether opened editors show as preview. Preview editors are reused until they are pinned (e.g. via double click or editing) and show up with an italic font style."),
527 528 529 530
			'default': true
		},
		'workbench.editor.enablePreviewFromQuickOpen': {
			'type': 'boolean',
531
			'description': nls.localize('enablePreviewFromQuickOpen', "Controls whether opened editors from Quick Open show as preview. Preview editors are reused until they are pinned (e.g. via double click or editing)."),
532 533 534 535
			'default': true
		},
		'workbench.editor.closeOnFileDelete': {
			'type': 'boolean',
536 537
			'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."),
			'default': false
538 539 540 541 542
		},
		'workbench.editor.openPositioning': {
			'type': 'string',
			'enum': ['left', 'right', 'first', 'last'],
			'default': 'right',
543
			'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.")
544
		},
545
		'workbench.editor.openSideBySideDirection': {
546
			'type': 'string',
B
Benjamin Pasero 已提交
547 548
			'enum': ['right', 'down'],
			'default': 'right',
549
			'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.")
550
		},
551 552 553 554 555
		'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."),
			'default': true
		},
556 557
		'workbench.editor.revealIfOpen': {
			'type': 'boolean',
J
Jackson Kearl 已提交
558
			'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."),
559 560 561 562 563 564 565 566
			'default': false
		},
		'workbench.editor.swipeToNavigate': {
			'type': 'boolean',
			'description': nls.localize('swipeToNavigate', "Navigate between open files using three-finger swipe horizontally."),
			'default': false,
			'included': isMacintosh
		},
B
Benjamin Pasero 已提交
567 568 569 570 571
		'workbench.editor.restoreViewState': {
			'type': 'boolean',
			'description': nls.localize('restoreViewState', "Restores the last view state (e.g. scroll position) when re-opening files after they have been closed."),
			'default': true,
		},
572 573 574 575 576
		'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.")
		},
577 578 579 580 581 582 583
		'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."),
			'default': 50
		},
		'workbench.commandPalette.preserveInput': {
			'type': 'boolean',
J
Jackson Kearl 已提交
584
			'description': nls.localize('preserveInput', "Controls whether the last typed input to the command palette should be restored when opening it the next time."),
585 586 587 588
			'default': false
		},
		'workbench.quickOpen.closeOnFocusLost': {
			'type': 'boolean',
J
Jackson Kearl 已提交
589
			'description': nls.localize('closeOnFocusLost', "Controls whether Quick Open should close automatically once it loses focus."),
590 591
			'default': true
		},
592
		'workbench.quickOpen.preserveInput': {
M
Michel73 已提交
593
			'type': 'boolean',
594
			'description': nls.localize('workbench.quickOpen.preserveInput', "Controls whether the last typed input to Quick Open should be restored when opening it the next time."),
C
Christof Marti 已提交
595
			'default': false
M
Michel73 已提交
596
		},
597 598
		'workbench.settings.openDefaultSettings': {
			'type': 'boolean',
J
Jackson Kearl 已提交
599
			'description': nls.localize('openDefaultSettings', "Controls whether opening settings also opens an editor showing all default settings."),
600
			'default': false
601
		},
N
Nilesh 已提交
602 603
		'workbench.settings.openDefaultKeybindings': {
			'type': 'boolean',
J
Jackson Kearl 已提交
604
			'description': nls.localize('openDefaultKeybindings', "Controls whether opening keybinding settings also opens an editor showing all default keybindings."),
605
			'default': true
N
Nilesh 已提交
606
		},
607 608 609 610 611 612
		'workbench.sideBar.location': {
			'type': 'string',
			'enum': ['left', 'right'],
			'default': 'left',
			'description': nls.localize('sideBarLocation', "Controls the location of the sidebar. It can either show on the left or right of the workbench.")
		},
613 614 615 616
		'workbench.panel.defaultLocation': {
			'type': 'string',
			'enum': ['bottom', 'right'],
			'default': 'bottom',
I
isidor 已提交
617
			'description': nls.localize('panelDefaultLocation', "Controls the default location of the panel (terminal, debug console, output, problems). It can either show at the bottom or on the right of the workbench.")
618
		},
619 620 621 622 623 624 625 626 627 628
		'workbench.statusBar.visible': {
			'type': 'boolean',
			'default': true,
			'description': nls.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.")
		},
J
Joao Moreno 已提交
629
		'workbench.view.alwaysShowHeaderActions': {
630 631
			'type': 'boolean',
			'default': false,
J
Joao Moreno 已提交
632
			'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.")
633
		},
634 635
		'workbench.fontAliasing': {
			'type': 'string',
636
			'enum': ['default', 'antialiased', 'none', 'auto'],
637 638
			'default': 'default',
			'description':
J
Jackson Kearl 已提交
639
				nls.localize('fontAliasing', "Controls font aliasing method in the workbench."),
640 641 642
			'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."),
643 644
				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.")
645 646 647 648 649
			],
			'included': isMacintosh
		},
		'workbench.settings.enableNaturalLanguageSearch': {
			'type': 'boolean',
R
Ramya Achutha Rao 已提交
650
			'description': nls.localize('enableNaturalLanguageSettingsSearch', "Controls whether to enable the natural language search mode for settings. The natural language search is provided by a Microsoft online service."),
651
			'default': true,
652
			'scope': ConfigurationScope.WINDOW,
653
			'tags': ['usesOnlineServices']
654 655 656
		},
		'workbench.settings.settingsSearchTocBehavior': {
			'type': 'string',
657 658 659 660 661
			'enum': ['hide', 'filter'],
			'enumDescriptions': [
				nls.localize('settingsSearchTocBehavior.hide', "Hide the Table of Contents while searching."),
				nls.localize('settingsSearchTocBehavior.filter', "Filter the Table of Contents to just categories that have matching settings. Clicking a category will filter the results to that category."),
			],
662
			'description': nls.localize('settingsSearchTocBehavior', "Controls the behavior of the settings editor Table of Contents while searching."),
663
			'default': 'filter',
664
			'scope': ConfigurationScope.WINDOW
665
		},
666 667 668 669 670
		'workbench.settings.editor': {
			'type': 'string',
			'enum': ['ui', 'json'],
			'enumDescriptions': [
				nls.localize('settings.editor.ui', "Use the settings UI editor."),
671
				nls.localize('settings.editor.json', "Use the JSON file editor."),
672 673 674
			],
			'description': nls.localize('settings.editor.desc', "Determines which settings editor to use by default."),
			'default': 'ui',
675
			'scope': ConfigurationScope.WINDOW
676
		},
677 678 679 680 681
		'workbench.enableExperiments': {
			'type': 'boolean',
			'description': nls.localize('workbench.enableExperiments', "Fetches experiments to run from a Microsoft online service."),
			'default': true,
			'tags': ['usesOnlineServices']
682 683
		}
	}
684 685 686
});

// Configuration: Window
687

E
Erich Gamma 已提交
688 689
configurationRegistry.registerConfiguration({
	'id': 'window',
690
	'order': 8,
691
	'title': nls.localize('windowConfigurationTitle', "Window"),
E
Erich Gamma 已提交
692
	'type': 'object',
693 694 695 696 697
	'properties': {
		'window.openFilesInNewWindow': {
			'type': 'string',
			'enum': ['on', 'off', 'default'],
			'enumDescriptions': [
I
isidor 已提交
698 699
				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."),
700
				isMacintosh ?
I
isidor 已提交
701 702
					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).")
703 704
			],
			'default': 'off',
705
			'scope': ConfigurationScope.APPLICATION,
706
			'markdownDescription':
707
				isMacintosh ?
708 709
					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).")
710 711 712 713 714
		},
		'window.openFoldersInNewWindow': {
			'type': 'string',
			'enum': ['on', 'off', 'default'],
			'enumDescriptions': [
I
isidor 已提交
715 716 717
				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).")
718 719
			],
			'default': 'default',
720
			'scope': ConfigurationScope.APPLICATION,
721
			'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).")
722
		},
723 724 725 726
		'window.openWithoutArgumentsInNewWindow': {
			'type': 'string',
			'enum': ['on', 'off'],
			'enumDescriptions': [
I
isidor 已提交
727 728
				nls.localize('window.openWithoutArgumentsInNewWindow.on', "Open a new empty window."),
				nls.localize('window.openWithoutArgumentsInNewWindow.off', "Focus the last active running instance.")
729 730
			],
			'default': isMacintosh ? 'off' : 'on',
731
			'scope': ConfigurationScope.APPLICATION,
R
Rob Lourens 已提交
732
			'markdownDescription': nls.localize('openWithoutArgumentsInNewWindow', "Controls whether a new empty window should open when starting a second instance without arguments or if the last running instance should get focus.\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).")
733
		},
734 735 736 737 738 739 740 741 742 743
		'window.restoreWindows': {
			'type': 'string',
			'enum': ['all', 'folders', 'one', 'none'],
			'enumDescriptions': [
				nls.localize('window.reopenFolders.all', "Reopen all windows."),
				nls.localize('window.reopenFolders.folders', "Reopen all folders. Empty workspaces will not be restored."),
				nls.localize('window.reopenFolders.one', "Reopen the last active window."),
				nls.localize('window.reopenFolders.none', "Never reopen a window. Always start with an empty one.")
			],
			'default': 'one',
744
			'scope': ConfigurationScope.APPLICATION,
R
Rob Lourens 已提交
745
			'description': nls.localize('restoreWindows', "Controls how windows are being reopened after a restart.")
746 747 748 749
		},
		'window.restoreFullscreen': {
			'type': 'boolean',
			'default': false,
750
			'scope': ConfigurationScope.APPLICATION,
R
Rob Lourens 已提交
751
			'description': nls.localize('restoreFullscreen', "Controls whether a window should restore to full screen mode if it was exited in full screen mode.")
752 753 754 755 756 757 758 759 760
		},
		'window.zoomLevel': {
			'type': 'number',
			'default': 0,
			'description': nls.localize('zoomLevel', "Adjust the zoom level of the window. The original size is 0 and each increment above (e.g. 1) or below (e.g. -1) represents zooming 20% larger or smaller. You can also enter decimals to adjust the zoom level with a finer granularity.")
		},
		'window.title': {
			'type': 'string',
			'default': isMacintosh ? '${activeEditorShort}${separator}${rootName}' : '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}',
761
			'markdownDescription': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'title' },
R
Rob Lourens 已提交
762
				"Controls the window title based on the active editor. Variables are substituted based on the context:\n- `\${activeEditorShort}`: the file name (e.g. myFile.txt).\n- `\${activeEditorMedium}`: the path of the file relative to the workspace folder (e.g. myFolder/myFile.txt).\n- `\${activeEditorLong}`: the full path of the file (e.g. /Users/Development/myProject/myFolder/myFile.txt).\n- `\${folderName}`: name of the workspace folder the file is contained in (e.g. myFolder).\n- `\${folderPath}`: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder).\n- `\${rootName}`: name of the workspace (e.g. myFolder or myWorkspace).\n- `\${rootPath}`: file path of the workspace (e.g. /Users/Development/myWorkspace).\n- `\${appName}`: e.g. VS Code.\n- `\${dirty}`: a dirty indicator if the active editor is dirty.\n- `\${separator}`: a conditional separator (\" - \") that only shows when surrounded by variables with values or static text.")
763 764 765 766 767 768 769 770 771 772 773
		},
		'window.newWindowDimensions': {
			'type': 'string',
			'enum': ['default', 'inherit', 'maximized', 'fullscreen'],
			'enumDescriptions': [
				nls.localize('window.newWindowDimensions.default', "Open new windows in the center of the screen."),
				nls.localize('window.newWindowDimensions.inherit', "Open new windows with same dimension as last active one."),
				nls.localize('window.newWindowDimensions.maximized', "Open new windows maximized."),
				nls.localize('window.newWindowDimensions.fullscreen', "Open new windows in full screen mode.")
			],
			'default': 'default',
774
			'scope': ConfigurationScope.APPLICATION,
R
Rob Lourens 已提交
775
			'description': nls.localize('newWindowDimensions', "Controls the dimensions of opening a new window when at least one window is already opened. Note that this setting does not have an impact on the first window that is opened. The first window will always restore the size and location as you left it before closing.")
776 777 778 779
		},
		'window.closeWhenEmpty': {
			'type': 'boolean',
			'default': false,
J
Jackson Kearl 已提交
780
			'description': nls.localize('closeWhenEmpty', "Controls whether closing the last editor should also close the window. This setting only applies for windows that do not show folders.")
781 782 783 784 785 786 787 788 789 790 791
		},
		'window.menuBarVisibility': {
			'type': 'string',
			'enum': ['default', 'visible', 'toggle', 'hidden'],
			'enumDescriptions': [
				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.")
			],
			'default': 'default',
792
			'scope': ConfigurationScope.APPLICATION,
793
			'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."),
794
			'included': isWindows || isLinux
795 796 797 798
		},
		'window.enableMenuBarMnemonics': {
			'type': 'boolean',
			'default': true,
799
			'scope': ConfigurationScope.APPLICATION,
800
			'description': nls.localize('enableMenuBarMnemonics', "If enabled, the main menus can be opened via Alt-key shortcuts. Disabling mnemonics allows to bind these Alt-key shortcuts to editor commands instead."),
801
			'included': isWindows || isLinux
802 803 804 805 806
		},
		'window.autoDetectHighContrast': {
			'type': 'boolean',
			'default': true,
			'description': nls.localize('autoDetectHighContrast', "If enabled, will automatically change to high contrast theme if Windows is using a high contrast theme, and to dark theme when switching away from a Windows high contrast theme."),
807
			'included': isWindows
808
		},
S
SteVen Batten 已提交
809 810 811 812 813 814
		'window.doubleClickIconToClose': {
			'type': 'boolean',
			'default': false,
			'scope': ConfigurationScope.APPLICATION,
			'description': nls.localize('window.doubleClickIconToClose', "If enabled, double clicking the application icon in the title bar will close the window and the window cannot be dragged by the icon. This setting only has an effect when 'window.titleBarStyle' is set to 'custom'.")
		},
815 816 817
		'window.titleBarStyle': {
			'type': 'string',
			'enum': ['native', 'custom'],
818
			'default': 'custom',
819
			'scope': ConfigurationScope.APPLICATION,
R
Ryan Adolf 已提交
820
			'description': nls.localize('titleBarStyle', "Adjust the appearance of the window title bar. Changes require a full restart to apply.")
821 822 823 824
		},
		'window.nativeTabs': {
			'type': 'boolean',
			'default': false,
825
			'scope': ConfigurationScope.APPLICATION,
826
			'description': nls.localize('window.nativeTabs', "Enables macOS Sierra window tabs. Note that changes require a full restart to apply and that native tabs will disable a custom title bar style if configured."),
827
			'included': isMacintosh && parseFloat(os.release()) >= 16 // Minimum: macOS Sierra (10.12.x = darwin 16.x)
828
		},
B
Benjamin Pasero 已提交
829
		'window.nativeFullScreen': {
830 831
			'type': 'boolean',
			'default': true,
B
Benjamin Pasero 已提交
832
			'description': nls.localize('window.nativeFullScreen', "Controls if native full-screen should be used on macOS. Disable this option to prevent macOS from creating a new space when going full-screen."),
833 834
			'included': isMacintosh
		},
B
Benjamin Pasero 已提交
835
		'window.smoothScrollingWorkaround': { // TODO@Ben remove once https://github.com/Microsoft/vscode/issues/61824 settles
836 837 838
			'type': 'boolean',
			'default': false,
			'scope': ConfigurationScope.APPLICATION,
B
Benjamin Pasero 已提交
839
			'markdownDescription': nls.localize('window.smoothScrollingWorkaround', "Enable this workaround if scrolling is no longer smooth after restoring a minimized VS Code window. This is a workaround for an issue (https://github.com/Microsoft/vscode/issues/13612) where scrolling starts to lag on devices with precision trackpads like the Surface devices from Microsoft. Enabling this workaround can result in a little bit of layout flickering after restoring the window from minimized state but is otherwise harmless."),
840 841
			'included': isWindows
		},
842 843 844
		'window.clickThroughInactive': {
			'type': 'boolean',
			'default': true,
845
			'scope': ConfigurationScope.APPLICATION,
B
Benjamin Pasero 已提交
846
			'description': nls.localize('window.clickThroughInactive', "If enabled, clicking on an inactive window will both activate the window and trigger the element under the mouse if it is clickable. If disabled, clicking anywhere on an inactive window will activate it only and a second click is required on the element."),
847
			'included': isMacintosh
848 849
		}
	}
850
});
I
isidor 已提交
851 852 853 854 855 856 857 858 859 860 861

// Configuration: Zen Mode
configurationRegistry.registerConfiguration({
	'id': 'zenMode',
	'order': 9,
	'title': nls.localize('zenModeConfigurationTitle', "Zen Mode"),
	'type': 'object',
	'properties': {
		'zenMode.fullScreen': {
			'type': 'boolean',
			'default': true,
J
Jackson Kearl 已提交
862
			'description': nls.localize('zenMode.fullScreen', "Controls whether turning on Zen Mode also puts the workbench into full screen mode.")
I
isidor 已提交
863
		},
864
		'zenMode.centerLayout': {
865 866
			'type': 'boolean',
			'default': true,
J
Jackson Kearl 已提交
867
			'description': nls.localize('zenMode.centerLayout', "Controls whether turning on Zen Mode also centers the layout.")
868
		},
I
isidor 已提交
869 870 871
		'zenMode.hideTabs': {
			'type': 'boolean',
			'default': true,
872
			'description': nls.localize('zenMode.hideTabs', "Controls whether turning on Zen Mode also hides workbench tabs.")
I
isidor 已提交
873 874 875 876
		},
		'zenMode.hideStatusBar': {
			'type': 'boolean',
			'default': true,
877
			'description': nls.localize('zenMode.hideStatusBar', "Controls whether turning on Zen Mode also hides the status bar at the bottom of the workbench.")
I
isidor 已提交
878
		},
879 880 881
		'zenMode.hideActivityBar': {
			'type': 'boolean',
			'default': true,
J
Jackson Kearl 已提交
882
			'description': nls.localize('zenMode.hideActivityBar', "Controls whether turning on Zen Mode also hides the activity bar at the left of the workbench.")
883
		},
I
isidor 已提交
884 885 886
		'zenMode.restore': {
			'type': 'boolean',
			'default': false,
887
			'description': nls.localize('zenMode.restore', "Controls whether a window should restore to zen mode if it was exited in zen mode.")
I
isidor 已提交
888 889
		}
	}
890
});