This commit is contained in:
kudzu_cp 2012-06-07 20:05:42 +00:00
parent c28076dc97
commit 97c8aae016
11 changed files with 285 additions and 3 deletions

View file

@ -41,5 +41,7 @@
Cosmos.VS.Wizards</h3>
<p>
Provides support for creating new Cosmos projects from within Visual Studio.</p>
<h3>
Cosmos.VS.XSharp</h3>
<p>
&nbsp;</p>
MEF based project that provides syntax coloring for X#.</p>

View file

@ -92,7 +92,7 @@ Project("{E24C65DC-7377-472B-9ABA-BC803B73C61A}") = "Docs", "..\Docs", "{67E7DEF
Release.AspNetCompiler.ForceOverwrite = "true"
Release.AspNetCompiler.FixedNames = "false"
Release.AspNetCompiler.Debug = "False"
VWDPort = "10155"
VWDPort = "3678"
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Debug.Consts", "..\source2\IL2CPU\Cosmos.IL2CPU.Debug\Cosmos.Debug.Consts.csproj", "{9998B4EA-385E-4DA2-8905-2BBEB5B2C6E2}"
@ -208,9 +208,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Compiler.XSharp", ".
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Compiler.XSharp.XSC", "..\source2\Compiler\Cosmos.Compiler.XSharp.XSC\Cosmos.Compiler.XSharp.XSC.csproj", "{7B8499A7-0A8D-44FC-8181-9666CC198025}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.VS.XSharp", "..\source2\VSIP\Cosmos.VS.XSharp\Cosmos.VS.XSharp.csproj", "{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}"
EndProject
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 57
SccNumberOfProjects = 58
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = https://tfs.codeplex.com/tfs/tfs04
SccLocalPath0 = .
@ -440,6 +442,10 @@ Global
SccProjectTopLevelParentUniqueName56 = Cosmos.sln
SccProjectName56 = ../source2/Users/Matthijs/MatthijsPlayground
SccLocalPath56 = ..\\source2\\Users\\Matthijs\\MatthijsPlayground
SccProjectUniqueName57 = ..\\source2\\VSIP\\Cosmos.VS.XSharp\\Cosmos.VS.XSharp.csproj
SccProjectTopLevelParentUniqueName57 = Cosmos.sln
SccProjectName57 = ../source2/VSIP/Cosmos.VS.XSharp
SccLocalPath57 = ..\\source2\\VSIP\\Cosmos.VS.XSharp
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Bootstrap|Any CPU = Bootstrap|Any CPU
@ -1314,6 +1320,21 @@ Global
{7B8499A7-0A8D-44FC-8181-9666CC198025}.Release|Mixed Platforms.Build.0 = Release|x86
{7B8499A7-0A8D-44FC-8181-9666CC198025}.Release|x86.ActiveCfg = Release|x86
{7B8499A7-0A8D-44FC-8181-9666CC198025}.Release|x86.Build.0 = Release|x86
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Bootstrap|Any CPU.ActiveCfg = Release|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Bootstrap|Any CPU.Build.0 = Release|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Bootstrap|Mixed Platforms.ActiveCfg = Release|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Bootstrap|Mixed Platforms.Build.0 = Release|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Bootstrap|x86.ActiveCfg = Release|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Debug|x86.ActiveCfg = Debug|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Release|Any CPU.Build.0 = Release|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1360,6 +1381,7 @@ Global
{2259402E-3EAB-448D-9CC6-E5C1C2C716A5} = {CD3F5E45-8B24-424F-ADF1-0211712F4CB7}
{47E8F3DC-FF3F-4CC7-8643-1807260B0B18} = {CD3F5E45-8B24-424F-ADF1-0211712F4CB7}
{EA63FDF9-057F-4E67-9060-74F4E7A09AE0} = {CD3F5E45-8B24-424F-ADF1-0211712F4CB7}
{49125A4E-F2DD-48C8-B19F-D9D4217FA34B} = {CD3F5E45-8B24-424F-ADF1-0211712F4CB7}
{63F7BFB9-419E-4965-B580-304B9C9FA7D8} = {6A15C540-8278-4B9C-B890-FA57FB6AE6A6}
{52BF0A64-EBEF-420A-9F27-6C5226A4B77B} = {6A15C540-8278-4B9C-B890-FA57FB6AE6A6}
{C801F19C-A9D3-42D5-9A57-9FFDF9B4D05E} = {6A15C540-8278-4B9C-B890-FA57FB6AE6A6}

View file

@ -31,6 +31,10 @@
<li>Syntax highlighting<ul>
<li><a href="http://dotneteers.net/blogs/divedeeper/archive/2008/11/04/LearnVSXNowPart38.aspx">
http://dotneteers.net/blogs/divedeeper/archive/2008/11/04/LearnVSXNowPart38.aspx</a></li>
<li><a href="http://joseoncode.com/2010/10/13/extending-vs2010-editor-with-iclassifier/">
http://joseoncode.com/2010/10/13/extending-vs2010-editor-with-iclassifier/</a></li>
<li><a href="http://buildstarted.com/2010/09/09/managed-extensibility-framework-and-visual-studio-2010-editor-classifiers/">
http://buildstarted.com/2010/09/09/managed-extensibility-framework-and-visual-studio-2010-editor-classifiers/</a></li>
</ul>
</li>
</ul>

View file

@ -0,0 +1,52 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Windows.Media;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
namespace Cosmos.VS.XSharp {
/// This class causes a classifier to be added to the set of classifiers. Since
/// the content type is set to "text", this classifier applies to all text files
[Export(typeof(IClassifierProvider))]
[ContentType("XSharp")]
internal class XSharpProvider : IClassifierProvider {
/// Import the classification registry to be used for getting a reference
/// to the custom classification type later.
[Import]
internal IClassificationTypeRegistryService ClassificationRegistry = null; // Set via MEF
public IClassifier GetClassifier(ITextBuffer buffer) {
return buffer.Properties.GetOrCreateSingletonProperty<XSharp>(delegate { return new XSharp(ClassificationRegistry); });
}
}
/// Classifier that classifies all text as an instance of the OrinaryClassifierType
class XSharp : IClassifier {
IClassificationType _classificationType;
internal XSharp(IClassificationTypeRegistryService registry) {
_classificationType = registry.GetClassificationType("XSharp");
}
/// This method scans the given SnapshotSpan for potential matches for this classification.
/// In this instance, it classifies everything and returns each span as a new ClassificationSpan.
/// <param name="trackingSpan">The span currently being classified</param>
/// <returns>A list of ClassificationSpans that represent spans identified to be of this classification</returns>
public IList<ClassificationSpan> GetClassificationSpans(SnapshotSpan span) {
//create a list to hold the results
var classifications = new List<ClassificationSpan>();
classifications.Add(new ClassificationSpan(new SnapshotSpan(span.Snapshot, new Span(span.Start, span.Length)),
_classificationType));
return classifications;
}
#pragma warning disable 67
// This event gets raised if a non-text change would affect the classification in some way,
// for example typing /* would cause the classification to change in C# without directly
// affecting the span.
public event EventHandler<ClassificationChangedEventArgs> ClassificationChanged;
#pragma warning restore 67
}
}

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20305</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<ProjectGuid>{49125A4E-F2DD-48C8-B19F-D9D4217FA34B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Cosmos.VS.XSharp</RootNamespace>
<AssemblyName>Cosmos.VS.XSharp</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<GeneratePkgDefFile>false</GeneratePkgDefFile>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualStudio.CoreUtility">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Text.Data">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Text.Logic">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Text.UI">
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualStudio.Text.UI.Wpf">
<Private>False</Private>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xaml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Cosmos.VS.XSharpFormat.cs" />
<Compile Include="Cosmos.VS.XSharpType.cs" />
<Compile Include="Cosmos.VS.XSharp.cs" />
<Compile Include="FileAndContentTypes.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v10.0\VSSDK\Microsoft.VsSDK.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View file

@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View file

@ -0,0 +1,22 @@
using System.ComponentModel.Composition;
using System.Windows.Media;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
namespace Cosmos.VS.XSharp {
/// Defines an editor format for the XSharp type that has a purple background
/// and is underlined.
[Export(typeof(EditorFormatDefinition))]
[ClassificationType(ClassificationTypeNames = "XSharp")]
[Name("XSharp")]
[UserVisible(true)]
[Order(Before = Priority.Default)] //set the priority to be after the default classifiers
internal sealed class XSharpFormat : ClassificationFormatDefinition {
/// Defines the visual format for the "Cosmos.VS.XSharp" classification type
public XSharpFormat() {
this.DisplayName = "XSharp"; //human readable version of the name
this.BackgroundColor = Colors.BlueViolet;
this.TextDecorations = System.Windows.TextDecorations.Underline;
}
}
}

View file

@ -0,0 +1,12 @@
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
namespace Cosmos.VS.XSharp {
internal static class XSharpClassificationDefinition {
/// Defines the "XSharp" classification type.
[Export(typeof(ClassificationTypeDefinition))]
[Name("XSharp")]
internal static ClassificationTypeDefinition XSharpType = null;
}
}

View file

@ -0,0 +1,17 @@
using System.ComponentModel.Composition;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Utilities;
namespace Cosmos.VS.XSharp {
internal static class FileAndContentTypeDefinitions {
[Export]
[Name("XSharp")]
[BaseDefinition("text")]
internal static ContentTypeDefinition XSharpContentTypeDefinition;
[Export]
[FileExtension(".xs")]
[ContentType("XSharp")]
internal static FileExtensionToContentTypeDefinition XSharpFileExtensionDefinition;
}
}

View file

@ -0,0 +1,33 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Cosmos.VS.XSharp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Cosmos.VS.XSharp")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// 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.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View file

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Vsix xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2010">
<Identifier Id="Cosmos.VS.XSharp..9b039a95-3169-4491-b85d-99d2639cdc05">
<Name>Cosmos.VS.XSharp</Name>
<Author>Cosmos</Author>
<Version>1.0</Version>
<Description xml:space="preserve">This is a sample classifier extension to the Visual Studio Editor.</Description>
<Locale>1033</Locale>
<SupportedProducts>
<VisualStudio Version="10.0">
<Edition>Pro</Edition>
</VisualStudio>
</SupportedProducts>
<SupportedFrameworkRuntimeEdition MinVersion="4.0" MaxVersion="4.0" />
</Identifier>
<References />
<Content>
<MefComponent>|%CurrentProject%|</MefComponent>
</Content>
</Vsix>