Skip to content

Commit

Permalink
Implement BeforeSave commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jednano committed May 1, 2013
1 parent 99ccd52 commit 0402fee
Show file tree
Hide file tree
Showing 44 changed files with 2,209 additions and 248 deletions.
16 changes: 3 additions & 13 deletions .editorconfig
Expand Up @@ -2,19 +2,9 @@ root=true

[*]
end_of_line = LF

[*.cs]
indent_style = space
indent_size = 4

[*.csproj]
indent_style = space
indent_size = 2

[*.cpp]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.h]
indent_style = space
indent_size = 2
[*.cs]
indent_size = 4
7 changes: 7 additions & 0 deletions .gitattributes
@@ -0,0 +1,7 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
24 changes: 21 additions & 3 deletions EditorConfig.VisualStudio.sln
@@ -1,22 +1,40 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorConfigPackage", "Plugin\EditorConfigPackage.csproj", "{47C063F7-1FE9-4695-9854-30DF51B87783}"
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorConfig", "Plugin\EditorConfig.csproj", "{47C063F7-1FE9-4695-9854-30DF51B87783}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Wrapper", "Wrapper\Wrapper.vcxproj", "{85F4C576-ECA4-44D7-98D0-FE065632C51E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{47C063F7-1FE9-4695-9854-30DF51B87783}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47C063F7-1FE9-4695-9854-30DF51B87783}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47C063F7-1FE9-4695-9854-30DF51B87783}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{47C063F7-1FE9-4695-9854-30DF51B87783}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{47C063F7-1FE9-4695-9854-30DF51B87783}.Debug|Win32.ActiveCfg = Debug|Any CPU
{47C063F7-1FE9-4695-9854-30DF51B87783}.Debug|Win32.Build.0 = Debug|Any CPU
{47C063F7-1FE9-4695-9854-30DF51B87783}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47C063F7-1FE9-4695-9854-30DF51B87783}.Release|Any CPU.Build.0 = Release|Any CPU
{47C063F7-1FE9-4695-9854-30DF51B87783}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{47C063F7-1FE9-4695-9854-30DF51B87783}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{47C063F7-1FE9-4695-9854-30DF51B87783}.Release|Win32.ActiveCfg = Release|Any CPU
{47C063F7-1FE9-4695-9854-30DF51B87783}.Release|Win32.Build.0 = Release|Any CPU
{85F4C576-ECA4-44D7-98D0-FE065632C51E}.Debug|Any CPU.ActiveCfg = Debug|Win32
{85F4C576-ECA4-44D7-98D0-FE065632C51E}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{85F4C576-ECA4-44D7-98D0-FE065632C51E}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{85F4C576-ECA4-44D7-98D0-FE065632C51E}.Debug|Win32.ActiveCfg = Debug|Win32
{85F4C576-ECA4-44D7-98D0-FE065632C51E}.Debug|Win32.Build.0 = Debug|Win32
{85F4C576-ECA4-44D7-98D0-FE065632C51E}.Release|Any CPU.ActiveCfg = Release|Win32
{85F4C576-ECA4-44D7-98D0-FE065632C51E}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{85F4C576-ECA4-44D7-98D0-FE065632C51E}.Release|Mixed Platforms.Build.0 = Release|Win32
{85F4C576-ECA4-44D7-98D0-FE065632C51E}.Release|Win32.ActiveCfg = Release|Win32
{85F4C576-ECA4-44D7-98D0-FE065632C51E}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
Expand Down
154 changes: 154 additions & 0 deletions Plugin/EditorConfig.csproj
@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">11.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{47C063F7-1FE9-4695-9854-30DF51B87783}</ProjectGuid>
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EditorConfig.VisualStudio</RootNamespace>
<AssemblyName>EditorConfig</AssemblyName>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<RunCodeAnalysis>true</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
<Reference Include="envdte, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="envdte80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.CoreUtility, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.OLE.Interop" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0" />
<Reference Include="Microsoft.VisualStudio.Shell.11.0" />
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0" />
<Reference Include="Microsoft.VisualStudio.Text.Data, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Text.Logic, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Text.UI, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Text.UI.Wpf, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Helpers\EditPointExtensions.cs" />
<Compile Include="Helpers\OutputWindowHelper.cs" />
<Compile Include="Helpers\SettingsExtensions.cs" />
<Compile Include="Helpers\TextDocumentExtensions.cs" />
<Compile Include="Helpers\UndoTransactionHelper.cs" />
<Compile Include="Integration\Commands\BaseCommand.cs" />
<Compile Include="Integration\Commands\CleanupActiveCodeCommand.cs" />
<Compile Include="Integration\Events\BaseEventListener.cs" />
<Compile Include="Integration\Events\RunningDocumentTableEventListener.cs" />
<Compile Include="Integration\Events\ShellEventListener.cs" />
<Compile Include="Integration\Events\TextViewCreationListener.cs" />
<Compile Include="Integration\Guids.cs" />
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="EditorConfigPackage.cs" />
<Compile Include="Integration\PkgCmdIDList.cs" />
<Compile Include="Logic\Cleaning\CodeCleanupAvailabilityLogic.cs" />
<Compile Include="Logic\Cleaning\CodeCleanupManager.cs" />
<Compile Include="Logic\Cleaning\InitialCleanup.cs" />
<Compile Include="Logic\Settings\GlobalSettings.cs" />
<Compile Include="Logic\Settings\LocalSettings.cs" />
<Compile Include="Logic\Settings\SettingsManager.cs" />
<Compile Include="Logic\Settings\TextViewMonitor.cs" />
<Compile Include="Model\CodeItems\BaseCodeItem.cs" />
<Compile Include="Model\CodeItems\BaseCodeItemElement.cs" />
<Compile Include="Model\CodeItems\ICodeItem.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="VSPackage.resx">
<MergeWithCTO>true</MergeWithCTO>
<ManifestResourceName>VSPackage</ManifestResourceName>
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Key.snk" />
</ItemGroup>
<ItemGroup>
<Content Include="EditorConfig.vsct" />
<Resource Include="Resources\EditorConfig.ico" />
<Content Include="License.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\EditorConfig.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\EditorConfig_Large.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Wrapper\Wrapper.vcxproj">
<Project>{85f4c576-eca4-44d7-98d0-fe065632c51e}</Project>
<Name>Wrapper</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup>
<UseCodebase>true</UseCodebase>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
73 changes: 73 additions & 0 deletions Plugin/EditorConfig.vsct
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="utf-8"?>
<CommandTable xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<!-- This is the file that defines the actual layout and type of the commands.
It is divided in different sections (e.g. command definition, command
placement, ...), with each defining a specific set of properties.
See the comment before each section for more details about how to
use it. -->

<!-- The VSCT compiler (the tool that translates this file into the binary
format that VisualStudio will consume) has the ability to run a preprocessor
on the vsct file; this preprocessor is (usually) the C++ preprocessor, so
it is possible to define includes and macros with the same syntax used
in C++ files. Using this ability of the compiler here, we include some files
defining some of the constants that we will use inside the file. -->

<!--This is the file that defines the IDs for all the commands exposed by VisualStudio. -->
<Extern href="stdidcmd.h" />

<!--This header contains the command ids for the menus provided by the shell. -->
<Extern href="vsshlids.h" />

<!--Definition of some VSCT specific constants. In this sample we use it for the IDs inside the guidOfficeIcon group. -->
<!--<Extern href="msobtnid.h" xmlns="http://schemas.microsoft.com/VisualStudio/2005-10-18/CommandTable" />-->

<!--The Commands section is where we the commands, menus and menu groups are defined.
This section uses a Guid to identify the package that provides the command defined inside it. -->
<Commands package="GuidEditorConfigPackage">
<!-- Inside this section we have different sub-sections: one for the menus, another
for the menu groups, one for the buttons (the actual commands), one for the combos
and the last one for the bitmaps used. Each element is identified by a command id that
is a unique pair of guid and numeric identifier; the guid part of the identifier is usually
called "command set" and is used to group different command inside a logically related
group; your package should define its own command set in order to avoid collisions
with command ids defined by other packages. -->

<!--Buttons section. -->
<!--This section defines the elements the user can interact with, like a menu command or a button
or combo box in a toolbar. -->
<Buttons>
<!--To define a menu group you have to specify its ID, the parent menu and its display priority.
The command is visible and enabled by default. If you need to change the visibility, status, etc, you can use
the CommandFlag node.
You can add more than one CommandFlag node e.g.:
<CommandFlag>DefaultInvisible</CommandFlag>
<CommandFlag>DynamicVisibility</CommandFlag>
If you do not want an image next to your command, remove the Icon node or set it to <Icon guid="guidOfficeIcon" id="msotcidNoIcon" /> -->
<Button guid="GuidEditorConfigCommandCleanupActiveCode" id="CmdIDEditorConfigCleanupActiveCode" priority="0x0100" type="Button">
<CommandFlag>DefaultDisabled</CommandFlag>
<CommandFlag>DynamicVisibility</CommandFlag>
<CommandFlag>TextChanges</CommandFlag>
<Strings>
<ButtonText>&amp;Cleanup Code</ButtonText>
</Strings>
</Button>
</Buttons>
</Commands>

<KeyBindings>
<KeyBinding guid="GuidEditorConfigCommandCleanupActiveCode" id="CmdIDEditorConfigCleanupActiveCode" editor="guidVSStd97" key1="M" mod1="Control" key2="VK_SPACE" mod2="Control" />
<KeyBinding guid="GuidEditorConfigCommandCleanupActiveCode" id="CmdIDEditorConfigCleanupActiveCode" editor="guidVSStd97" key1="M" mod1="Control" key2="VK_SPACE" />
</KeyBindings>

<Symbols>
<!-- This is the package guid. -->
<GuidSymbol name="GuidEditorConfigPackage" value="{6b4a6b64-eda9-4078-a549-905ed7d6b8aa}" />

<!-- These are the symbols for the individual commands -->
<GuidSymbol name="GuidEditorConfigCommandCleanupActiveCode" value="{2db8f38b-1d85-4567-9c23-20339108788b}">
<IDSymbol name="CmdIDEditorConfigCleanupActiveCode" value="0x1201" />
</GuidSymbol>
</Symbols>
</CommandTable>

0 comments on commit 0402fee

Please sign in to comment.