Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colours, My flavour of G-Code, Visual Studio Community 2022 #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gcode15/Gcode15/Gcode15.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<StartAction>Program</StartAction>
<StartProgram>C:\Program Files %28x86%29\Microsoft Visual Studio 14.0\Common7\IDE\devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp</StartArguments>
<DeployTargetInstanceId />
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<StartAction>Program</StartAction>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.5.2", FrameworkDisplayName = ".NET Framework 4.5.2")]
Empty file.
9 changes: 3 additions & 6 deletions GcodeClassifier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ namespace GcodeLanguage
{
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
/// <summary>
/// Classifier that classifies all text as an instance of the "GcodeClassifier" classification type.
/// </summary>
/// Classifier that classifies all text as an instance of the "GcodeClassifier" classification type.
/// </summary>
// internal class GcodeClassifier : IClassifier
// {
// /// <summary>
Expand Down Expand Up @@ -124,7 +121,7 @@ internal GcodeClassifier(ITextBuffer buffer,
_GcodeTypes[GcodeTokenTypes.Gcode_9] = typeService.GetClassificationType("Gcode_9");

_GcodeTypes[GcodeTokenTypes.Gcode_Comment] = typeService.GetClassificationType("Gcode_Comment");

_GcodeTypes[GcodeTokenTypes.Gcode_ocode] = typeService.GetClassificationType("Gcode_ocode");

// if typeService.GetClassificationType returns Null, check GcodeClassifierClassificationDefinition
Expand Down
6 changes: 3 additions & 3 deletions GcodeClassifierClassificationDefinition.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
using System.ComponentModel.Composition;

namespace GcodeLanguage
{
Expand All @@ -22,7 +22,7 @@ internal static class GcodeClassifierClassificationDefinition
#pragma warning restore 169

/// <summary>
/// Defines the Gcode_A classification type.
/// Defines the Gcode_Undefined classification type.
/// </summary>
[Export(typeof(ClassificationTypeDefinition))]
[Name("Gcode_Undefined")]
Expand Down
43 changes: 26 additions & 17 deletions GcodeClassifierFormat.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.ComponentModel.Composition;
using System.Windows.Media;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
using System.ComponentModel.Composition;
using System.Windows.Media;

namespace GcodeLanguage
{
Expand Down Expand Up @@ -174,7 +174,8 @@ internal sealed class Gcode_F : ClassificationFormatDefinition
public Gcode_F()
{
DisplayName = "Gcode - F"; //human readable version of the name (in Tools>Options>Environment>Fonts and Colors>Text Editor
ForegroundColor = Colors.BlueViolet;
//ForegroundColor = Colors.DarkGoldenrod;
ForegroundColor = Color.FromRgb(192, 64, 128);
}
}
#endregion
Expand All @@ -199,7 +200,9 @@ internal sealed class Gcode_G : ClassificationFormatDefinition
public Gcode_G()
{
DisplayName = "Gcode - G"; //human readable version of the name (in Tools>Options>Environment>Fonts and Colors>Text Editor
ForegroundColor = Colors.Coral;
//ForegroundColor = Colors.Blue;
ForegroundColor = Color.FromRgb(0, 0, 255);

}
}
#endregion
Expand Down Expand Up @@ -249,7 +252,8 @@ internal sealed class Gcode_I : ClassificationFormatDefinition
public Gcode_I()
{
DisplayName = "Gcode - I"; //human readable version of the name (in Tools>Options>Environment>Fonts and Colors>Text Editor
ForegroundColor = Colors.BlueViolet;
//ForegroundColor = Colors.Chocolate;
ForegroundColor = Color.FromRgb(192, 0, 0);
}
}
#endregion
Expand All @@ -274,7 +278,8 @@ internal sealed class Gcode_J : ClassificationFormatDefinition
public Gcode_J()
{
DisplayName = "Gcode - J"; //human readable version of the name (in Tools>Options>Environment>Fonts and Colors>Text Editor
ForegroundColor = Colors.BlueViolet;
//ForegroundColor = Colors.RosyBrown;
ForegroundColor = Color.FromRgb(192, 0, 128);
}
}
#endregion
Expand All @@ -299,7 +304,8 @@ internal sealed class Gcode_K : ClassificationFormatDefinition
public Gcode_K()
{
DisplayName = "Gcode - K"; //human readable version of the name (in Tools>Options>Environment>Fonts and Colors>Text Editor
ForegroundColor = Colors.BlueViolet;
//ForegroundColor = Colors.CornflowerBlue;
ForegroundColor = Color.FromRgb(192, 128, 0);
}
}
#endregion
Expand Down Expand Up @@ -349,7 +355,8 @@ internal sealed class Gcode_M : ClassificationFormatDefinition
public Gcode_M()
{
DisplayName = "Gcode - M"; //human readable version of the name (in Tools>Options>Environment>Fonts and Colors>Text Editor
ForegroundColor = Colors.Coral;
//ForegroundColor = Colors.DarkBlue;
ForegroundColor = Color.FromRgb(0, 64, 255);
}
}
#endregion
Expand Down Expand Up @@ -474,7 +481,8 @@ internal sealed class Gcode_R : ClassificationFormatDefinition
public Gcode_R()
{
DisplayName = "Gcode - R"; //human readable version of the name (in Tools>Options>Environment>Fonts and Colors>Text Editor
ForegroundColor = Colors.BlueViolet;
//ForegroundColor = Colors.OrangeRed;
ForegroundColor = Color.FromRgb(255, 0, 0);
}
}
#endregion
Expand Down Expand Up @@ -524,7 +532,8 @@ internal sealed class Gcode_T : ClassificationFormatDefinition
public Gcode_T()
{
DisplayName = "Gcode - T"; //human readable version of the name (in Tools>Options>Environment>Fonts and Colors>Text Editor
ForegroundColor = Colors.BlueViolet;
//ForegroundColor = Colors.RoyalBlue;
ForegroundColor = Color.FromRgb(128, 64, 0);
}
}
#endregion
Expand Down Expand Up @@ -624,8 +633,8 @@ internal sealed class Gcode_X : ClassificationFormatDefinition
public Gcode_X()
{
DisplayName = "Gcode - X"; //human readable version of the name (in Tools>Options>Environment>Fonts and Colors>Text Editor
ForegroundColor = Colors.Tomato;
BackgroundColor = Colors.MidnightBlue;
//ForegroundColor = Colors.Brown;
ForegroundColor = Color.FromRgb(128, 0, 0);
}
}
#endregion
Expand All @@ -650,8 +659,8 @@ internal sealed class Gcode_Y : ClassificationFormatDefinition
public Gcode_Y()
{
DisplayName = "Gcode - Y"; //human readable version of the name (in Tools>Options>Environment>Fonts and Colors>Text Editor
ForegroundColor = Colors.LawnGreen;
BackgroundColor = Colors.MidnightBlue;
//ForegroundColor = Colors.Peru;
ForegroundColor = Color.FromRgb(128, 0, 128);
}
}
#endregion
Expand All @@ -676,8 +685,8 @@ internal sealed class Gcode_Z : ClassificationFormatDefinition
public Gcode_Z()
{
DisplayName = "Gcode - Z"; //human readable version of the name (in Tools>Options>Environment>Fonts and Colors>Text Editor
ForegroundColor = Colors.Cyan;
BackgroundColor = Colors.MidnightBlue;
//ForegroundColor = Colors.DarkCyan;
ForegroundColor = Color.FromRgb(255, 128, 0);
}
}
#endregion
Expand Down
10 changes: 7 additions & 3 deletions GcodeClassifierProvider.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@

namespace GcodeLanguage
{
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
using Microsoft.VisualStudio.Text.Tagging;
using Microsoft.VisualStudio.Utilities;
// /// <summary>
Expand Down Expand Up @@ -82,6 +79,13 @@ internal sealed class GcodeClassifierProvider : ITaggerProvider
[BaseDefinition("projection")]
internal static FileExtensionToContentTypeDefinition GcodeFileTypeNC = null;

[Export]
[FileExtension(".tgc")] // semi-colon delimited file extensions work only in VS2017/2019 - so we create multiple FileExtensionToContentTypeDefinition
[ContentType("Gcode")]
[BaseDefinition("code")]
[BaseDefinition("projection")]
internal static FileExtensionToContentTypeDefinition GcodeFileTypeTGC = null;

[Import]
internal IClassificationTypeRegistryService ClassificationTypeRegistry = null;

Expand Down
44 changes: 23 additions & 21 deletions GcodeLanguageExtension.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<Compile Include="GcodeClassifier.cs" />
Expand All @@ -78,6 +79,7 @@
<None Include="CODE_OF_CONDUCT.md" />
<Content Include="Gcode-syntax-highlighting-icon.jpg">
<IncludeInVSIX>true</IncludeInVSIX>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="LICENSE.md">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand All @@ -95,87 +97,87 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.CoreUtility, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.CoreUtility.14.3.25407\lib\net45\Microsoft.VisualStudio.CoreUtility.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Editor, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Editor.14.3.25407\lib\net45\Microsoft.VisualStudio.Editor.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Imaging, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Imaging.14.3.25407\lib\net45\Microsoft.VisualStudio.Imaging.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Language.Intellisense, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Language.Intellisense.14.3.25407\lib\net45\Microsoft.VisualStudio.Language.Intellisense.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.OLE.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>packages\Microsoft.VisualStudio.OLE.Interop.7.10.6070\lib\Microsoft.VisualStudio.OLE.Interop.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Shell.14.0.14.3.25407\lib\Microsoft.VisualStudio.Shell.14.0.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.10.0, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Shell.Immutable.10.0.10.0.30319\lib\net40\Microsoft.VisualStudio.Shell.Immutable.10.0.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.11.0, Version=11.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Shell.Immutable.11.0.11.0.50727\lib\net45\Microsoft.VisualStudio.Shell.Immutable.11.0.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Shell.Immutable.12.0.12.0.21003\lib\net45\Microsoft.VisualStudio.Shell.Immutable.12.0.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Immutable.14.0, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Shell.Immutable.14.0.14.3.25407\lib\net45\Microsoft.VisualStudio.Shell.Immutable.14.0.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>packages\Microsoft.VisualStudio.Shell.Interop.7.10.6071\lib\Microsoft.VisualStudio.Shell.Interop.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>packages\Microsoft.VisualStudio.Shell.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.Shell.Interop.8.0.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Shell.Interop.9.0, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>packages\Microsoft.VisualStudio.Shell.Interop.9.0.9.0.30729\lib\Microsoft.VisualStudio.Shell.Interop.9.0.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Text.Data, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Text.Data.14.3.25407\lib\net45\Microsoft.VisualStudio.Text.Data.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Text.Logic, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Text.Logic.14.3.25407\lib\net45\Microsoft.VisualStudio.Text.Logic.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Text.UI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Text.UI.14.3.25407\lib\net45\Microsoft.VisualStudio.Text.UI.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Text.UI.Wpf, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Text.UI.Wpf.14.3.25407\lib\net45\Microsoft.VisualStudio.Text.UI.Wpf.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TextManager.Interop, Version=7.1.40304.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>packages\Microsoft.VisualStudio.TextManager.Interop.7.10.6070\lib\Microsoft.VisualStudio.TextManager.Interop.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.TextManager.Interop.8.0, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>packages\Microsoft.VisualStudio.TextManager.Interop.8.0.8.0.50727\lib\Microsoft.VisualStudio.TextManager.Interop.8.0.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Threading, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Threading.14.1.111\lib\net45\Microsoft.VisualStudio.Threading.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Validation, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>packages\Microsoft.VisualStudio.Validation.14.1.111\lib\net45\Microsoft.VisualStudio.Validation.dll</HintPath>
<Private>True</Private>
<Private>False</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
Expand Down
Binary file modified images/GcodeLanguageExtension.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading