Skip to content

Commit

Permalink
Merge branch 'release/1.3.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
arBmind committed Dec 6, 2018
2 parents 9c36911 + 5c11f2f commit a6434cc
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 172 deletions.
1 change: 1 addition & 0 deletions SemanticColorizer.sln
Expand Up @@ -8,6 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
Global.props = Global.props
readme.md = readme.md
TestFile.cs = TestFile.cs
EndProjectSection
EndProject
Global
Expand Down
24 changes: 0 additions & 24 deletions SemanticColorizer/ClassificationDefinitions.cs
Expand Up @@ -35,10 +35,6 @@ internal static class ClassificationTypes
[Name(Constants.ConstructorFormat)]
internal static ClassificationTypeDefinition ConstructorType;

[Export(typeof(ClassificationTypeDefinition))]
[Name(Constants.TypeParameterFormat)]
internal static ClassificationTypeDefinition TypeParameterType;

[Export(typeof(ClassificationTypeDefinition))]
[Name(Constants.ParameterFormat)]
internal static ClassificationTypeDefinition ParameterType;
Expand All @@ -59,29 +55,9 @@ internal static class ClassificationTypes
[Name(Constants.TypeSpecialFormat)]
internal static ClassificationTypeDefinition TypeSpecialType;

[Export(typeof(ClassificationTypeDefinition))]
[Name(Constants.ClassFormat)]
internal static ClassificationTypeDefinition ClassType;

[Export(typeof(ClassificationTypeDefinition))]
[Name(Constants.InterfaceFormat)]
internal static ClassificationTypeDefinition InterfaceType;

[Export(typeof(ClassificationTypeDefinition))]
[Name(Constants.EnumFormat)]
internal static ClassificationTypeDefinition EnumType;

[Export(typeof(ClassificationTypeDefinition))]
[Name(Constants.StructFormat)]
internal static ClassificationTypeDefinition StructType;

[Export(typeof(ClassificationTypeDefinition))]
[Name(Constants.EventFormat)]
internal static ClassificationTypeDefinition EventType;

[Export(typeof(ClassificationTypeDefinition))]
[Name(Constants.DelegateFormat)]
internal static ClassificationTypeDefinition DelegateType;
#pragma warning restore CS0649
}
}
6 changes: 0 additions & 6 deletions SemanticColorizer/Constants.cs
Expand Up @@ -11,17 +11,11 @@ public static class Constants
public const String NormalMethodFormat = "s.semantic-colorizer.normal-method";
public const String LocalFunctionFormat = "s.semantic-colorizer.local-function";
public const String ConstructorFormat = "s.semantic-colorizer.constructor";
public const String TypeParameterFormat = "s.semantic-colorizer.type-parameter";
public const String ParameterFormat = "s.semantic-colorizer.parameter";
public const String NamespaceFormat = "s.semantic-colorizer.namespace";
public const String PropertyFormat = "s.semantic-colorizer.property";
public const String LocalFormat = "s.semantic-colorizer.local";
public const String TypeSpecialFormat = "s.semantic-colorizer.type-special";
public const String ClassFormat = "s.semantic-colorizer.class";
public const String StructFormat = "s.semantic-colorizer.struct";
public const String EnumFormat = "s.semantic-colorizer.enum";
public const String InterfaceFormat = "s.semantic-colorizer.interface";
public const String DelegateFormat = "s.semantic-colorizer.delegate";
public const String EventFormat = "s.semantic-colorizer.event";
}
}
79 changes: 0 additions & 79 deletions SemanticColorizer/EditorFormats.cs
Expand Up @@ -98,20 +98,6 @@ public SemanticConstructorFormat()
}
}

[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = Constants.TypeParameterFormat)]
[Name(Constants.TypeParameterFormat)]
[UserVisible(true)]
[Order(After = ClassificationTypeNames.Identifier)]
internal sealed class SemanticTypeParameterFormat : ClassificationFormatDefinition
{
public SemanticTypeParameterFormat()
{
DisplayName = "Semantic Type Parameter";
ForegroundColor = Colors.SlateGray;
}
}

[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = Constants.ParameterFormat)]
[Name(Constants.ParameterFormat)]
Expand Down Expand Up @@ -179,32 +165,6 @@ public SemanticTypeSpecialFormat()
}
}

[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = Constants.ClassFormat)]
[Name(Constants.ClassFormat)]
[UserVisible(true)]
[Order(After = ClassificationTypeNames.Identifier)]
internal sealed class SemanticClassFormat : ClassificationFormatDefinition
{
public SemanticClassFormat()
{
DisplayName = "Semantic Class";
}
}

[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = Constants.InterfaceFormat)]
[Name(Constants.InterfaceFormat)]
[UserVisible(true)]
[Order(After = ClassificationTypeNames.Identifier)]
internal sealed class SemanticInterfaceFormat : ClassificationFormatDefinition
{
public SemanticInterfaceFormat()
{
DisplayName = "Semantic Interface";
}
}

[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = Constants.EventFormat)]
[Name(Constants.EventFormat)]
Expand All @@ -217,43 +177,4 @@ public SemanticEventFormat()
DisplayName = "Semantic Event";
}
}

[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = Constants.StructFormat)]
[Name(Constants.StructFormat)]
[UserVisible(true)]
[Order(After = ClassificationTypeNames.Identifier)]
internal sealed class SemanticStructFormat : ClassificationFormatDefinition
{
public SemanticStructFormat()
{
DisplayName = "Semantic Struct";
}
}

[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = Constants.EnumFormat)]
[Name(Constants.EnumFormat)]
[UserVisible(true)]
[Order(After = ClassificationTypeNames.Identifier)]
internal sealed class SemanticEnumFormat : ClassificationFormatDefinition
{
public SemanticEnumFormat()
{
DisplayName = "Semantic Enum";
}
}

[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = Constants.DelegateFormat)]
[Name(Constants.DelegateFormat)]
[UserVisible(true)]
[Order(After = ClassificationTypeNames.Identifier)]
internal sealed class SemanticDelegateFormat : ClassificationFormatDefinition
{
public SemanticDelegateFormat()
{
DisplayName = "Semantic Delegate";
}
}
}
27 changes: 16 additions & 11 deletions SemanticColorizer/Extensions.cs
Expand Up @@ -4,16 +4,21 @@
using Microsoft.VisualStudio.Text.Tagging;
using System;

namespace SemanticColorizer {
public static class Extensions {
public static ITagSpan<IClassificationTag> ToTagSpan(this TextSpan span, ITextSnapshot snapshot, IClassificationType classificationType) {
return new TagSpan<IClassificationTag>(
new SnapshotSpan(snapshot, span.Start, span.Length),
new ClassificationTag(classificationType)
);
namespace SemanticColorizer
{
public static class Extensions
{
public static ITagSpan<IClassificationTag> ToTagSpan(this TextSpan span, ITextSnapshot snapshot, IClassificationType classificationType)
{
return new TagSpan<IClassificationTag>(
new SnapshotSpan(snapshot, span.Start, span.Length),
new ClassificationTag(classificationType)
);
}
public static String GetText(this ITextSnapshot snapshot, TextSpan span)
{
return snapshot.GetText(new Span(span.Start, span.Length));
}
}
public static String GetText(this ITextSnapshot snapshot, TextSpan span) {
return snapshot.GetText(new Span(span.Start, span.Length));
}
}
}

2 changes: 1 addition & 1 deletion SemanticColorizer/Properties/AssemblyInfo.cs
Expand Up @@ -28,5 +28,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.3.2.*")]
[assembly: AssemblyVersion("1.3.3.*")]
[assembly: AssemblyFileVersion("1.0.0.0")]
42 changes: 0 additions & 42 deletions SemanticColorizer/SemanticColorizer.cs
Expand Up @@ -44,18 +44,12 @@ class SemanticColorizer : ITagger<IClassificationTag>
private readonly IClassificationType _normalMethodType;
private readonly IClassificationType _localFunctionType;
private readonly IClassificationType _constructorType;
private readonly IClassificationType _typeParameterType;
private readonly IClassificationType _parameterType;
private readonly IClassificationType _namespaceType;
private readonly IClassificationType _propertyType;
private readonly IClassificationType _localType;
private readonly IClassificationType _typeSpecialType;
private readonly IClassificationType _eventType;
private readonly IClassificationType _classType;
private readonly IClassificationType _structType;
private readonly IClassificationType _delegateType;
private readonly IClassificationType _interfaceType;
private readonly IClassificationType _enumType;
private Cache _cache;
#pragma warning disable CS0067
public event EventHandler<SnapshotSpanEventArgs> TagsChanged;
Expand All @@ -79,21 +73,15 @@ static SemanticColorizer()
{
SupportedClassificationTypeNames = new HashSet<string>
{
ClassificationTypeNames.ClassName,
ClassificationTypeNames.StructName,
NewClassificationTypeNames.FieldName,
NewClassificationTypeNames.PropertyName,
ClassificationTypeNames.InterfaceName,
ClassificationTypeNames.DelegateName,
ClassificationTypeNames.EnumName,
NewClassificationTypeNames.EnumMemberName,
ClassificationTypeNames.Identifier,
NewClassificationTypeNames.EventName,
NewClassificationTypeNames.LocalName,
NewClassificationTypeNames.ParameterName,
NewClassificationTypeNames.ExtensionMethodName,
NewClassificationTypeNames.ConstantName,
ClassificationTypeNames.TypeParameterName,
NewClassificationTypeNames.MethodName
};
}
Expand All @@ -108,18 +96,12 @@ internal SemanticColorizer(ITextBuffer buffer, IClassificationTypeRegistryServic
_normalMethodType = registry.GetClassificationType(Constants.NormalMethodFormat);
_localFunctionType = registry.GetClassificationType(Constants.LocalFunctionFormat);
_constructorType = registry.GetClassificationType(Constants.ConstructorFormat);
_typeParameterType = registry.GetClassificationType(Constants.TypeParameterFormat);
_parameterType = registry.GetClassificationType(Constants.ParameterFormat);
_namespaceType = registry.GetClassificationType(Constants.NamespaceFormat);
_propertyType = registry.GetClassificationType(Constants.PropertyFormat);
_localType = registry.GetClassificationType(Constants.LocalFormat);
_typeSpecialType = registry.GetClassificationType(Constants.TypeSpecialFormat);
_eventType = registry.GetClassificationType(Constants.EventFormat);
_classType = registry.GetClassificationType(Constants.ClassFormat);
_structType = registry.GetClassificationType(Constants.StructFormat);
_delegateType = registry.GetClassificationType(Constants.DelegateFormat);
_interfaceType = registry.GetClassificationType(Constants.InterfaceFormat);
_enumType = registry.GetClassificationType(Constants.EnumFormat);
}

public IEnumerable<ITagSpan<IClassificationTag>> GetTags(NormalizedSnapshotSpanCollection spans)
Expand Down Expand Up @@ -226,9 +208,6 @@ public IEnumerable<ITagSpan<IClassificationTag>> GetTags(NormalizedSnapshotSpanC
break;
}
break;
case SymbolKind.TypeParameter:
yield return span.TextSpan.ToTagSpan(snapshot, _typeParameterType);
break;
case SymbolKind.Parameter:
yield return span.TextSpan.ToTagSpan(snapshot, _parameterType);
break;
Expand All @@ -249,27 +228,6 @@ public IEnumerable<ITagSpan<IClassificationTag>> GetTags(NormalizedSnapshotSpanC
{
yield return span.TextSpan.ToTagSpan(snapshot, _typeSpecialType);
}
else
{
switch (span.ClassificationType)
{
case ClassificationTypeNames.StructName:
yield return span.TextSpan.ToTagSpan(snapshot, _structType);
break;
case ClassificationTypeNames.ClassName:
yield return span.TextSpan.ToTagSpan(snapshot, _classType);
break;
case ClassificationTypeNames.InterfaceName:
yield return span.TextSpan.ToTagSpan(snapshot, _interfaceType);
break;
case ClassificationTypeNames.DelegateName:
yield return span.TextSpan.ToTagSpan(snapshot, _delegateType);
break;
case ClassificationTypeNames.EnumName:
yield return span.TextSpan.ToTagSpan(snapshot, _enumType);
break;
}
}
break;
}
}
Expand Down
12 changes: 6 additions & 6 deletions SemanticColorizer/source.extension.vsixmanifest
@@ -1,7 +1,7 @@
<?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="SemanticColorizer..675719A2-3029-4ADD-8A0C-912336B31716" Version="1.3.2" Language="en-US" Publisher="HicknHack Software GmbH" />
<Identity Id="SemanticColorizer..675719A2-3029-4ADD-8A0C-912336B31716" Version="1.3.3" Language="en-US" Publisher="HicknHack Software GmbH" />
<DisplayName>SemanticColorizer</DisplayName>
<Description xml:space="preserve">A semantic syntax classifier extension based on Roslyn for C# and Visual Basic.</Description>
<MoreInfo>https://github.com/hicknhack-software/semantic-colorizer</MoreInfo>
Expand All @@ -12,9 +12,9 @@
<Tags>Semantic Syntax Highlighting Color</Tags>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[14.0,16.0)" />
<InstallationTarget Version="[14.0,16.0)" Id="Microsoft.VisualStudio.Community" />
<InstallationTarget Version="[14.0,16.0)" Id="Microsoft.VisualStudio.Enterprise" />
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[14.0,17.0)" />
<InstallationTarget Version="[14.0,17.0)" Id="Microsoft.VisualStudio.Community" />
<InstallationTarget Version="[14.0,17.0)" Id="Microsoft.VisualStudio.Enterprise" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.6,)" />
Expand All @@ -23,7 +23,7 @@
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%|" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[14.0,16.0)" DisplayName="Visual Studio core editor" />
<Prerequisite Id="Microsoft.VisualStudio.Component.Roslyn.Compiler" Version="[14.0,16.0)" DisplayName="C# and Visual Basic Roslyn compilers" />
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[14.0,)" DisplayName="Visual Studio core editor" />
<Prerequisite Id="Microsoft.VisualStudio.Component.Roslyn.Compiler" Version="[14.0,)" DisplayName="C# and Visual Basic Roslyn compilers" />
</Prerequisites>
</PackageManifest>
52 changes: 52 additions & 0 deletions TestFile.cs
@@ -0,0 +1,52 @@
using System;

namespace Test
{
internal enum Enum
{
Value,
Second = 2
}

internal struct Data
{
public int field { get; set; }
private readonly string privately;

public Data(int p)
{
field = p;
privately = "Hello";
}
}

internal static class ClassExt
{
public static int Sum(this Enum @enum, int num = 5)
{
return num + 2;
}
}
internal interface Base
{
int Run(string arg);
}

internal class Class1 : Base
{
private Data data;
Enum Runner {
get => Enum.Value;
}

public Class1() // construct
{
var x = Enum.Value;
x.Sum(3);
}

public static int NoWay() => 42;

public int Run(string arg) => throw new NotImplementedException();
}
}

0 comments on commit a6434cc

Please sign in to comment.