microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.16k stars 28.84k forks source link

Workspace Filtered Folders #212637

Closed Servinjesus1 closed 2 months ago

Servinjesus1 commented 4 months ago

Workspace Feature: Filtered Workspace Folders

In short, this Feature involves being able to add folders to workspaces that include only a specific subtree of the referenced folder for use in VSCode. Think of this filter like a step more abstract than extensions which hide files from the Explorer: anything filtered out at the Workspace level is not touched by VSCode or its extensions whatsoever.

Feature Brief

Add the ability to filter contents of a directory when adding it as a Folder to the Workspace. This enables selection of a "sub-tree" of folders/files beneath a directory (location) with which to work in that workspace Folder. For example, if you have a large archive but only want files in folders that match a specific glob pattern (e.g. Archive/**/PRFX*/), then you can add the entire Archive folder, apply this filter, and work with only the files that match this pattern.

Relationship to Other Features

Unlike simply hiding files/folders from the Explorer, Filters would leave unmatched files completely alone and unparsable by further VSCode features or Extensions. This can make configuration simpler so that certain files can be ignored for all extensions at the workspace level, rather than having to reconfigure every extension's ignore patterns for every workspace.

Benefits and Examples

This could drastically save overhead by preventing Source Control, Linters, Debuggers, and Static Code Analyzers configured to run at the Workspace level from processing unnecessary files.

I have a large resource library and archive that I use to store past project information and useful tidbits like snippets. By using a specific naming scheme for these resources, I have certain folders which inform specific types of projects. For example, my archive is organized by year and by specific names based on hierarchy, category, alphabet, time, and location (context) (reverse-LATCH). My resources are similarly sorted into folders. By using filters, I could include the entire Archive or Resources directories, then filter out only the resources which are pertinent to a given project based on that naming scheme. That way I don't have to add specific resources one at a time as separate folders for the workspace.

Adding folders by hand isn't too hard, I admit, but can get a bit messy if I add everything over time to a big project and have tens of workspace folders. Filters would help in that case by essentially "categorizing" workspace folders into groups (past project examples, snippets, etc.) that can be collapsed.

Implementation Ideas

Add a new properties to folders in the .code-workspace that applies filters. For example, following findutils nomenclature:

{
    "path": "...",
    "name": "...",
    "ipath": ["**/Filter1/*", "**/Filter2/**"],
    "iname": ["*.md"]
}

This allows for arbitrary filter application at the folder level (path or ipath) or file level (name or iname). Properties may be string or list like, with list-likes translated to find (-ipath -or)-esque filters

Potential Caveats and Gotchas

VSCodeTriageBot commented 4 months ago

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

VSCodeTriageBot commented 3 months ago

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

VSCodeTriageBot commented 2 months ago

:slightly_frowning_face: In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!