eamodio / vscode-toggle-excluded-files

Quickly toggles excluded (hidden) files visibility in the file explorer in VS Code
MIT License
36 stars 8 forks source link

Add custom setting that can copy in the exclude list from a workspace devcontainer #43

Open joezappie opened 1 year ago

joezappie commented 1 year ago

Been using this plugin for months and I love it. The one issue I have is the fact that it relies on the settings in .vscode/settings.json. Since toggling the files changes the settings.json file, this file must be ignored from git (which is also just generally recommended to do).

My project runs in a devcontainer and I'd like to be able to specify a projects predefined hidden list so if I check it out on another machine or a friends clones the project, its already set up.

Devcontainers allow you to specify settings in .devcontainer/devcontainer.json. The issue is "files.exclude" cannot be specified there as vscode ignores it since it only looks at the settings.json.

What I'm proposing is a custom setting is added such as toggleecludedfiles.exclude. Instead of using the files.exclude setting if defined, it should look at that list and generate a new files.exclude based on that. For example:

// devcontainer.json
{
  "customizations": {
    "vscode": {
      "toggleexcludedfiles.exclude": [
         ".devcontainer", 
         ".husky", 
         ".vscode", 
         "**/node_modules", 
         "**/.git", 
         "**/build", 
         "**/dist", 
       ]
    }
  }
} 

Upon clicking the button, if that setting exists, it uses that to generate the files.exclude list instead.

I'd be open to submitting a PR if you like the idea.

eamodio commented 1 year ago

@jrj2211 I think that sounds like a reasonable ask -- looking forward to a PR 😄