vscode-fileutils icon indicating copy to clipboard operation
vscode-fileutils copied to clipboard

[feature request] Extend `files.exclude` option

Open gullitmiranda opened this issue 4 years ago • 2 comments

Is your feature request related to a problem? Please describe. My project list take too long to load because I only exclude some folders from watch and search.

ex: my .vscode/settings.json

{
  "search.exclude": {
    "**/.git": true,
    "**/build": true,
    "**/coverage": true,
    "**/node_modules": true,
    "**/dist/": true
  },
  "files.watcherExclude": { /* ... */ },
  "files.exclude": {
    "**/.git": true
  }
}

with this configuration, the build, coverage, node_modules and dist folders are listed in the editor's explorer. but it is not used in searches or watchers, avoiding slowing down my editor.

Describe the solution you'd like A new option, like the one removed in https://github.com/sleistner/vscode-fileutils/pull/141/files#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L137-L141, that when defied merges with the option files.exclude.

A new option, like the one removed in 141, that when defined merges with the option files.exclude.

maybe something like:

.vscode/settings.json

{
	  "typeahead.exclude": {
	    "**/node_modules": true,
	    "**/dist/": true
	  }
}

edit the workspace.findFiles/3 call in https://github.com/sleistner/vscode-fileutils/blob/a0babd9b815333ab81545cb70087a84c479a93a9/src/lib/TreeWalker.ts#L10

function configIgnore(): string[] {
    const excludedFilesConfig = {
        ...workspace.getConfiguration('files.exclude', null)
        ...getConfiguration('typeahead.exclude'),
    };
    return Object
        .keys(excludedFilesConfig)
        .filter((key) => excludedFilesConfig[key] === true)
        .map(((pattern) => pattern.replace(/^!/, '')));
}
const excludePattern = `{${configIgnore.join(',')}` // ex: {**/node_modules,**/dist/}
const files = await workspace.findFiles(pattern, excludePattern, Number.MAX_VALUE);

gullitmiranda avatar Jan 07 '21 00:01 gullitmiranda

Any news / viable workaround on this?

@gullitmiranda, how about submitting a PR, since you already proposed a viable solution? I don't see any contribution rules, though I don't see anything hinting at the author not accepting contribution either.

I would do it, but I feel like I would be appropriating code that is mine. If you'd rather I did it however, please give your blessing and I shall.

ngasst avatar Sep 17 '21 08:09 ngasst

It would be nice to have this option:

    "fileutils.typeahead.exclude": {
        "**/.git": true,
    },

Miladiouss avatar Apr 08 '22 01:04 Miladiouss