diff --git a/README.md b/README.md index bc2f55b..9c6cceb 100755 --- a/README.md +++ b/README.md @@ -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: diff --git a/util.js b/util.js index 4af3a31..c204bd0 100755 --- a/util.js +++ b/util.js @@ -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);