sandercox / AutoSortVcxprojFilters

Automatically sort Visual Studio 2013/2015 .vcxproj.filters XML files
Other
4 stars 6 forks source link

Feature Request: Add option to make filters match file system path #4

Open Grifplex opened 4 years ago

Grifplex commented 4 years ago

Installed product versions

Description

Thank you so much for this Awesome extension that should be the way Visual Studio works! A colleague likes to use the "Show All Files" function of the Solution Explorer. When he add files to the project they are added without a filter specified. Could this extension add missing filter folders to match the path on disk?

Steps to recreate

  1. Create a project
  2. Select "Show All Files" in Solution Explorer
  3. Add files in sub-folders
  4. Save project

Current behavior

Filters of files added have missing filter paths i.e.:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <ClCompile Include="src\Main.cpp" />
    <ClCompile Include="src\Class1\Class1.cpp" />
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\Main.hpp" />
    <ClInclude Include="src\Class1\Class1.hpp />
  </ItemGroup>
</Project>

Expected behavior

Add missing Filters for the added files, i.e.:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ItemGroup>
    <ClCompile Include="src\Main.cpp">
      <Filter>src</Filter>
    </ClCompile>
    <ClCompile Include="src\Class1\Class1.cpp">
      <Filter>src\Class1</Filter>
    </ClCompile>
  </ItemGroup>
  <ItemGroup>
    <ClInclude Include="src\Main.hpp">
      <Filter>src</Filter>
    </ClInclude>
    <ClInclude Include="src\Class1\Class1.hpp">
      <Filter>src\Class1</Filter>
    </ClInclude>
  <ItemGroup>
    <Filter Include="src" />
    <Filter Include="src\Class1" />
  </ItemGroup>
sandercox commented 4 years ago

Thank you for your kind words. I like the idea, for some reason every once in a while a file in our project gets 'corrupted' this way too!

If adding files is an issue for your colleague he might also be interested in my other plugin: AddExistingItemInVirtualFolder for when solutions and projects are not at the base level of your code.

But as long as he remains working in the "Show All Files" view that probably doesn't help.

Not sure when I can commit to adding this so no guarantees when it will be in there!