feature: add setting whether or not to auto open a file after dropping it into the explorer (#213498)

* feature: add setting whether or not to auto open a file after dropping it into the explorer

* use setting

* fix property

* format code

---------

Co-authored-by: Logan Ramos <lramos15@gmail.com>
This commit is contained in:
Simon Siefke
2024-07-22 22:41:49 +02:00
committed by GitHub
parent f792784d5e
commit 3078b5251e
3 changed files with 8 additions and 1 deletions
@@ -564,7 +564,8 @@ export class ExternalFileImport {
});
// if we only add one file, just open it directly
if (resourceFileEdits.length === 1) {
const autoOpen = this.configurationService.getValue<IFilesConfiguration>().explorer.autoOpenDroppedFile;
if (autoOpen && resourceFileEdits.length === 1) {
const item = this.explorerService.findClosest(resourceFileEdits[0].newResource!);
if (item && !item.isDirectory) {
this.editorService.openEditor({ resource: item.resource, options: { pinned: true } });
@@ -554,6 +554,11 @@ configurationRegistry.registerConfiguration({
description: nls.localize('explorer.incrementalNaming', "Controls which naming strategy to use when giving a new name to a duplicated Explorer item on paste."),
default: 'simple'
},
'explorer.autoOpenDroppedFile': {
'type': 'boolean',
'description': nls.localize('autoOpenDroppedFile', "Controls whether the Explorer should automatically open a file when it is dropped into the explorer"),
'default': true
},
'explorer.compactFolders': {
'type': 'boolean',
'description': nls.localize('compressSingleChildFolders', "Controls whether the Explorer should render folders in a compact form. In such a form, single child folders will be compressed in a combined tree element. Useful for Java package structures, for example."),
@@ -108,6 +108,7 @@ export interface IFilesConfiguration extends PlatformIFilesConfiguration, IWorkb
expand: boolean;
patterns: { [parent: string]: string };
};
autoOpenDroppedFile: boolean;
};
editor: IEditorOptions;
}