Skip to content

Commit

Permalink
Rebrand as Toggle Regions Extension
Browse files Browse the repository at this point in the history
Avoid confusing this extension with Collapse Region Extension from which
this was forked. Update icon, file names, namespaces, and IDs to avoid
collisions.

Many thanks to the author of Collapse Region Extension for releasing
source with the MIT license.
  • Loading branch information
mdmower committed Jan 15, 2023
1 parent af007be commit c0fa5e8
Show file tree
Hide file tree
Showing 23 changed files with 526 additions and 423 deletions.
4 changes: 2 additions & 2 deletions Common/RegionCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Microsoft.VisualStudio.TextManager.Interop;
using Task = System.Threading.Tasks.Task;

namespace CollapseRegionExtension
namespace ToggleRegionsExtension
{
/// <summary>
/// Command handler
Expand All @@ -30,7 +30,7 @@ internal sealed class RegionCommands
/// <summary>
/// Command menu group (command set GUID).
/// </summary>
public static readonly Guid CommandSet = new Guid("155b6515-ed99-4e79-8950-2bdf525871db");
public static readonly Guid CommandSet = new Guid("e7b8c17f-d4e1-419b-a144-4cfec19ad1a4");

/// <summary>
/// VS Package that provides this command, not null.
Expand Down
6 changes: 3 additions & 3 deletions Common/RegionCommandsPackage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using Microsoft.VisualStudio.Shell;
using Task = System.Threading.Tasks.Task;

namespace CollapseRegionExtension
namespace ToggleRegionsExtension
{
/// <summary>
/// This is the class that implements the package exposed by this assembly.
Expand All @@ -24,15 +24,15 @@ namespace CollapseRegionExtension
/// </para>
/// </remarks>
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)]
[InstalledProductRegistration("#110", "#112", "1.5", IconResourceID = 400)] // Info on this package for Help/About
[InstalledProductRegistration("#110", "#112", "1.6", IconResourceID = 400)] // Info on this package for Help/About
[ProvideMenuResource("Menus.ctmenu", 1)]
[Guid(RegionCommandsPackage.PackageGuidString)]
public sealed class RegionCommandsPackage : AsyncPackage
{
/// <summary>
/// RegionCommandsPackage GUID string.
/// </summary>
public const string PackageGuidString = "87e70c51-1e00-4e22-9099-85542c07fdd3";
public const string PackageGuidString = "b4f29fd5-b781-49f9-a404-4dae784250b0";

/// <summary>
/// Initializes a new instance of the <see cref="RegionCommandsPackage"/> class.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>54e2047f-59b4-4198-81ea-f50cdf04050b</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>CollapseRegionCommon</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)RegionCommands.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RegionCommandsPackage.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)VSPackage.resx" />
</ItemGroup>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)Resources\RegionCommandsPackage.ico" />
</ItemGroup>
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>54e2047f-59b4-4198-81ea-f50cdf04050b</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>ToggleRegionsCommon</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)RegionCommands.cs" />
<Compile Include="$(MSBuildThisFileDirectory)RegionCommandsPackage.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)VSPackage.resx" />
</ItemGroup>
<ItemGroup>
<Content Include="$(MSBuildThisFileDirectory)Resources\RegionCommandsPackage.ico" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>54e2047f-59b4-4198-81ea-f50cdf04050b</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="CollapseRegionCommon.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>54e2047f-59b4-4198-81ea-f50cdf04050b</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="ToggleRegionsCommon.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
4 changes: 2 additions & 2 deletions Common/VSPackage.resx
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="110" xml:space="preserve">
<value>Collapse Region Extension</value>
<value>Toggle Regions Extension</value>
</data>
<data name="112" xml:space="preserve">
<value>Collapse/Expand #regions in code editor tabs.</value>
<value>Collapse or expand #regions in code editor tabs.</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="400" type="System.Resources.ResXFileRef, System.Windows.Forms">
Expand Down
Binary file removed Metadata/Icons/expand.png
Binary file not shown.
Binary file added Metadata/Icons/extension-icon-128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Metadata/Icons/extension-icon-200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Metadata/Icons/extension-icon-32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Metadata/Icons/extension-icon-readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Spacing between edge of graphic and contents is 0.875 x height.

When resizing for PNG, best output comes from (assuming Inkscape):
- Resize document to desired square size.
- Resize content to 0.875 x (document height) while maintaining aspect ratio.
- Export PNG.
75 changes: 75 additions & 0 deletions Metadata/Icons/extension-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions Metadata/RegionCommandsPackage.vsct
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@

<Symbols>
<!-- This is the package guid. -->
<GuidSymbol name="guidRegionCommandsPackage" value="{87e70c51-1e00-4e22-9099-85542c07fdd3}" />
<GuidSymbol name="guidRegionCommandsPackage" value="{b4f29fd5-b781-49f9-a404-4dae784250b0}" />

<!-- This is the guid used to group the menu commands together -->
<GuidSymbol name="guidRegionCommandsPackageCmdSet" value="{155b6515-ed99-4e79-8950-2bdf525871db}">
<GuidSymbol name="guidRegionCommandsPackageCmdSet" value="{e7b8c17f-d4e1-419b-a144-4cfec19ad1a4}">
<!--<IDSymbol name="RegionCommandsGroup" value="0x0200" />-->
<IDSymbol name="RegionExpandId" value="0x0100" />
<IDSymbol name="RegionCollapseId" value="0x0101" />
Expand Down
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
## Collapse Region Extension for Visual Studio
## Toggle Regions Extension for Visual Studio

Two new commands are exposed:

- `RegionManagement.Expand` - Default shortcut: CTRL+R, CTRL+Num +
- `RegionManagement.Collapse` - Default shortcut: CTRL+R, CTRL+Num -

These shortcuts can be remapped in Tools > Options > Environment > Keyboard.
Quickly collapse or expand all region sections in a code editor tab.

Recognized regions:

- `#region` - .cs files
- `<!--region` - .xaml files
- `#pragma region` - .cpp files

### Configurable Commands

Two commands are added to the Outlining menu: "Expand all regions" and "Collapse all regions".

These commands are exposed to Visual Studio as:

- `RegionManagement.Expand` - Default shortcut: CTRL+R, CTRL+Num +
- `RegionManagement.Collapse` - Default shortcut: CTRL+R, CTRL+Num -

... and can be remapped in Tools > Options > Environment > Keyboard.

### Compatibility

- Visual Studio 2022 (Version 17.3 or later)
Expand All @@ -29,5 +35,6 @@ Release configuration builds can optionally be signed using a strong name keypai

This extension was forked from [Vlad-Herus/CollapseRegionExtension](https://github.com/Vlad-Herus/CollapseRegionExtension).

MIT License
Copyright (c) 2022 Matt Mower
Copyright (c) 2018 VladimirUAZ
100 changes: 50 additions & 50 deletions CollapseRegionExtension.sln → ToggleRegionsExtension.sln
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CollapseRegionVS2022", "VS2022\CollapseRegionVS2022.csproj", "{951F86CB-5978-4167-9489-CF0AA0F47776}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "CollapseRegionCommon", "Common\CollapseRegionCommon.shproj", "{54E2047F-59B4-4198-81EA-F50CDF04050B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CollapseRegionVS2017", "VS2017\CollapseRegionVS2017.csproj", "{6D66EA76-7435-4D6B-AA3F-9F62D948BCE3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CollapseRegionVS2019", "VS2019\CollapseRegionVS2019.csproj", "{6A856C23-0264-4625-9FA3-4CB702138FDE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6E8AF32A-F20D-4F61-8DE5-02F301AA7AF5}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{951F86CB-5978-4167-9489-CF0AA0F47776}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{951F86CB-5978-4167-9489-CF0AA0F47776}.Debug|Any CPU.Build.0 = Debug|Any CPU
{951F86CB-5978-4167-9489-CF0AA0F47776}.Release|Any CPU.ActiveCfg = Release|Any CPU
{951F86CB-5978-4167-9489-CF0AA0F47776}.Release|Any CPU.Build.0 = Release|Any CPU
{6D66EA76-7435-4D6B-AA3F-9F62D948BCE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D66EA76-7435-4D6B-AA3F-9F62D948BCE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D66EA76-7435-4D6B-AA3F-9F62D948BCE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D66EA76-7435-4D6B-AA3F-9F62D948BCE3}.Release|Any CPU.Build.0 = Release|Any CPU
{6A856C23-0264-4625-9FA3-4CB702138FDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A856C23-0264-4625-9FA3-4CB702138FDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A856C23-0264-4625-9FA3-4CB702138FDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A856C23-0264-4625-9FA3-4CB702138FDE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {49128312-AF11-42F9-B642-5C594659EDC9}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Common\CollapseRegionCommon.projitems*{54e2047f-59b4-4198-81ea-f50cdf04050b}*SharedItemsImports = 13
Common\CollapseRegionCommon.projitems*{6a856c23-0264-4625-9fa3-4cb702138fde}*SharedItemsImports = 4
Common\CollapseRegionCommon.projitems*{6d66ea76-7435-4d6b-aa3f-9f62d948bce3}*SharedItemsImports = 4
Common\CollapseRegionCommon.projitems*{951f86cb-5978-4167-9489-cf0aa0f47776}*SharedItemsImports = 4
EndGlobalSection
EndGlobal

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.3.32929.385
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToggleRegionsVS2022", "VS2022\ToggleRegionsVS2022.csproj", "{951F86CB-5978-4167-9489-CF0AA0F47776}"
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ToggleRegionsCommon", "Common\ToggleRegionsCommon.shproj", "{54E2047F-59B4-4198-81EA-F50CDF04050B}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToggleRegionsVS2017", "VS2017\ToggleRegionsVS2017.csproj", "{6D66EA76-7435-4D6B-AA3F-9F62D948BCE3}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ToggleRegionsVS2019", "VS2019\ToggleRegionsVS2019.csproj", "{6A856C23-0264-4625-9FA3-4CB702138FDE}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{6E8AF32A-F20D-4F61-8DE5-02F301AA7AF5}"
ProjectSection(SolutionItems) = preProject
README.md = README.md
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{951F86CB-5978-4167-9489-CF0AA0F47776}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{951F86CB-5978-4167-9489-CF0AA0F47776}.Debug|Any CPU.Build.0 = Debug|Any CPU
{951F86CB-5978-4167-9489-CF0AA0F47776}.Release|Any CPU.ActiveCfg = Release|Any CPU
{951F86CB-5978-4167-9489-CF0AA0F47776}.Release|Any CPU.Build.0 = Release|Any CPU
{6D66EA76-7435-4D6B-AA3F-9F62D948BCE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D66EA76-7435-4D6B-AA3F-9F62D948BCE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D66EA76-7435-4D6B-AA3F-9F62D948BCE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D66EA76-7435-4D6B-AA3F-9F62D948BCE3}.Release|Any CPU.Build.0 = Release|Any CPU
{6A856C23-0264-4625-9FA3-4CB702138FDE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6A856C23-0264-4625-9FA3-4CB702138FDE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6A856C23-0264-4625-9FA3-4CB702138FDE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6A856C23-0264-4625-9FA3-4CB702138FDE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {49128312-AF11-42F9-B642-5C594659EDC9}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
Common\ToggleRegionsCommon.projitems*{54e2047f-59b4-4198-81ea-f50cdf04050b}*SharedItemsImports = 13
Common\ToggleRegionsCommon.projitems*{6a856c23-0264-4625-9fa3-4cb702138fde}*SharedItemsImports = 4
Common\ToggleRegionsCommon.projitems*{6d66ea76-7435-4d6b-aa3f-9f62d948bce3}*SharedItemsImports = 4
Common\ToggleRegionsCommon.projitems*{951f86cb-5978-4167-9489-cf0aa0f47776}*SharedItemsImports = 4
EndGlobalSection
EndGlobal
4 changes: 2 additions & 2 deletions VS2017/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CollapseRegionExtension")]
[assembly: AssemblyTitle("ToggleRegionsExtension")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CollapseRegionExtension")]
[assembly: AssemblyProduct("ToggleRegionsExtension")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down
Loading

0 comments on commit c0fa5e8

Please sign in to comment.