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

'use strict';

8
import { Registry } from 'vs/platform/registry/common/platform';
E
Erich Gamma 已提交
9
import nls = require('vs/nls');
10
import product from 'vs/platform/node/product';
11
import * as os from 'os';
J
Johannes Rieken 已提交
12 13
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';
B
Benjamin Pasero 已提交
14
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
J
Johannes Rieken 已提交
15
import { KeyMod, KeyChord, KeyCode } from 'vs/base/common/keyCodes';
16
import { isWindows, isLinux, isMacintosh } from 'vs/base/common/platform';
17
import { CloseEditorAction, KeybindingsReferenceAction, OpenDocumentationUrlAction, OpenIntroductoryVideosUrlAction, OpenTipsAndTricksUrlAction, ReportIssueAction, ReportPerformanceIssueAction, ZoomResetAction, ZoomOutAction, ZoomInAction, ToggleFullScreenAction, ToggleMenuBarAction, CloseWorkspaceAction, CloseCurrentWindowAction, SwitchWindow, NewWindowAction, CloseMessagesAction, NavigateUpAction, NavigateDownAction, NavigateLeftAction, NavigateRightAction, IncreaseViewSizeAction, DecreaseViewSizeAction, ShowStartupPerformance, ToggleSharedProcessAction, QuickSwitchWindow, QuickOpenRecentAction, inRecentFilesPickerContextKey } from 'vs/workbench/electron-browser/actions';
18
import { MessagesVisibleContext } from 'vs/workbench/electron-browser/workbench';
19
import { IJSONSchema } from 'vs/base/common/jsonSchema';
20
import { registerCommands } from 'vs/workbench/electron-browser/commands';
21
import { AddRootFolderAction, GlobalRemoveRootFolderAction, OpenWorkspaceAction, SaveWorkspaceAsAction, OpenWorkspaceConfigFileAction, OpenFolderAsWorkspaceInNewWindowAction, OpenFileFolderAction, OpenFileAction, OpenFolderAction } from 'vs/workbench/browser/actions/workspaceActions';
22 23 24
import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { inQuickOpenContext, getQuickNavigateHandler } from 'vs/workbench/browser/parts/quickopen/quickopen';
import { KeybindingsRegistry } from 'vs/platform/keybinding/common/keybindingsRegistry';
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');
B
Benjamin Pasero 已提交
36 37
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(SwitchWindow, SwitchWindow.ID, SwitchWindow.LABEL, { primary: null, mac: { primary: KeyMod.WinCtrl | KeyCode.KEY_W } }), 'Switch Window...');
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(QuickSwitchWindow, QuickSwitchWindow.ID, QuickSwitchWindow.LABEL), 'Quick Switch Window...');
38

B
Benjamin Pasero 已提交
39
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(QuickOpenRecentAction, QuickOpenRecentAction.ID, QuickOpenRecentAction.LABEL), 'File: Quick Open Recent...', fileCategory);
40 41 42 43 44 45 46 47

if (isMacintosh) {
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenFileFolderAction, OpenFileFolderAction.ID, OpenFileFolderAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_O }), 'File: Open...', fileCategory);
} else {
	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);
}

48
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 已提交
49 50
if (!!product.reportIssueUrl) {
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ReportIssueAction, ReportIssueAction.ID, ReportIssueAction.LABEL), 'Help: Report Issues', helpCategory);
51
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ReportPerformanceIssueAction, ReportPerformanceIssueAction.ID, ReportPerformanceIssueAction.LABEL), 'Help: Report Performance Issue', helpCategory);
B
Benjamin Pasero 已提交
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
}
C
Christof Marti 已提交
56 57 58
if (OpenDocumentationUrlAction.AVAILABLE) {
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenDocumentationUrlAction, OpenDocumentationUrlAction.ID, OpenDocumentationUrlAction.LABEL), 'Help: Documentation', helpCategory);
}
59 60 61
if (OpenIntroductoryVideosUrlAction.AVAILABLE) {
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenIntroductoryVideosUrlAction, OpenIntroductoryVideosUrlAction.ID, OpenIntroductoryVideosUrlAction.LABEL), 'Help: Introductory Videos', helpCategory);
}
62 63 64
if (OpenTipsAndTricksUrlAction.AVAILABLE) {
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenTipsAndTricksUrlAction, OpenTipsAndTricksUrlAction.ID, OpenTipsAndTricksUrlAction.LABEL), 'Help: Tips and Tricks', helpCategory);
}
65 66 67 68 69
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);
70 71 72
workbenchActionsRegistry.registerWorkbenchAction(
	new SyncActionDescriptor(ZoomOutAction, ZoomOutAction.ID, ZoomOutAction.LABEL, {
		primary: KeyMod.CtrlCmd | KeyCode.US_MINUS,
73 74
		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] }
75 76
	}), 'View: Zoom Out', viewCategory
);
77 78 79 80 81
workbenchActionsRegistry.registerWorkbenchAction(
	new SyncActionDescriptor(ZoomResetAction, ZoomResetAction.ID, ZoomResetAction.LABEL, {
		primary: KeyMod.CtrlCmd | KeyCode.NUMPAD_0
	}), 'View: Reset Zoom', viewCategory
);
A
Alex Dima 已提交
82
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseMessagesAction, CloseMessagesAction.ID, CloseMessagesAction.LABEL, { primary: KeyCode.Escape, secondary: [KeyMod.Shift | KeyCode.Escape] }, MessagesVisibleContext), 'Close Notification Messages');
83
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(CloseEditorAction, CloseEditorAction.ID, CloseEditorAction.LABEL, { primary: KeyMod.CtrlCmd | KeyCode.KEY_W, win: { primary: KeyMod.CtrlCmd | KeyCode.F4, secondary: [KeyMod.CtrlCmd | KeyCode.KEY_W] } }), 'View: Close Editor', viewCategory);
84
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);
85
if (isWindows || isLinux) {
86
	workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleMenuBarAction, ToggleMenuBarAction.ID, ToggleMenuBarAction.LABEL), 'View: Toggle Menu Bar', viewCategory);
87
}
B
Benjamin Pasero 已提交
88 89 90 91
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 已提交
92

93 94
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);
95

96 97 98 99 100 101 102
const workspacesCategory = nls.localize('workspaces', "Workspaces");
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(AddRootFolderAction, AddRootFolderAction.ID, AddRootFolderAction.LABEL), 'Workspaces: Add Folder to Workspace...', workspacesCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(GlobalRemoveRootFolderAction, GlobalRemoveRootFolderAction.ID, GlobalRemoveRootFolderAction.LABEL), 'Workspaces: Remove Folder from Workspace...', workspacesCategory);
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);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenWorkspaceConfigFileAction, OpenWorkspaceConfigFileAction.ID, OpenWorkspaceConfigFileAction.LABEL), 'Workspaces: Open Workspace Configuration File', workspacesCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(OpenFolderAsWorkspaceInNewWindowAction, OpenFolderAsWorkspaceInNewWindowAction.ID, OpenFolderAsWorkspaceInNewWindowAction.LABEL), 'Workspaces: Open Folder as Workspace in New Window', workspacesCategory);
B
Benjamin Pasero 已提交
103

104 105 106 107 108
// Developer related actions
const developerCategory = nls.localize('developer', "Developer");
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ShowStartupPerformance, ShowStartupPerformance.ID, ShowStartupPerformance.LABEL), 'Developer: Startup Performance', developerCategory);
workbenchActionsRegistry.registerWorkbenchAction(new SyncActionDescriptor(ToggleSharedProcessAction, ToggleSharedProcessAction.ID, ToggleSharedProcessAction.LABEL), 'Developer: Toggle Shared Process', developerCategory);

109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
const recentFilesPickerContext = ContextKeyExpr.and(inQuickOpenContext, ContextKeyExpr.has(inRecentFilesPickerContextKey));

const quickOpenNavigateNextInRecentFilesPickerId = 'workbench.action.quickOpenNavigateNextInRecentFilesPicker';
KeybindingsRegistry.registerCommandAndKeybindingRule({
	id: quickOpenNavigateNextInRecentFilesPickerId,
	weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50),
	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,
	weight: KeybindingsRegistry.WEIGHT.workbenchContrib(50),
	handler: getQuickNavigateHandler(quickOpenNavigatePreviousInRecentFilesPicker, false),
	when: recentFilesPickerContext,
	primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_R,
	mac: { primary: KeyMod.WinCtrl | KeyMod.Shift | KeyCode.KEY_R }
});

131
// Configuration: Workbench
B
Benjamin Pasero 已提交
132
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
133 134 135 136 137 138 139

let workbenchProperties: { [path: string]: IJSONSchema; } = {
	'workbench.editor.showTabs': {
		'type': 'boolean',
		'description': nls.localize('showEditorTabs', "Controls if opened editors should show in tabs or not."),
		'default': true
	},
140
	'workbench.editor.labelFormat': {
141 142 143
		'type': 'string',
		'enum': ['default', 'short', 'medium', 'long'],
		'enumDescriptions': [
B
Benjamin Pasero 已提交
144
			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 distinguinshing 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."),
145
			nls.localize('workbench.editor.labelFormat.short', "Show the name of the file followed by it's directory name."),
B
Benjamin Pasero 已提交
146
			nls.localize('workbench.editor.labelFormat.medium', "Show the name of the file followed by it's path relative to the workspace folder."),
147
			nls.localize('workbench.editor.labelFormat.long', "Show the name of the file followed by it's absolute path.")
148 149 150
		],
		'default': 'default',
		'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'tabDescription' },
151
			`Controls the format of the label for an editor. Changing this setting can for example make it easier to understand the location of a file:
152 153 154
- short:   'parent'
- medium:  'workspace/src/parent'
- long:    '/home/user/workspace/src/parent'
155
- default: '.../parent', when another tab shares the same title, or the relative workspace path if tabs are disabled`),
156
	},
157 158 159 160 161 162 163 164 165 166 167 168 169
	'workbench.editor.tabCloseButton': {
		'type': 'string',
		'enum': ['left', 'right', 'off'],
		'default': 'right',
		'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'.")
	},
	'workbench.editor.showIcons': {
		'type': 'boolean',
		'description': nls.localize('showIcons', "Controls if opened editors should show with an icon or not. This requires an icon theme to be enabled as well."),
		'default': true
	},
	'workbench.editor.enablePreview': {
		'type': 'boolean',
B
Benjamin Pasero 已提交
170
		'description': nls.localize('enablePreview', "Controls if opened editors show as preview. Preview editors are reused until they are kept (e.g. via double click or editing) and show up with an italic font style."),
171 172 173 174 175 176 177 178 179 180 181
		'default': true
	},
	'workbench.editor.enablePreviewFromQuickOpen': {
		'type': 'boolean',
		'description': nls.localize('enablePreviewFromQuickOpen', "Controls if opened editors from Quick Open show as preview. Preview editors are reused until they are kept (e.g. via double click or editing)."),
		'default': true
	},
	'workbench.editor.openPositioning': {
		'type': 'string',
		'enum': ['left', 'right', 'first', 'last'],
		'default': 'right',
182
		'description': 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.")
183 184 185 186 187 188
	},
	'workbench.editor.revealIfOpen': {
		'type': 'boolean',
		'description': nls.localize('revealIfOpen', "Controls if 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
	},
189 190
	'workbench.commandPalette.history': {
		'type': 'number',
E
Eli Barzilay 已提交
191
		'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."),
192 193 194 195 196 197 198
		'default': 50
	},
	'workbench.commandPalette.preserveInput': {
		'type': 'boolean',
		'description': nls.localize('preserveInput', "Controls if the last typed input to the command palette should be restored when opening it the next time."),
		'default': false
	},
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214
	'workbench.quickOpen.closeOnFocusLost': {
		'type': 'boolean',
		'description': nls.localize('closeOnFocusLost', "Controls if Quick Open should close automatically once it loses focus."),
		'default': true
	},
	'workbench.settings.openDefaultSettings': {
		'type': 'boolean',
		'description': nls.localize('openDefaultSettings', "Controls if opening settings also opens an editor showing all default settings."),
		'default': true
	},
	'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.")
	},
I
isidor 已提交
215 216 217 218 219 220
	'workbench.panel.location': {
		'type': 'string',
		'enum': ['bottom', 'right'],
		'default': 'bottom',
		'description': nls.localize('panelLocation', "Controls the location of the panel. It can either show on the bottom or right of the workbench.")
	},
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
	'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.")
	},
	'workbench.editor.closeOnFileDelete': {
		'type': 'boolean',
		'description': nls.localize('closeOnFileDelete', "Controls if editors showing a file should close automatically when the file is deleted or renamed by some other process. Disabling this will keep the editor open as dirty 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': true
	}
};

R
Rob Lourens 已提交
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255
if (product.quality !== 'stable') {
	workbenchProperties['workbench.settings.experimentalFuzzySearchEndpoint'] = {
		'type': 'string',
		'description': nls.localize('experimentalFuzzySearchEndpoint', "Indicates the endpoint to use for the experimental settings search."),
		'default': ''
	};

	workbenchProperties['workbench.settings.experimentalFuzzySearchKey'] = {
		'type': 'string',
		'description': nls.localize('experimentalFuzzySearchKey', "Indicates the key to use for the experimental settings search."),
		'default': ''
	};

	workbenchProperties['workbench.settings.experimentalFuzzySearchBoost'] = {
		'type': 'number',
		'description': 'Indicates the amount to boost the "literal" component of the query. Temporary.',
		'default': 10
	};
256 257 258 259 260 261

	workbenchProperties['workbench.settings.experimentalFuzzySearchAutoIngestFeedback'] = {
		'type': 'boolean',
		'description': 'Indicates whether feedback from this client should be automatically ingested.',
		'default': false
	};
R
Rob Lourens 已提交
262 263
}

264
if (isMacintosh) {
265 266 267 268
	workbenchProperties['workbench.fontAliasing'] = {
		'type': 'string',
		'enum': ['default', 'antialiased', 'none'],
		'default': 'default',
B
Benjamin Pasero 已提交
269
		'description':
270 271
			nls.localize('fontAliasing',
				`Controls font aliasing method in the workbench.
B
Benjamin Pasero 已提交
272 273 274 275 276 277 278 279
- default: Sub-pixel font smoothing. On most non-retina displays this will give the sharpest text
- antialiased: Smooth the font on the level of the pixel, as opposed to the subpixel. Can make the font appear lighter overall
- none: Disables font smoothing. Text will show with jagged sharp edges`),
		'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.")
		],
280 281
	};

282 283 284 285 286 287 288 289
	workbenchProperties['workbench.editor.swipeToNavigate'] = {
		'type': 'boolean',
		'description': nls.localize('swipeToNavigate', "Navigate between open files using three-finger swipe horizontally."),
		'default': false
	};
}


290 291 292 293 294
configurationRegistry.registerConfiguration({
	'id': 'workbench',
	'order': 7,
	'title': nls.localize('workbenchConfigurationTitle', "Workbench"),
	'type': 'object',
295
	'properties': workbenchProperties
296 297
});

298

299
// Configuration: Window
300 301
let properties: { [path: string]: IJSONSchema; } = {
	'window.openFilesInNewWindow': {
302 303
		'type': 'string',
		'enum': ['on', 'off', 'default'],
304
		'enumDescriptions': [
B
Benjamin Pasero 已提交
305 306 307
			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"),
			nls.localize('window.openFilesInNewWindow.default', "Files will open in the window with the files' folder open or the last active window unless opened via the dock or from finder (macOS only)")
308
		],
309
		'default': 'off',
310
		'description':
311 312
			nls.localize('openFilesInNewWindow',
				`Controls if files should open in a new window.
C
chrmarti 已提交
313
- default: files will open in the window with the files' folder open or the last active window unless opened via the dock or from finder (macOS only)
314
- on: files will open in a new window
C
chrmarti 已提交
315
- off: files will open in the window with the files' folder open or the last active window
316
Note that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).`
317
			)
318
	},
319
	'window.openFoldersInNewWindow': {
320 321
		'type': 'string',
		'enum': ['on', 'off', 'default'],
322
		'enumDescriptions': [
B
Benjamin Pasero 已提交
323 324 325
			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)")
326
		],
327 328
		'default': 'default',
		'description': nls.localize('openFoldersInNewWindow',
B
Benjamin Pasero 已提交
329
			`Controls if folders should open in a new window or replace the last active window.
330 331
- default: folders will open in a new window unless a folder is picked from within the application (e.g. via the File menu)
- on: folders will open in a new window
B
Benjamin Pasero 已提交
332
- off: folders will replace the last active window
333 334
Note that there can still be cases where this setting is ignored (e.g. when using the -new-window or -reuse-window command line option).`
		)
335
	},
336
	'window.restoreWindows': {
337
		'type': 'string',
338
		'enum': ['all', 'folders', 'one', 'none'],
339
		'enumDescriptions': [
B
Benjamin Pasero 已提交
340 341 342 343
			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.")
344
		],
345
		'default': 'one',
B
Benjamin Pasero 已提交
346
		'description': nls.localize('restoreWindows', "Controls how windows are being reopened after a restart. Select 'none' to always start with an empty workspace, 'one' to reopen the last window you worked on, 'folders' to reopen all windows that had folders opened or 'all' to reopen all windows of your last session.")
347 348 349 350 351 352 353 354 355 356 357
	},
	'window.restoreFullscreen': {
		'type': 'boolean',
		'default': false,
		'description': nls.localize('restoreFullscreen', "Controls if a window should restore to full screen mode if it was exited in full screen mode.")
	},
	'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.")
	},
358 359
	'window.title': {
		'type': 'string',
360
		'default': isMacintosh ? '${activeEditorShort}${separator}${rootName}' : '${dirty}${activeEditorShort}${separator}${rootName}${separator}${appName}',
B
Benjamin Pasero 已提交
361
		'description': nls.localize({ comment: ['This is the description for a setting. Values surrounded by parenthesis are not to be translated.'], key: 'title' },
362
			`Controls the window title based on the active editor. Variables are substituted based on the context:
363 364 365
\${activeEditorShort}: the file name (e.g. myFile.txt)
\${activeEditorMedium}: the path of the file relative to the workspace folder (e.g. myFolder/myFile.txt)
\${activeEditorLong}: the full path of the file (e.g. /Users/Development/myProject/myFolder/myFile.txt)
366 367 368 369
\${folderName}: name of the workspace folder the file is contained in (e.g. myFolder)
\${folderPath}: file path of the workspace folder the file is contained in (e.g. /Users/Development/myFolder)
\${rootName}: name of the workspace (e.g. myFolder or myWorkspace)
\${rootPath}: file path of the workspace (e.g. /Users/Development/myWorkspace)
370 371 372
\${appName}: e.g. VS Code
\${dirty}: a dirty indicator if the active editor is dirty
\${separator}: a conditional separator (" - ") that only shows when surrounded by variables with values`)
373 374 375 376
	},
	'window.newWindowDimensions': {
		'type': 'string',
		'enum': ['default', 'inherit', 'maximized', 'fullscreen'],
377
		'enumDescriptions': [
B
Benjamin Pasero 已提交
378 379 380 381
			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.")
382
		],
383
		'default': 'default',
B
Benjamin Pasero 已提交
384
		'description': nls.localize('newWindowDimensions', "Controls the dimensions of opening a new window when at least one window is already opened. By default, a new window will open in the center of the screen with small dimensions. When set to 'inherit', the window will get the same dimensions as the last window that was active. When set to 'maximized', the window will open maximized and fullscreen if configured to 'fullscreen'. 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.")
385
	},
386 387
	'window.closeWhenEmpty': {
		'type': 'boolean',
388
		'default': false,
B
Benjamin Pasero 已提交
389
		'description': nls.localize('closeWhenEmpty', "Controls if closing the last editor should also close the window. This setting only applies for windows that do not show folders.")
390
	}
391 392
};

393
if (isWindows || isLinux) {
394 395
	properties['window.menuBarVisibility'] = {
		'type': 'string',
396
		'enum': ['default', 'visible', 'toggle', 'hidden'],
397
		'enumDescriptions': [
B
Benjamin Pasero 已提交
398 399 400 401
			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.")
402
		],
403 404
		'default': 'default',
		'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.")
405
	};
406 407 408 409 410
	properties['window.enableMenuBarMnemonics'] = {
		'type': 'boolean',
		'default': true,
		'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.")
	};
411
}
412

413
if (isWindows) {
414 415 416
	properties['window.autoDetectHighContrast'] = {
		'type': 'boolean',
		'default': true,
417 418
		'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."),
	};
419 420
}

421
if (isMacintosh) {
422 423 424 425 426 427
	properties['window.titleBarStyle'] = {
		'type': 'string',
		'enum': ['native', 'custom'],
		'default': 'custom',
		'description': nls.localize('titleBarStyle', "Adjust the appearance of the window title bar. Changes require a full restart to apply.")
	};
428

429 430
	// Minimum: macOS Sierra (10.12.x = darwin 16.x)
	if (parseFloat(os.release()) >= 16) {
431 432 433 434 435 436
		properties['window.nativeTabs'] = {
			'type': 'boolean',
			'default': false,
			'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.")
		};
	}
437 438
}

E
Erich Gamma 已提交
439 440
configurationRegistry.registerConfiguration({
	'id': 'window',
441
	'order': 8,
442
	'title': nls.localize('windowConfigurationTitle', "Window"),
E
Erich Gamma 已提交
443
	'type': 'object',
444
	'properties': properties
445
});
I
isidor 已提交
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467

// Configuration: Zen Mode
configurationRegistry.registerConfiguration({
	'id': 'zenMode',
	'order': 9,
	'title': nls.localize('zenModeConfigurationTitle', "Zen Mode"),
	'type': 'object',
	'properties': {
		'zenMode.fullScreen': {
			'type': 'boolean',
			'default': true,
			'description': nls.localize('zenMode.fullScreen', "Controls if turning on Zen Mode also puts the workbench into full screen mode.")
		},
		'zenMode.hideTabs': {
			'type': 'boolean',
			'default': true,
			'description': nls.localize('zenMode.hideTabs', "Controls if turning on Zen Mode also hides workbench tabs.")
		},
		'zenMode.hideStatusBar': {
			'type': 'boolean',
			'default': true,
			'description': nls.localize('zenMode.hideStatusBar', "Controls if turning on Zen Mode also hides the status bar at the bottom of the workbench.")
I
isidor 已提交
468
		},
469 470 471
		'zenMode.hideActivityBar': {
			'type': 'boolean',
			'default': true,
I
isidor 已提交
472
			'description': nls.localize('zenMode.hideActivityBar', "Controls if turning on Zen Mode also hides the activity bar at the left of the workbench.")
473
		},
I
isidor 已提交
474 475 476 477
		'zenMode.restore': {
			'type': 'boolean',
			'default': false,
			'description': nls.localize('zenMode.restore', "Controls if a window should restore to zen mode if it was exited in zen mode.")
I
isidor 已提交
478 479
		}
	}
E
Eli Barzilay 已提交
480
});