explorer-exclude-vscode-extension icon indicating copy to clipboard operation
explorer-exclude-vscode-extension copied to clipboard

Positive Filter

Open iligid opened this issue 1 year ago • 3 comments

Describe the Problem

Instead of filtering out what I don't want to see, a frequent use-case is to filter what I want to see to focus on the currently relevant.

Describe the Solution

*.csv main.py Would show only main.py (if existing anywhere) and .csv-files and hide everything else in the workspace

Negative filtering would normally take priority, i.e. if I add temp*.csv to the hidden files, it should not show up.

It's more or less the same like hiding files, but applying the opposite logic

Alternatives

No response

Additional Context

No response

iligid avatar Dec 08 '23 12:12 iligid

@iligid while I really like this idea, the extension is actually taking advantage of native VS Code filtering, which would basically be anything you can do with the existing explorer tree view. Unfortunately, as far as I can tell ( and I looked ) this idea is not supported by VS Code. Their filtering is subtractive, meaning it removes things only. This would require an additive filtering, meaning it would need to remove EVERYTHING and then add in matches ( which is the opposite of how this currently works ).

If anyone has any creative ideas on how to work around this issue, let us know. I can leave this feature request open to see if the community has any thoughts :)

manifestinteractive avatar Dec 17 '23 07:12 manifestinteractive

A likely working solution would be to just register a handler for the following Workspace events (would not directly react on changes initiated outside of VSCode, however):_

      onDidChangeWorkspaceFolders
      onDidCreateFiles
      onDidRenameFiles

and act on the detected changes according to the below pseudo code for the Event handler:

    if not match(file, blacklist) or match(file, whitelist):
        file.show()
    else:
        file.hide()

And of course all files would need to be looped through when activating/editing/adding/deleting a filter with the same logic

iligid avatar Dec 18 '23 14:12 iligid

I think that my PR can answer this need: https://github.com/sfccdevops/explorer-exclude-vscode-extension/pull/53

Using the VS Code QuickPick Window, you can select the relevant items you want to work on, and the command will hide everything else.

AsafMazuz1 avatar Apr 03 '24 12:04 AsafMazuz1