Skip to content

Commit

Permalink
Added 'explorerExclude.showPicker' configuration option, which when f…
Browse files Browse the repository at this point in the history
…alse will NOT show the file picker, but only hide the currently selected item
  • Loading branch information
rw3iss committed May 22, 2020
1 parent 27881fb commit 33737b1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 30 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Select Filter Options you wish to Hide Files & Folders

![picker](https://explorer-exclude.s3.amazonaws.com/picker.gif?v=1.2.0)

You can disable the filter option popup, and by default only allow the selected item to be hidden, by adding this setting in VSCode:

`"explorerExclude.showPicker": false`

#### Managing Hidden Files & Folders

New `HIDDEN ITEMS` Explorer Pane to Manage Hidden Files:
Expand Down
70 changes: 40 additions & 30 deletions util.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,41 +380,51 @@ function vscExclude(uri, callback) {
let selections;
let options = [];

Object.keys(_meta).forEach(key => {
let regex = undefined;
switch (key) {
case 'path':
break;
case 'ext':
regex = _meta[key] ? `**/*${_meta[key]}` : undefined;
break;
case 'base':
regex = _meta[key];
break;
case 'dir':
regex = _meta[key] ? `${_meta[key] + '/'}*.*` : undefined;
break;
const _showPicker = vscode.workspace.getConfiguration(null, null).get('explorerExclude.showPicker');
if (typeof _showPicker == 'undefined')
_showPicker = true;

if (_showPicker) {
Object.keys(_meta).forEach(key => {
let regex = undefined;
switch (key) {
case 'path':
break;
case 'ext':
regex = _meta[key] ? `**/*${_meta[key]}` : undefined;
break;
case 'base':
regex = _meta[key];
break;
case 'dir':
if (_showPicker)
regex = _meta[key] ? `${_meta[key] + '/'}*.*` : undefined;
break;
}
if (regex) {
options.push(regex);
}
});

if (_meta['dir'] && _meta['ext']) {
options.push(`${_meta['dir']}/*${_meta['ext']}`);
}
if (regex) {
options.push(regex);
else if (_meta['ext']) {
options.push(`*${_meta['ext']}`);
}
});

if (_meta['dir'] && _meta['ext']) {
options.push(`${_meta['dir']}/*${_meta['ext']}`);
}
else if (_meta['ext']) {
options.push(`*${_meta['ext']}`);
}

if (_meta['base']) {
options.push(`**/${_meta['base']}`);
if (_meta['dir']) {
options.push(`${_meta['dir']}/${_meta['base']}`);
if (_meta['base']) {
options.push(`**/${_meta['base']}`);
if (_meta['dir']) {
options.push(`${_meta['dir']}/${_meta['base']}`);
}
}
}

selections = yield showPicker(options.reverse());
selections = yield showPicker(options.reverse());
} else {
if (_meta['base'])
selections = [_meta['base']];
}

if (selections && selections.length > 0) {
const config = vscode.workspace.getConfiguration('files', null);
Expand Down

0 comments on commit 33737b1

Please sign in to comment.