Skip to content

Commit

Permalink
Update references, fix issue with extension not working at all (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelwgn authored Oct 7, 2020
1 parent 6a09004 commit 071d464
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 64 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This project has the following structure:
* tests
* IndentRainbow.Logic.Tests <- Unit tests for the core logic.


To build the project, you will need to install the Visual Studio 2017 and "Visual Studio extension development" features. Note that VS 2017 is needed to be able to compile the extension for Visual Studio versions before 2019.

### Inspiration
This project was inspired by this project/extension for VS Code:
Expand Down
11 changes: 3 additions & 8 deletions src/IndentRainbow.Extension/Classification/Indent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using IndentRainbow.Extension.Drawing;
using IndentRainbow.Extension.Options;
using IndentRainbow.Logic.Classification;
Expand Down Expand Up @@ -36,7 +35,7 @@ public sealed class Indent
private readonly IRainbowBrushGetter colorGetter;

/// <summary>
/// Validator used for checking wether a given string is a valid indentation
/// Validator used for checking whether a given string is a valid indentation
/// </summary>
private readonly IIndentValidator validator;

Expand All @@ -53,13 +52,9 @@ public sealed class Indent
#pragma warning disable VSTHRD010
public Indent(IWpfTextView view, ITextDocumentFactoryService textDocumentFactory)
{
if (view == null)
if (view == null || textDocumentFactory == null)
{
throw new ArgumentNullException(nameof(view));
}
if (textDocumentFactory == null)
{
throw new ArgumentNullException(nameof(textDocumentFactory));
return;
}
layer = view.GetAdornmentLayer("Indent");

Expand Down
62 changes: 16 additions & 46 deletions src/IndentRainbow.Extension/IndentRainbow.Extension.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
<PropertyGroup>
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\IndentRainbowPackage.ico</ApplicationIcon>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -83,37 +86,21 @@
</None>
</ItemGroup>
<ItemGroup>
<Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="EnvDTE100, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="EnvDTE90, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.Build.Framework" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.CommandBars, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>False</EmbedInteropTypes>
<Reference Include="Microsoft.VisualStudio.CoreUtility, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="Microsoft.VisualStudio.Text.Data, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.Text.UI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Reference Include="Microsoft.VisualStudio.Text.UI.Wpf, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<EmbedInteropTypes>False</EmbedInteropTypes>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Design" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xaml" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
Expand All @@ -123,34 +110,17 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Resources\IndentRainbowPackage.ico" />
<Content Include="Resources\IndentRainbowPackage.ico">
<IncludeInVSIX>true</IncludeInVSIX>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="VSPackage.resx">
<MergeWithCTO>true</MergeWithCTO>
<ManifestResourceName>VSPackage</ManifestResourceName>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.OLE.Interop">
<Version>16.7.30328.74</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Shell.15.0">
<Version>16.7.30329.88</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Text.UI.Wpf">
<Version>16.6.255</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading">
<Version>16.7.56</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers">
<Version>16.7.56</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Utilities.Internal">
<Version>16.3.23</Version>
</PackageReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\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.
Expand Down
4 changes: 2 additions & 2 deletions src/IndentRainbow.Extension/Options/OptionsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ private static WritableSettingsStore GetWritableSettingsStore()
public static OptionsField<HighlightingMode> highlightingMode = new OptionsField<HighlightingMode>(DefaultRainbowIndentOptions.defaultHighlightingMode);

/// <summary>
/// The detect error flag which determines wether errors will be highlighted
/// The detect error flag which determines whether errors will be highlighted
/// </summary>
public static OptionsField<bool> detectErrors = new OptionsField<bool>(DefaultRainbowIndentOptions.defaultDetectErrorsFlag);

Expand Down Expand Up @@ -108,7 +108,7 @@ public static void LoadSettings()
/// <summary>
/// Saves the settings to the settings store
/// </summary>
/// <param name="indentSize">The indent size specifiyng the number of spaces for indentation detection</param>
/// <param name="indentSize">The indent size specifying the number of spaces for indentation detection</param>
/// <param name="colors">The colors as string</param>
public static void SaveSettings(int indentSize, string fileExtensionsString, string colors, double opacityMultiplier, HighlightingMode highlightingmode, string errorColor, bool detectError)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public static void SaveDetectErrorsFlag(this WritableSettingsStore store, bool d
/// Saves the error color
/// </summary>
/// <param name="store">The writable settings store</param>
/// <param name="errorColor">The erro color to save</param>
/// <param name="errorColor">The error color to save</param>
public static void SaveErrorColor(this WritableSettingsStore store, string errorColor)
{
store?.SetString(CollectionName, errorColorPropertyName, errorColor);
Expand Down
3 changes: 2 additions & 1 deletion src/IndentRainbow.Extension/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="IndentRainbow.f05146ed-8025-4668-b7b1-8a74bd22b241" Version="1.0.0" Language="en-US" Publisher="Marcel Wagner" />
<Identity Id="IndentRainbow.f05146ed-8025-4668-b7b1-8a74bd22b241" Version="1.0.1" Language="en-US" Publisher="Marcel Wagner" />
<DisplayName>IndentRainbow</DisplayName>
<Description xml:space="preserve">Extensions for showing rainbow colors to make it easier to differentiate indent levels.</Description>
<Icon>Resources\IndentRainbowPackage.ico</Icon>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[14.0, 20.0)" />
Expand Down
4 changes: 2 additions & 2 deletions src/IndentRainbow.Logic/Classification/LineDecoratorBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ public LineDecoratorBase(IBackgroundTextIndexDrawer drawer, IRainbowBrushGetter
public abstract void DecorateLine(string text, int startIndex, int endIndex);

/// <summary>
/// Calculates the lenght of the indentation block.
/// Calculates the length of the indentation block.
/// Returns the value positive if indentation is valid, otherwise returns the value as negative number
/// For example the text " text" (4 spaces) would return 4 for indent length 4,
/// but the text " text" (5 spaces) returns -5 for indent length 4.
/// </summary>
/// <remarks>
/// For perfomance reasons, instead of returning a Tuple containing a boolean and an integer,
/// For performance reasons, instead of returning a Tuple containing a boolean and an integer,
/// the method returns just one integer.
/// </remarks>
/// <param name="text">Text containing the line to be analyzed</param>
Expand Down
2 changes: 1 addition & 1 deletion src/IndentRainbow.Logic/Colors/IRainbowBrushGetter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public interface IRainbowBrushGetter

/// <summary>
/// Returns the color specified by the index.
/// Indeces larger than the list of colors, should be treated at wrapping around to the start
/// Indices larger than the list of colors, should be treated at wrapping around to the start
/// </summary>
/// <param name="rainbowIndex">The index of the color (starting at 0)</param>
/// <returns>The Brush that sits at the index specified</returns>
Expand Down
2 changes: 0 additions & 2 deletions tests/IndentRainbow.Logic.Tests/Parser/LanguageParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ namespace IndentRainbow.Logic.Tests.Parser
[TestFixture]
public class LanguageParserTests
{


[Test]
[TestCase("cs:4;js,jsx:5;", "cs:4,js:5,jsx:5")]
[TestCase("cs,js,jsx:5;css:4;html:2", "cs:5,js:5,jsx:5,css:4,html:2")]
Expand Down

0 comments on commit 071d464

Please sign in to comment.