Skip to content

Commit

Permalink
release: v 1.0 build 6471 rev. 33461
Browse files Browse the repository at this point in the history
  • Loading branch information
Art-Stea1th committed Sep 19, 2017
1 parent 60b2f4e commit 60a7c8e
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 44 deletions.
11 changes: 10 additions & 1 deletion Extension/ASD.ESH/ASD.ESH.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,16 @@
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
<Analyzer Include="..\packages\Microsoft.CodeAnalysis.Analyzers.1.1.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Content Include="Assets\Icon.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Assets\Preview.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
Expand Down
Binary file added Extension/ASD.ESH/Assets/Icon.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 Extension/ASD.ESH/Assets/Preview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 4 additions & 6 deletions Extension/ASD.ESH/Classification/Classifier.SpansConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Classification;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
using CSSyntax = Microsoft.CodeAnalysis.CSharp.Syntax;
using VBSyntax = Microsoft.CodeAnalysis.VisualBasic.Syntax;

namespace ASD.ESH.Classification {

Expand All @@ -16,6 +15,7 @@ internal sealed class SpansConverter {

private SemanticModel model;
private SyntaxNode root;

private ITextSnapshot snapshot;

public SpansConverter(SemanticModel model, SyntaxNode root, ITextSnapshot snapshot) {
Expand Down Expand Up @@ -56,11 +56,9 @@ private ISymbol GetSymbol(TextSpan textSpan) {
private SyntaxNode GetExpression(SyntaxNode node) {

switch (node) {
case CSSyntax.ArgumentSyntax s:
return s.Expression;
case CSSyntax.AttributeArgumentSyntax s:
case ArgumentSyntax s:
return s.Expression;
case VBSyntax.SimpleArgumentSyntax s:
case AttributeArgumentSyntax s:
return s.Expression;
default:
return node;
Expand Down
2 changes: 1 addition & 1 deletion Extension/ASD.ESH/Classification/ClassifierProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace ASD.ESH.Classification {

[Export(typeof(IClassifierProvider))]
[ContentType("CSharp"), ContentType("Basic")]
[ContentType("CSharp")]
internal sealed class ClassifierProvider : IClassifierProvider {

#pragma warning disable CS0649
Expand Down
61 changes: 27 additions & 34 deletions Extension/ASD.ESH/Classification/TypesRegistry.Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,84 +10,77 @@ internal static partial class TypesRegistry {

private sealed class Definitions {

private const string priority = Priority.High;

#pragma warning disable CS0649

[Export(typeof(ClassificationTypeDefinition)), Name(pT + nameof(SymbolKind.Field))]
internal static ClassificationTypeDefinition FieldType;

[Export(typeof(ClassificationTypeDefinition)), Name(pT + nameof(SymbolKind.Method))]
internal static ClassificationTypeDefinition MethodType;

[Export(typeof(ClassificationTypeDefinition)), Name(pT + nameof(SymbolKind.Namespace))]
internal static ClassificationTypeDefinition NamespaceType;

[Export(typeof(ClassificationTypeDefinition)), Name(pT + nameof(SymbolKind.Parameter))]
internal static ClassificationTypeDefinition ParameterType;

[Export(typeof(ClassificationTypeDefinition)), Name(pT + nameof(SymbolKind.Property))]
internal static ClassificationTypeDefinition PropertyType;

[Export(typeof(ClassificationTypeDefinition)), Name(pT + nameof(SymbolKind.Local))]
internal static ClassificationTypeDefinition LocalType;

#pragma warning restore CS0649

[Export(typeof(EditorFormatDefinition)), Name(pF + nameof(SymbolKind.Field)), UserVisible(true)]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Field))]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Field)), Order(After = priority)]
private sealed class FieldFormatDefinition : FormatDefinition {
public FieldFormatDefinition()
: base($"{SymbolKind.Field}", "#9CDCFE") { }
}



[Export(typeof(ClassificationTypeDefinition)), Name(pT + nameof(SymbolKind.Method))]
internal static ClassificationTypeDefinition MethodType;

[Export(typeof(EditorFormatDefinition)), Name(pF + nameof(SymbolKind.Method)), UserVisible(true)]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Method))]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Method)), Order(After = priority)]
private sealed class MethodFormatDefinition : FormatDefinition {
public MethodFormatDefinition()
: base($"{SymbolKind.Method}", "#DCDCAA") { }
}



[Export(typeof(ClassificationTypeDefinition)), Name(pT + nameof(SymbolKind.Namespace))]
internal static ClassificationTypeDefinition NamespaceType;

[Export(typeof(EditorFormatDefinition)), Name(pF + nameof(SymbolKind.Namespace)), UserVisible(true)]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Namespace))]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Namespace)), Order(After = priority)]
private sealed class NamespaceFormatDefinition : FormatDefinition {
public NamespaceFormatDefinition()
: base($"{SymbolKind.Namespace}") { }
}



[Export(typeof(ClassificationTypeDefinition)), Name(pT + nameof(SymbolKind.Parameter))]
internal static ClassificationTypeDefinition ParameterType;

[Export(typeof(EditorFormatDefinition)), Name(pF + nameof(SymbolKind.Parameter)), UserVisible(true)]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Parameter))]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Parameter)), Order(After = priority)]
private sealed class ParameterFormatDefinition : FormatDefinition {
public ParameterFormatDefinition()
: base($"{SymbolKind.Parameter}", "#808080") { }
}



[Export(typeof(ClassificationTypeDefinition)), Name(pT + nameof(SymbolKind.Property))]
internal static ClassificationTypeDefinition PropertyType;

[Export(typeof(EditorFormatDefinition)), Name(pF + nameof(SymbolKind.Property)), UserVisible(true)]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Property))]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Property)), Order(After = priority)]
private sealed class PropertyFormatDefinition : FormatDefinition {
public PropertyFormatDefinition()
: base($"{SymbolKind.Property}", "#9CDCFE") { }
}



[Export(typeof(ClassificationTypeDefinition)), Name(pT + nameof(SymbolKind.Local))]
internal static ClassificationTypeDefinition LocalType;

[Export(typeof(EditorFormatDefinition)), Name(pF + nameof(SymbolKind.Local)), UserVisible(true)]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Local))]
[ClassificationType(ClassificationTypeNames = pT + nameof(SymbolKind.Local)), Order(After = priority)]
private sealed class LocalFormatDefinition : FormatDefinition {
public LocalFormatDefinition()
: base($"{SymbolKind.Local} Variable") { }
}

#pragma warning restore CS0649

private abstract class FormatDefinition : ClassificationFormatDefinition {

public FormatDefinition(string displayName, string defaultForegroundColor)
: this(displayName) => ForegroundColor = (Color)ColorConverter.ConvertFromString(defaultForegroundColor);
: this(displayName) => ForegroundColor = (Color)ColorConverter
.ConvertFromString(defaultForegroundColor);

public FormatDefinition(string displayName)
=> DisplayName = $"User Tags - {displayName}";
Expand Down
4 changes: 3 additions & 1 deletion Extension/ASD.ESH/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
<Metadata>
<Identity Id="40DF615B-99F6-4F5D-B5DB-9D87F4801E2E" Version="1.0" Language="en-US" Publisher="Stanislav Kuzmich [Art.Stea1th]" />
<DisplayName>Enhanced Syntax Highlighting</DisplayName>
<Description xml:space="preserve">This is an classifier extension for Visual Studio editor based on the Roslyn APIs to enhanced highlighting custom tags in C# code to make them easily recognizable.</Description>
<Description xml:space="preserve">Visual Studio editor classifier extension based on the Roslyn APIs to enhanced highlighting custom tags in C# code.</Description>
<MoreInfo>https://github.com/Art-Stea1th/Enhanced-Syntax-Highlighting</MoreInfo>
<Icon>Assets\Icon.png</Icon>
<PreviewImage>Assets\Preview.png</PreviewImage>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[15.0,16.0)" />
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Enhanced Syntax Highlighting
This is an classifier extension for Visual Studio editor based on the Roslyn APIs to enhanced highlighting custom tags in C# code to make them easily recognizable.
Visual Studio editor classifier extension based on the Roslyn APIs to enhanced highlighting custom tags in C# code.

![ESH-Preview](https://raw.githubusercontent.com/Art-Stea1th/Enhanced-Syntax-Highlighting/master/Extension/ASD.ESH/Assets/Preview.png)

0 comments on commit 60a7c8e

Please sign in to comment.