AddAnyFile icon indicating copy to clipboard operation
AddAnyFile copied to clipboard

A feature that add multiple files using a user-defined group name

Open Ackara opened this issue 6 years ago • 4 comments

Installed product versions

  • Visual Studio: [2017 Enterprise]
  • This extension: [3.5]

Description

When starting new projects (ASP.NET MVC in particular) I noticed that I typically add the same files every time. So I though what if I could feed the file dialog a group-name and then it expand that name into a file list. A group-name can be identified using the format @(group-name) and its corresponding file-list will come from a .json file.

Example

user-input: @(mvc) expand-to: Views/_ViewImports.cshtml,Views/_ViewStart.cshtml,Views/_Layout.cshtml

/* itemGroups.json */
[
  {
    "Name": "mvc",
    "FileList": ["Views/_ViewImports.cshtml", "Views/_ViewStart.cshtml", "Views/_Layout.cshtml"]
  }
]

I say adding this feature will save users some time.

Should I create a pull request?

Ackara avatar Mar 24 '19 16:03 Ackara

I think this is interesting, but it would be better to have a syntax that lets you type-in a name? Where for example the syntax "entity:Product" could create the files:

  • Controllers/ProductController.cs
  • Views/Product/Index.cshtml
  • Views/Product/Edit.cshtml
  • Styles/Product.less
  • etc.

xps avatar Apr 04 '19 07:04 xps

I like @(product) because @() is how you reference a group of files in MSBuild. Also it is important that @(product) expands-to/replaced-by Controllers/ProductController.cs, Styles/Product.less because you want to be able to add other files. For example @(product), appsettings.json expand-to Controllers/ProductController.cs, Styles/Product.less, appsettings.json.

To be clear, the expanded file-list will not appear in the file dialog, it will happen in the code-behind not the UI.

Ackara avatar Apr 04 '19 11:04 Ackara

My idea was to be able to add a group of file named "entity", with filenames parametrized with the name of the entity, so that you can add a set of files for the "product" entity, then another set for the "order" entity, etc. But maybe it would just be a different feature. In your example you would need to define group of files for each possible entity name ahead of time which wouldn't really work for my use case.

xps avatar Apr 06 '19 13:04 xps

I'd like to enter "Models/Users/[User.cs, Profile.cs, ProfileImage.cs]". It then adds those 3 files in Models/Users. Not sure it already works, right now I'm typing the directories for each file. EDIT - Just found out I could already do this!

JRC86 avatar Oct 08 '20 07:10 JRC86