Skip to content

Commit 071d464

Browse files
authored
Update references, fix issue with extension not working at all (#15)
1 parent 6a09004 commit 071d464

File tree

9 files changed

+28
-64
lines changed

9 files changed

+28
-64
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This project has the following structure:
1818
* tests
1919
* IndentRainbow.Logic.Tests <- Unit tests for the core logic.
2020

21-
21+
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.
2222

2323
### Inspiration
2424
This project was inspired by this project/extension for VS Code:

src/IndentRainbow.Extension/Classification/Indent.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
using System;
21
using IndentRainbow.Extension.Drawing;
32
using IndentRainbow.Extension.Options;
43
using IndentRainbow.Logic.Classification;
@@ -36,7 +35,7 @@ public sealed class Indent
3635
private readonly IRainbowBrushGetter colorGetter;
3736

3837
/// <summary>
39-
/// Validator used for checking wether a given string is a valid indentation
38+
/// Validator used for checking whether a given string is a valid indentation
4039
/// </summary>
4140
private readonly IIndentValidator validator;
4241

@@ -53,13 +52,9 @@ public sealed class Indent
5352
#pragma warning disable VSTHRD010
5453
public Indent(IWpfTextView view, ITextDocumentFactoryService textDocumentFactory)
5554
{
56-
if (view == null)
55+
if (view == null || textDocumentFactory == null)
5756
{
58-
throw new ArgumentNullException(nameof(view));
59-
}
60-
if (textDocumentFactory == null)
61-
{
62-
throw new ArgumentNullException(nameof(textDocumentFactory));
57+
return;
6358
}
6459
layer = view.GetAdornmentLayer("Indent");
6560

src/IndentRainbow.Extension/IndentRainbow.Extension.csproj

Lines changed: 16 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
<PropertyGroup>
2121
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
2222
</PropertyGroup>
23+
<PropertyGroup>
24+
<ApplicationIcon>Resources\IndentRainbowPackage.ico</ApplicationIcon>
25+
</PropertyGroup>
2326
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
2427
<PropertyGroup>
2528
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -83,37 +86,21 @@
8386
</None>
8487
</ItemGroup>
8588
<ItemGroup>
86-
<Reference Include="EnvDTE, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
87-
<EmbedInteropTypes>False</EmbedInteropTypes>
88-
</Reference>
89-
<Reference Include="EnvDTE100, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
90-
<EmbedInteropTypes>False</EmbedInteropTypes>
91-
</Reference>
92-
<Reference Include="EnvDTE80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
93-
<EmbedInteropTypes>False</EmbedInteropTypes>
94-
</Reference>
95-
<Reference Include="EnvDTE90, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
96-
<EmbedInteropTypes>False</EmbedInteropTypes>
97-
</Reference>
98-
<Reference Include="Microsoft.Build.Framework" />
9989
<Reference Include="Microsoft.CSharp" />
100-
<Reference Include="Microsoft.VisualStudio.CommandBars, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
101-
<EmbedInteropTypes>False</EmbedInteropTypes>
90+
<Reference Include="Microsoft.VisualStudio.CoreUtility, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
91+
<Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
92+
<Reference Include="Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
93+
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
94+
<Reference Include="Microsoft.VisualStudio.Shell.Interop.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
95+
<EmbedInteropTypes>True</EmbedInteropTypes>
10296
</Reference>
97+
<Reference Include="Microsoft.VisualStudio.Text.Data, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
98+
<Reference Include="Microsoft.VisualStudio.Text.UI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
99+
<Reference Include="Microsoft.VisualStudio.Text.UI.Wpf, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
103100
<Reference Include="PresentationCore" />
104101
<Reference Include="PresentationFramework" />
105-
<Reference Include="stdole, Version=7.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
106-
<EmbedInteropTypes>False</EmbedInteropTypes>
107-
</Reference>
108102
<Reference Include="System" />
109103
<Reference Include="System.ComponentModel.Composition" />
110-
<Reference Include="System.Data" />
111-
<Reference Include="System.Data.DataSetExtensions" />
112-
<Reference Include="System.Design" />
113-
<Reference Include="System.Drawing" />
114-
<Reference Include="System.Windows.Forms" />
115-
<Reference Include="System.Xaml" />
116-
<Reference Include="System.Xml" />
117104
<Reference Include="WindowsBase" />
118105
</ItemGroup>
119106
<ItemGroup>
@@ -123,34 +110,17 @@
123110
</ProjectReference>
124111
</ItemGroup>
125112
<ItemGroup>
126-
<Content Include="Resources\IndentRainbowPackage.ico" />
113+
<Content Include="Resources\IndentRainbowPackage.ico">
114+
<IncludeInVSIX>true</IncludeInVSIX>
115+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
116+
</Content>
127117
</ItemGroup>
128118
<ItemGroup>
129119
<EmbeddedResource Include="VSPackage.resx">
130120
<MergeWithCTO>true</MergeWithCTO>
131121
<ManifestResourceName>VSPackage</ManifestResourceName>
132122
</EmbeddedResource>
133123
</ItemGroup>
134-
<ItemGroup>
135-
<PackageReference Include="Microsoft.VisualStudio.OLE.Interop">
136-
<Version>16.7.30328.74</Version>
137-
</PackageReference>
138-
<PackageReference Include="Microsoft.VisualStudio.Shell.15.0">
139-
<Version>16.7.30329.88</Version>
140-
</PackageReference>
141-
<PackageReference Include="Microsoft.VisualStudio.Text.UI.Wpf">
142-
<Version>16.6.255</Version>
143-
</PackageReference>
144-
<PackageReference Include="Microsoft.VisualStudio.Threading">
145-
<Version>16.7.56</Version>
146-
</PackageReference>
147-
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers">
148-
<Version>16.7.56</Version>
149-
</PackageReference>
150-
<PackageReference Include="Microsoft.VisualStudio.Utilities.Internal">
151-
<Version>16.3.23</Version>
152-
</PackageReference>
153-
</ItemGroup>
154124
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
155125
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
156126
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

src/IndentRainbow.Extension/Options/OptionsManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private static WritableSettingsStore GetWritableSettingsStore()
5656
public static OptionsField<HighlightingMode> highlightingMode = new OptionsField<HighlightingMode>(DefaultRainbowIndentOptions.defaultHighlightingMode);
5757

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

@@ -108,7 +108,7 @@ public static void LoadSettings()
108108
/// <summary>
109109
/// Saves the settings to the settings store
110110
/// </summary>
111-
/// <param name="indentSize">The indent size specifiyng the number of spaces for indentation detection</param>
111+
/// <param name="indentSize">The indent size specifying the number of spaces for indentation detection</param>
112112
/// <param name="colors">The colors as string</param>
113113
public static void SaveSettings(int indentSize, string fileExtensionsString, string colors, double opacityMultiplier, HighlightingMode highlightingmode, string errorColor, bool detectError)
114114
{

src/IndentRainbow.Extension/Options/WritableSettingsStoreExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static void SaveDetectErrorsFlag(this WritableSettingsStore store, bool d
8080
/// Saves the error color
8181
/// </summary>
8282
/// <param name="store">The writable settings store</param>
83-
/// <param name="errorColor">The erro color to save</param>
83+
/// <param name="errorColor">The error color to save</param>
8484
public static void SaveErrorColor(this WritableSettingsStore store, string errorColor)
8585
{
8686
store?.SetString(CollectionName, errorColorPropertyName, errorColor);

src/IndentRainbow.Extension/source.extension.vsixmanifest

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<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">
33
<Metadata>
4-
<Identity Id="IndentRainbow.f05146ed-8025-4668-b7b1-8a74bd22b241" Version="1.0.0" Language="en-US" Publisher="Marcel Wagner" />
4+
<Identity Id="IndentRainbow.f05146ed-8025-4668-b7b1-8a74bd22b241" Version="1.0.1" Language="en-US" Publisher="Marcel Wagner" />
55
<DisplayName>IndentRainbow</DisplayName>
66
<Description xml:space="preserve">Extensions for showing rainbow colors to make it easier to differentiate indent levels.</Description>
7+
<Icon>Resources\IndentRainbowPackage.ico</Icon>
78
</Metadata>
89
<Installation>
910
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[14.0, 20.0)" />

src/IndentRainbow.Logic/Classification/LineDecoratorBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ public LineDecoratorBase(IBackgroundTextIndexDrawer drawer, IRainbowBrushGetter
2424
public abstract void DecorateLine(string text, int startIndex, int endIndex);
2525

2626
/// <summary>
27-
/// Calculates the lenght of the indentation block.
27+
/// Calculates the length of the indentation block.
2828
/// Returns the value positive if indentation is valid, otherwise returns the value as negative number
2929
/// For example the text " text" (4 spaces) would return 4 for indent length 4,
3030
/// but the text " text" (5 spaces) returns -5 for indent length 4.
3131
/// </summary>
3232
/// <remarks>
33-
/// For perfomance reasons, instead of returning a Tuple containing a boolean and an integer,
33+
/// For performance reasons, instead of returning a Tuple containing a boolean and an integer,
3434
/// the method returns just one integer.
3535
/// </remarks>
3636
/// <param name="text">Text containing the line to be analyzed</param>

src/IndentRainbow.Logic/Colors/IRainbowBrushGetter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public interface IRainbowBrushGetter
77

88
/// <summary>
99
/// Returns the color specified by the index.
10-
/// Indeces larger than the list of colors, should be treated at wrapping around to the start
10+
/// Indices larger than the list of colors, should be treated at wrapping around to the start
1111
/// </summary>
1212
/// <param name="rainbowIndex">The index of the color (starting at 0)</param>
1313
/// <returns>The Brush that sits at the index specified</returns>

tests/IndentRainbow.Logic.Tests/Parser/LanguageParserTests.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ namespace IndentRainbow.Logic.Tests.Parser
66
[TestFixture]
77
public class LanguageParserTests
88
{
9-
10-
119
[Test]
1210
[TestCase("cs:4;js,jsx:5;", "cs:4,js:5,jsx:5")]
1311
[TestCase("cs,js,jsx:5;css:4;html:2", "cs:5,js:5,jsx:5,css:4,html:2")]

0 commit comments

Comments
 (0)