files.contribution.ts 20.7 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.
 *--------------------------------------------------------------------------------------------*/

J
Johannes Rieken 已提交
6
import { URI, UriComponents } from 'vs/base/common/uri';
B
Benjamin Pasero 已提交
7
import { ViewletRegistry, Extensions as ViewletExtensions, ViewletDescriptor, ShowViewletAction } from 'vs/workbench/browser/viewlet';
8
import * as nls from 'vs/nls';
9
import { sep } from 'vs/base/common/path';
10
import { SyncActionDescriptor, MenuId, MenuRegistry } from 'vs/platform/actions/common/actions';
11
import { Registry } from 'vs/platform/registry/common/platform';
12
import { IConfigurationRegistry, Extensions as ConfigurationExtensions, ConfigurationScope } from 'vs/platform/configuration/common/configurationRegistry';
B
Benjamin Pasero 已提交
13
import { IWorkbenchActionRegistry, Extensions as ActionExtensions } from 'vs/workbench/common/actions';
14
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions, IWorkbenchContribution } from 'vs/workbench/common/contributions';
I
isidor 已提交
15
import { IEditorInputFactory, EditorInput, IFileEditorInput, IEditorInputFactoryRegistry, Extensions as EditorInputExtensions } from 'vs/workbench/common/editor';
16
import { AutoSaveConfiguration, HotExitConfiguration, SUPPORTED_ENCODINGS } from 'vs/platform/files/common/files';
17 18
import { VIEWLET_ID, SortOrderConfiguration, FILE_EDITOR_INPUT_ID, IExplorerService } from 'vs/workbench/contrib/files/common/files';
import { FileEditorTracker } from 'vs/workbench/contrib/files/browser/editors/fileEditorTracker';
19
import { SaveErrorHandler } from 'vs/workbench/contrib/files/browser/saveErrorHandler';
20 21 22
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
import { TextFileEditor } from 'vs/workbench/contrib/files/browser/editors/textFileEditor';
import { BinaryFileEditor } from 'vs/workbench/contrib/files/browser/editors/binaryFileEditor';
23
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
24
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
A
Renames  
Alex Dima 已提交
25
import { IKeybindings } from 'vs/platform/keybinding/common/keybindingsRegistry';
B
Benjamin Pasero 已提交
26
import { IViewletService } from 'vs/workbench/services/viewlet/browser/viewlet';
27
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
28
import * as platform from 'vs/base/common/platform';
29
import { DirtyFilesTracker } from 'vs/workbench/contrib/files/common/dirtyFilesTracker';
30
import { ExplorerViewlet, ExplorerViewletViewsContribution } from 'vs/workbench/contrib/files/browser/explorerViewlet';
31
import { IEditorRegistry, EditorDescriptor, Extensions as EditorExtensions } from 'vs/workbench/browser/editor';
32
import { DataUriEditorInput } from 'vs/workbench/common/editor/dataUriEditorInput';
33
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
34
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
35
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
I
isidor 已提交
36
import { ILabelService } from 'vs/platform/label/common/label';
37
import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService';
I
isidor 已提交
38
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
39
import { ExplorerService } from 'vs/workbench/contrib/files/common/explorerService';
E
Erich Gamma 已提交
40 41

// Viewlet Action
B
Benjamin Pasero 已提交
42
export class OpenExplorerViewletAction extends ShowViewletAction {
M
Matt Bierner 已提交
43 44
	public static readonly ID = VIEWLET_ID;
	public static readonly LABEL = nls.localize('showExplorerViewlet', "Show Explorer");
E
Erich Gamma 已提交
45 46 47 48 49

	constructor(
		id: string,
		label: string,
		@IViewletService viewletService: IViewletService,
B
Benjamin Pasero 已提交
50
		@IEditorGroupsService editorGroupService: IEditorGroupsService,
51
		@IWorkbenchLayoutService layoutService: IWorkbenchLayoutService
E
Erich Gamma 已提交
52
	) {
53
		super(id, label, VIEWLET_ID, viewletService, editorGroupService, layoutService);
E
Erich Gamma 已提交
54 55 56
	}
}

I
isidor 已提交
57
class FileUriLabelContribution implements IWorkbenchContribution {
58

I
isidor 已提交
59
	constructor(@ILabelService labelService: ILabelService) {
60 61 62
		labelService.registerFormatter({
			scheme: 'file',
			formatting: {
63
				label: '${authority}${path}',
64
				separator: sep,
65
				tildify: !platform.isWindows,
I
isidor 已提交
66
				normalizeDriveLetter: platform.isWindows,
67
				authorityPrefix: sep + sep,
68
				workspaceSuffix: ''
69
			}
70 71 72 73
		});
	}
}

E
Erich Gamma 已提交
74
// Register Viewlet
B
Benjamin Pasero 已提交
75
Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets).registerViewlet(new ViewletDescriptor(
76
	ExplorerViewlet,
E
Erich Gamma 已提交
77
	VIEWLET_ID,
B
Benjamin Pasero 已提交
78
	nls.localize('explore', "Explorer"),
E
Erich Gamma 已提交
79 80 81 82
	'explore',
	0
));

I
isidor 已提交
83
registerSingleton(IExplorerService, ExplorerService, true);
I
isidor 已提交
84

B
Benjamin Pasero 已提交
85
Registry.as<ViewletRegistry>(ViewletExtensions.Viewlets).setDefaultViewletId(VIEWLET_ID);
E
Erich Gamma 已提交
86

B
Benjamin Pasero 已提交
87
const openViewletKb: IKeybindings = {
E
Erich Gamma 已提交
88 89 90 91
	primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_E
};

// Register Action to Open Viewlet
B
Benjamin Pasero 已提交
92
const registry = Registry.as<IWorkbenchActionRegistry>(ActionExtensions.WorkbenchActions);
93
registry.registerWorkbenchAction(
E
Erich Gamma 已提交
94
	new SyncActionDescriptor(OpenExplorerViewletAction, OpenExplorerViewletAction.ID, OpenExplorerViewletAction.LABEL, openViewletKb),
95
	'View: Show Explorer',
96
	nls.localize('view', "View")
E
Erich Gamma 已提交
97 98 99
);

// Register file editors
B
Benjamin Pasero 已提交
100
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
B
Benjamin Pasero 已提交
101
	new EditorDescriptor(
102 103 104
		TextFileEditor,
		TextFileEditor.ID,
		nls.localize('textFileEditor', "Text File Editor")
E
Erich Gamma 已提交
105 106 107 108 109 110
	),
	[
		new SyncDescriptor<EditorInput>(FileEditorInput)
	]
);

B
Benjamin Pasero 已提交
111
Registry.as<IEditorRegistry>(EditorExtensions.Editors).registerEditor(
B
Benjamin Pasero 已提交
112
	new EditorDescriptor(
113 114 115
		BinaryFileEditor,
		BinaryFileEditor.ID,
		nls.localize('binaryFileEditor', "Binary File Editor")
E
Erich Gamma 已提交
116 117
	),
	[
118 119
		new SyncDescriptor<EditorInput>(FileEditorInput),
		new SyncDescriptor<EditorInput>(DataUriEditorInput)
E
Erich Gamma 已提交
120 121 122
	]
);

123
// Register default file input factory
124
Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerFileInputFactory({
125 126
	createFileInput: (resource, encoding, instantiationService): IFileEditorInput => {
		return instantiationService.createInstance(FileEditorInput, resource, encoding);
127 128 129 130
	},

	isFileInput: (obj): obj is IFileEditorInput => {
		return obj instanceof FileEditorInput;
131 132
	}
});
E
Erich Gamma 已提交
133 134

interface ISerializedFileInput {
135
	resource: string;
B
Benjamin Pasero 已提交
136
	resourceJSON: object;
137
	encoding?: string;
E
Erich Gamma 已提交
138 139 140 141 142
}

// Register Editor Input Factory
class FileEditorInputFactory implements IEditorInputFactory {

B
Benjamin Pasero 已提交
143
	constructor() { }
E
Erich Gamma 已提交
144 145

	public serialize(editorInput: EditorInput): string {
B
Benjamin Pasero 已提交
146
		const fileEditorInput = <FileEditorInput>editorInput;
147
		const resource = fileEditorInput.getResource();
B
Benjamin Pasero 已提交
148
		const fileInput: ISerializedFileInput = {
149
			resource: resource.toString(), // Keep for backwards compatibility
150 151
			resourceJSON: resource.toJSON(),
			encoding: fileEditorInput.getEncoding()
E
Erich Gamma 已提交
152 153 154 155 156
		};

		return JSON.stringify(fileInput);
	}

157 158 159
	public deserialize(instantiationService: IInstantiationService, serializedEditorInput: string): FileEditorInput {
		return instantiationService.invokeFunction<FileEditorInput>(accessor => {
			const fileInput: ISerializedFileInput = JSON.parse(serializedEditorInput);
J
Johannes Rieken 已提交
160
			const resource = !!fileInput.resourceJSON ? URI.revive(<UriComponents>fileInput.resourceJSON) : URI.parse(fileInput.resource);
161
			const encoding = fileInput.encoding;
E
Erich Gamma 已提交
162

B
Benjamin Pasero 已提交
163
			return accessor.get(IEditorService).createInput({ resource, encoding, forceFile: true }) as FileEditorInput;
164
		});
E
Erich Gamma 已提交
165 166 167
	}
}

168
Registry.as<IEditorInputFactoryRegistry>(EditorInputExtensions.EditorInputFactories).registerEditorInputFactory(FILE_EDITOR_INPUT_ID, FileEditorInputFactory);
E
Erich Gamma 已提交
169

S
Sandeep Somavarapu 已提交
170 171 172
// Register Explorer views
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(ExplorerViewletViewsContribution, LifecyclePhase.Starting);

173
// Register File Editor Tracker
174
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(FileEditorTracker, LifecyclePhase.Starting);
E
Erich Gamma 已提交
175

B
Benjamin Pasero 已提交
176
// Register Save Error Handler
177
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(SaveErrorHandler, LifecyclePhase.Starting);
B
Benjamin Pasero 已提交
178

179
// Register Dirty Files Tracker
180
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(DirtyFilesTracker, LifecyclePhase.Starting);
181

182
// Register uri display for file uris
I
isidor 已提交
183
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(FileUriLabelContribution, LifecyclePhase.Starting);
184 185


E
Erich Gamma 已提交
186
// Configuration
B
Benjamin Pasero 已提交
187
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
E
Erich Gamma 已提交
188 189 190

configurationRegistry.registerConfiguration({
	'id': 'files',
191
	'order': 9,
192
	'title': nls.localize('filesConfigurationTitle', "Files"),
E
Erich Gamma 已提交
193 194 195 196
	'type': 'object',
	'properties': {
		'files.exclude': {
			'type': 'object',
197
			'markdownDescription': nls.localize('exclude', "Configure glob patterns for excluding files and folders. For example, the files explorer decides which files and folders to show or hide based on this setting. Read more about glob patterns [here](https://code.visualstudio.com/docs/editor/codebasics#_advanced-search-options)."),
P
Peter V 已提交
198
			'default': { '**/.git': true, '**/.svn': true, '**/.hg': true, '**/CVS': true, '**/.DS_Store': true },
S
Sandeep Somavarapu 已提交
199
			'scope': ConfigurationScope.RESOURCE,
E
Erich Gamma 已提交
200 201 202 203 204 205 206 207 208 209 210 211 212
			'additionalProperties': {
				'anyOf': [
					{
						'type': 'boolean',
						'description': nls.localize('files.exclude.boolean', "The glob pattern to match file paths against. Set to true or false to enable or disable the pattern."),
					},
					{
						'type': 'object',
						'properties': {
							'when': {
								'type': 'string', // expression ({ "**/*.js": { "when": "$(basename).js" } })
								'pattern': '\\w*\\$\\(basename\\)\\w*',
								'default': '$(basename).ext',
B
Benjamin Pasero 已提交
213
								'description': nls.localize('files.exclude.when', "Additional check on the siblings of a matching file. Use $(basename) as variable for the matching file name.")
E
Erich Gamma 已提交
214 215 216 217 218 219
							}
						}
					}
				]
			}
		},
B
Benjamin Pasero 已提交
220
		'files.associations': {
221
			'type': 'object',
222
			'markdownDescription': nls.localize('associations', "Configure file associations to languages (e.g. `\"*.extension\": \"html\"`). These have precedence over the default associations of the languages installed."),
223
		},
E
Erich Gamma 已提交
224 225
		'files.encoding': {
			'type': 'string',
226
			'overridable': true,
E
Erich Gamma 已提交
227 228
			'enum': Object.keys(SUPPORTED_ENCODINGS),
			'default': 'utf8',
229
			'description': nls.localize('encoding', "The default character set encoding to use when reading and writing files. This setting can also be configured per language."),
230 231
			'scope': ConfigurationScope.RESOURCE,
			'enumDescriptions': Object.keys(SUPPORTED_ENCODINGS).map(key => SUPPORTED_ENCODINGS[key].labelLong)
E
Erich Gamma 已提交
232
		},
233
		'files.autoGuessEncoding': {
234
			'type': 'boolean',
235
			'overridable': true,
236
			'default': false,
237
			'description': nls.localize('autoGuessEncoding', "When enabled, the editor will attempt to guess the character set encoding when opening files. This setting can also be configured per language."),
S
Sandeep Somavarapu 已提交
238
			'scope': ConfigurationScope.RESOURCE
239
		},
240 241 242 243
		'files.eol': {
			'type': 'string',
			'enum': [
				'\n',
S
Sandeep Somavarapu 已提交
244 245
				'\r\n',
				'auto'
246
			],
247 248
			'enumDescriptions': [
				nls.localize('eol.LF', "LF"),
S
Sandeep Somavarapu 已提交
249 250
				nls.localize('eol.CRLF', "CRLF"),
				nls.localize('eol.auto', "Uses operating system specific end of line character.")
251
			],
S
Sandeep Somavarapu 已提交
252
			'default': 'auto',
253
			'description': nls.localize('eol', "The default end of line character."),
254
			'scope': ConfigurationScope.RESOURCE
255
		},
B
Benjamin Pasero 已提交
256 257 258 259 260
		'files.enableTrash': {
			'type': 'boolean',
			'default': true,
			'description': nls.localize('useTrash', "Moves files/folders to the OS trash (recycle bin on Windows) when deleting. Disabling this will delete files/folders permanently.")
		},
E
Erich Gamma 已提交
261 262 263
		'files.trimTrailingWhitespace': {
			'type': 'boolean',
			'default': false,
264
			'description': nls.localize('trimTrailingWhitespace', "When enabled, will trim trailing whitespace when saving a file."),
S
Sandeep Somavarapu 已提交
265
			'overridable': true,
S
Sandeep Somavarapu 已提交
266
			'scope': ConfigurationScope.RESOURCE
267 268 269 270
		},
		'files.insertFinalNewline': {
			'type': 'boolean',
			'default': false,
271
			'description': nls.localize('insertFinalNewline', "When enabled, insert a final new line at the end of the file when saving it."),
S
Sandeep Somavarapu 已提交
272
			'overridable': true,
S
Sandeep Somavarapu 已提交
273
			'scope': ConfigurationScope.RESOURCE
274
		},
275 276 277 278 279 280 281
		'files.trimFinalNewlines': {
			'type': 'boolean',
			'default': false,
			'description': nls.localize('trimFinalNewlines', "When enabled, will trim all new lines after the final new line at the end of the file when saving it."),
			'overridable': true,
			'scope': ConfigurationScope.RESOURCE
		},
282 283
		'files.autoSave': {
			'type': 'string',
B
Benjamin Pasero 已提交
284
			'enum': [AutoSaveConfiguration.OFF, AutoSaveConfiguration.AFTER_DELAY, AutoSaveConfiguration.ON_FOCUS_CHANGE, AutoSaveConfiguration.ON_WINDOW_CHANGE],
285
			'markdownEnumDescriptions': [
286
				nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'files.autoSave.off' }, "A dirty file is never automatically saved."),
287
				nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'files.autoSave.afterDelay' }, "A dirty file is automatically saved after the configured `#files.autoSaveDelay#`."),
288 289
				nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'files.autoSave.onFocusChange' }, "A dirty file is automatically saved when the editor loses focus."),
				nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'files.autoSave.onWindowChange' }, "A dirty file is automatically saved when the window loses focus.")
290
			],
291
			'default': AutoSaveConfiguration.OFF,
292
			'markdownDescription': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'autoSave' }, "Controls auto save of dirty files. Read more about autosave [here](https://code.visualstudio.com/docs/editor/codebasics#_save-auto-save).", AutoSaveConfiguration.OFF, AutoSaveConfiguration.AFTER_DELAY, AutoSaveConfiguration.ON_FOCUS_CHANGE, AutoSaveConfiguration.ON_WINDOW_CHANGE, AutoSaveConfiguration.AFTER_DELAY)
293
		},
294
		'files.autoSaveDelay': {
295
			'type': 'number',
296
			'default': 1000,
297
			'markdownDescription': nls.localize({ comment: ['This is the description for a setting. Values surrounded by single quotes are not to be translated.'], key: 'autoSaveDelay' }, "Controls the delay in ms after which a dirty file is saved automatically. Only applies when `#files.autoSave#` is set to `{0}`.", AutoSaveConfiguration.AFTER_DELAY)
298 299
		},
		'files.watcherExclude': {
300
			'type': 'object',
301
			'default': platform.isWindows /* https://github.com/Microsoft/vscode/issues/23954 */ ? { '**/.git/objects/**': true, '**/.git/subtree-cache/**': true, '**/node_modules/*/**': true } : { '**/.git/objects/**': true, '**/.git/subtree-cache/**': true, '**/node_modules/**': true },
B
Benjamin Pasero 已提交
302
			'description': nls.localize('watcherExclude', "Configure glob patterns of file paths to exclude from file watching. Patterns must match on absolute paths (i.e. prefix with ** or the full path to match properly). Changing this setting requires a restart. When you experience Code consuming lots of cpu time on startup, you can exclude large folders to reduce the initial load."),
S
Sandeep Somavarapu 已提交
303
			'scope': ConfigurationScope.RESOURCE
D
Daniel Imms 已提交
304 305
		},
		'files.hotExit': {
306
			'type': 'string',
D
Daniel Imms 已提交
307 308
			'enum': [HotExitConfiguration.OFF, HotExitConfiguration.ON_EXIT, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE],
			'default': HotExitConfiguration.ON_EXIT,
309
			'markdownEnumDescriptions': [
D
Daniel Imms 已提交
310
				nls.localize('hotExit.off', 'Disable hot exit.'),
311 312
				nls.localize('hotExit.onExit', 'Hot exit will be triggered when the last window is closed on Windows/Linux or when the `workbench.action.quit` command is triggered (command palette, keybinding, menu). All windows with backups will be restored upon next launch.'),
				nls.localize('hotExit.onExitAndWindowClose', 'Hot exit will be triggered when the last window is closed on Windows/Linux or when the `workbench.action.quit` command is triggered (command palette, keybinding, menu), and also for any window with a folder opened regardless of whether it\'s the last window. All windows without folders opened will be restored upon next launch. To restore folder windows as they were before shutdown set `#window.restoreWindows#` to `all`.')
D
Daniel Imms 已提交
313 314
			],
			'description': nls.localize('hotExit', "Controls whether unsaved files are remembered between sessions, allowing the save prompt when exiting the editor to be skipped.", HotExitConfiguration.ON_EXIT, HotExitConfiguration.ON_EXIT_AND_WINDOW_CLOSE)
315 316 317 318
		},
		'files.defaultLanguage': {
			'type': 'string',
			'description': nls.localize('defaultLanguage', "The default language mode that is assigned to new files.")
319 320 321 322
		},
		'files.maxMemoryForLargeFilesMB': {
			'type': 'number',
			'default': 4096,
323
			'markdownDescription': nls.localize('maxMemoryForLargeFilesMB', "Controls the memory available to VS Code after restart when trying to open large files. Same effect as specifying `--max-memory=NEWSIZE` on the command line.")
324 325 326 327 328 329
		}
	}
});

configurationRegistry.registerConfiguration({
	id: 'editor',
330 331
	order: 5,
	title: nls.localize('editorConfigurationTitle', "Editor"),
332 333
	type: 'object',
	properties: {
334 335 336
		'editor.formatOnSave': {
			'type': 'boolean',
			'default': false,
J
Johannes Rieken 已提交
337
			'description': nls.localize('formatOnSave', "Format a file on save. A formatter must be available, the file must not be saved after delay, and the editor must not be shutting down."),
S
Sandeep Somavarapu 已提交
338 339
			'overridable': true,
			'scope': ConfigurationScope.RESOURCE
340 341 342 343
		},
		'editor.formatOnSaveTimeout': {
			'type': 'number',
			'default': 750,
344
			'description': nls.localize('formatOnSaveTimeout', "Timeout in milliseconds after which the formatting that is run on file save is cancelled."),
R
Robin 已提交
345
			'overridable': true,
346
			'scope': ConfigurationScope.RESOURCE
E
Erich Gamma 已提交
347 348 349 350 351 352
		}
	}
});

configurationRegistry.registerConfiguration({
	'id': 'explorer',
353
	'order': 10,
354
	'title': nls.localize('explorerConfigurationTitle', "File Explorer"),
E
Erich Gamma 已提交
355 356
	'type': 'object',
	'properties': {
357
		'explorer.openEditors.visible': {
E
Erich Gamma 已提交
358
			'type': 'number',
359
			'description': nls.localize({ key: 'openEditorsVisible', comment: ['Open is an adjective'] }, "Number of editors shown in the Open Editors pane."),
E
Erich Gamma 已提交
360 361
			'default': 9
		},
362 363
		'explorer.autoReveal': {
			'type': 'boolean',
R
Rob Lourens 已提交
364
			'description': nls.localize('autoReveal', "Controls whether the explorer should automatically reveal and select files when opening them."),
365
			'default': true
366 367 368
		},
		'explorer.enableDragAndDrop': {
			'type': 'boolean',
R
Rob Lourens 已提交
369
			'description': nls.localize('enableDragAndDrop', "Controls whether the explorer should allow to move files and folders via drag and drop."),
370
			'default': true
371
		},
372 373
		'explorer.confirmDragAndDrop': {
			'type': 'boolean',
R
Rob Lourens 已提交
374
			'description': nls.localize('confirmDragAndDrop', "Controls whether the explorer should ask for confirmation to move files and folders via drag and drop."),
375 376
			'default': true
		},
377 378
		'explorer.confirmDelete': {
			'type': 'boolean',
R
Rob Lourens 已提交
379
			'description': nls.localize('confirmDelete', "Controls whether the explorer should ask for confirmation when deleting a file via the trash."),
380 381
			'default': true
		},
382 383 384 385 386
		'explorer.sortOrder': {
			'type': 'string',
			'enum': [SortOrderConfiguration.DEFAULT, SortOrderConfiguration.MIXED, SortOrderConfiguration.FILES_FIRST, SortOrderConfiguration.TYPE, SortOrderConfiguration.MODIFIED],
			'default': SortOrderConfiguration.DEFAULT,
			'enumDescriptions': [
B
Benjamin Pasero 已提交
387 388 389 390 391
				nls.localize('sortOrder.default', 'Files and folders are sorted by their names, in alphabetical order. Folders are displayed before files.'),
				nls.localize('sortOrder.mixed', 'Files and folders are sorted by their names, in alphabetical order. Files are interwoven with folders.'),
				nls.localize('sortOrder.filesFirst', 'Files and folders are sorted by their names, in alphabetical order. Files are displayed before folders.'),
				nls.localize('sortOrder.type', 'Files and folders are sorted by their extensions, in alphabetical order. Folders are displayed before files.'),
				nls.localize('sortOrder.modified', 'Files and folders are sorted by last modified date, in descending order. Folders are displayed before files.')
392
			],
393
			'description': nls.localize('sortOrder', "Controls sorting order of files and folders in the explorer.")
394
		},
395
		'explorer.decorations.colors': {
396
			type: 'boolean',
R
Rob Lourens 已提交
397
			description: nls.localize('explorer.decorations.colors', "Controls whether file decorations should use colors."),
398
			default: true
399
		},
400
		'explorer.decorations.badges': {
401
			type: 'boolean',
R
Rob Lourens 已提交
402
			description: nls.localize('explorer.decorations.badges', "Controls whether file decorations should use badges."),
403 404
			default: true
		},
E
Erich Gamma 已提交
405
	}
406
});
407 408 409 410 411 412 413 414 415 416

// View menu
MenuRegistry.appendMenuItem(MenuId.MenubarViewMenu, {
	group: '3_views',
	command: {
		id: VIEWLET_ID,
		title: nls.localize({ key: 'miViewExplorer', comment: ['&& denotes a mnemonic'] }, "&&Explorer")
	},
	order: 1
});