This commit is contained in:
Jackson Kearl 2022-04-25 16:53:52 -07:00
parent 1899618da3
commit 872a78f6e9
No known key found for this signature in database
GPG key ID: DA09A59C409FC400
6 changed files with 22 additions and 25 deletions

View file

@ -95,11 +95,6 @@
"git",
"sash"
],
"explorer.experimental.fileNesting.patterns": {
"*.js": "$(capture).*.js",
"bootstrap.js": "bootstrap-*.js"
},
"explorer.experimental.fileNesting.enabled": true,
"editor.quickSuggestions": {
"other": "inline",
"comments": "inline",

View file

@ -393,7 +393,7 @@ export class ExplorerService implements IExplorerService {
private async onConfigurationUpdated(configuration: IFilesConfiguration, event?: IConfigurationChangeEvent): Promise<void> {
let shouldRefresh = false;
if (event?.affectedKeys.some(x => x.startsWith('explorer.experimental.fileNesting.'))) {
if (event?.affectedKeys.some(x => x.startsWith('explorer.fileNesting.'))) {
shouldRefresh = true;
}

View file

@ -417,7 +417,7 @@ configurationRegistry.registerConfiguration({
nls.localize('sortOrder.modified', 'Files and folders are sorted by last modified date in descending order. Folders are displayed before files.'),
nls.localize('sortOrder.foldersNestsFiles', 'Files and folders are sorted by their names. Folders are displayed before files. Files with nested children are displayed before other files.')
],
'markdownDescription': nls.localize('sortOrder', "Controls the property-based sorting of files and folders in the explorer. When `#explorer.experimental.fileNesting.enabled#` is enabled, also controls sorting of nested files.")
'markdownDescription': nls.localize('sortOrder', "Controls the property-based sorting of files and folders in the explorer. When `#explorer.fileNesting.enabled#` is enabled, also controls sorting of nested files.")
},
'explorer.sortOrderLexicographicOptions': {
'type': 'string',
@ -471,23 +471,18 @@ configurationRegistry.registerConfiguration({
'description': nls.localize('copyRelativePathSeparator', "The path separation character used when copying relative file paths."),
'default': 'auto'
},
'explorer.experimental.fileNesting.enabled': {
'explorer.fileNesting.enabled': {
'type': 'boolean',
scope: ConfigurationScope.RESOURCE,
'markdownDescription': nls.localize('fileNestingEnabled', "Experimental. Controls whether file nesting is enabled in the explorer. File nesting allows for related files in a directory to be visually grouped together under a single parent file."),
'markdownDescription': nls.localize('fileNestingEnabled', "Controls whether file nesting is enabled in the explorer. File nesting allows for related files in a directory to be visually grouped together under a single parent file."),
'default': false,
},
'explorer.experimental.fileNesting.expand': {
'explorer.fileNesting.expand': {
'type': 'boolean',
'markdownDescription': nls.localize('fileNestingExpand', "Experimental. Controls whether file nests are automatically expanded. `#explorer.experimental.fileNesting.enabled#` must be set for this to take effect."),
'markdownDescription': nls.localize('fileNestingExpand', "Controls whether file nests are automatically expanded. `#explorer.fileNesting.enabled#` must be set for this to take effect."),
'default': true,
},
'explorer.experimental.fileNesting.operateAsGroup': {
'type': 'boolean',
'markdownDescription': nls.localize('operateAsGroup', "Controls whether file nests are treated as a group for clipboard operations, file deletions, and during drag and drop."),
'default': true,
},
'explorer.experimental.fileNesting.patterns': {
'explorer.fileNesting.patterns': {
'type': 'object',
scope: ConfigurationScope.RESOURCE,
'markdownDescription': nls.localize('fileNestingPatterns', "Controls nesting of files in the explorer. Each __Item__ represents a parent pattern and may contain a single `*` character that matches any string. Each __Value__ represents a comma separated list of the child patterns that should be shown nested under a given parent. Child patterns may contain several special tokens:\n- `${capture}`: Matches the resolved value of the `*` from the parent pattern\n- `${basename}`: Matches the parent file's basename, the `file` in `file.ts`\n- `${extname}`: Matches the parent file's extension, the `ts` in `file.ts`\n- `${dirname}`: Matches the parent file's directory name, the `src` in `src/file.ts`\n- `*`: Matches any string, may only be used once per child pattern"),
@ -507,7 +502,12 @@ configurationRegistry.registerConfiguration({
'tsconfig.json': 'tsconfig.*.json',
'package.json': 'package-lock.json, yarn.lock',
}
}
},
'explorer.experimental.fileNesting.operateAsGroup': {
'type': 'boolean',
'markdownDescription': nls.localize('operateAsGroup', "Experimental. Controls whether file nests are treated as a group for clipboard operations, file deletions, and during drag and drop."),
'default': true,
},
}
});

View file

@ -384,7 +384,7 @@ export class ExplorerView extends ViewPane implements IExplorerView {
const isCompressionEnabled = () => this.configurationService.getValue<boolean>('explorer.compactFolders');
const getFileNestingSettings = (item?: ExplorerItem) => this.configurationService.getValue<IFilesConfiguration>({ resource: item?.root.resource }).explorer.experimental.fileNesting;
const getFileNestingSettings = (item?: ExplorerItem) => this.configurationService.getValue<IFilesConfiguration>({ resource: item?.root.resource }).explorer.fileNesting;
this.tree = <WorkbenchCompressibleAsyncDataTree<ExplorerItem | ExplorerItem[], ExplorerItem, FuzzyScore>>this.instantiationService.createInstance(WorkbenchCompressibleAsyncDataTree, 'FileExplorer', container, new ExplorerDelegate(), new ExplorerCompressionDelegate(), [this.renderer],
this.instantiationService.createInstance(ExplorerDataSource), {
@ -625,7 +625,7 @@ export class ExplorerView extends ViewPane implements IExplorerView {
}
const toRefresh = item || this.tree.getInput();
if (this.configurationService.getValue<IFilesConfiguration>({ resource: item?.root.resource }).explorer.experimental.fileNesting.enabled) {
if (this.configurationService.getValue<IFilesConfiguration>({ resource: item?.root.resource }).explorer.fileNesting.enabled) {
return (async () => {
try {
await this.tree.updateChildren(toRefresh, recursive, false, {

View file

@ -298,7 +298,7 @@ export class ExplorerItem {
}
fetchChildren(sortOrder: SortOrder): ExplorerItem[] | Promise<ExplorerItem[]> {
const nestingConfig = this.configService.getValue<IFilesConfiguration>({ resource: this.root.resource }).explorer.experimental.fileNesting;
const nestingConfig = this.configService.getValue<IFilesConfiguration>({ resource: this.root.resource }).explorer.fileNesting;
// fast path when the children can be resolved sync
if (nestingConfig.enabled && this.nestedChildren) {
@ -369,7 +369,7 @@ export class ExplorerItem {
private _fileNester: ExplorerFileNestingTrie | undefined;
private get fileNester(): ExplorerFileNestingTrie {
if (!this.root._fileNester) {
const nestingConfig = this.configService.getValue<IFilesConfiguration>({ resource: this.root.resource }).explorer.experimental.fileNesting;
const nestingConfig = this.configService.getValue<IFilesConfiguration>({ resource: this.root.resource }).explorer.fileNesting;
const patterns = Object.entries(nestingConfig.patterns)
.filter(entry =>
typeof (entry[0]) === 'string' && typeof (entry[1]) === 'string' && entry[0] && entry[1])

View file

@ -98,12 +98,14 @@ export interface IFilesConfiguration extends PlatformIFilesConfiguration, IWorkb
badges: boolean;
};
incrementalNaming: 'simple' | 'smart';
fileNesting: {
enabled: boolean;
expand: boolean;
patterns: { [parent: string]: string };
};
experimental: {
fileNesting: {
enabled: boolean;
operateAsGroup: boolean;
expand: boolean;
patterns: { [parent: string]: string };
};
};
};