diff --git a/OpenInclude.Utility/OpenInclude.Utility.csproj b/OpenInclude.Utility/OpenInclude.Utility.csproj new file mode 100644 index 0000000..b08b24c --- /dev/null +++ b/OpenInclude.Utility/OpenInclude.Utility.csproj @@ -0,0 +1,49 @@ + + + + + Debug + AnyCPU + {471D9D31-DE12-4242-8AB5-B98FFC7E87AC} + Library + Properties + OpenInclude.Utility + OpenInclude.Utility + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OpenInclude.Utility/Properties/AssemblyInfo.cs b/OpenInclude.Utility/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..45d8cc9 --- /dev/null +++ b/OpenInclude.Utility/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +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("OpenInclude.Utility")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenInclude.Utility")] +[assembly: AssemblyCopyright("Copyright © 2021")] +[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)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("471d9d31-de12-4242-8ab5-b98ffc7e87ac")] + +// 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")] diff --git a/OpenInclude.Utility/UnityInclude.cs b/OpenInclude.Utility/UnityInclude.cs new file mode 100644 index 0000000..ef11f57 --- /dev/null +++ b/OpenInclude.Utility/UnityInclude.cs @@ -0,0 +1,54 @@ +using System; + +namespace OpenInclude.Utility +{ + public class UnityInclude + { + private readonly string identityPath; + private readonly string packageDisplayName = string.Empty; + private readonly string packageSubDirectory = string.Empty; + + public UnityInclude(string includeLine) + { + var removals = new string[] { "#include", " ", "\t", "\"" }; + var path = includeLine; + + foreach (var removal in removals) + { + path = path.Replace(removal, ""); + } + + identityPath = path; + + var directoryBlocks = identityPath.Split('/'); + for (int i = 0; i < directoryBlocks.Length; i++) + { + if (i == 0) { } + else if (i == 1) + { + packageDisplayName = directoryBlocks[i]; + } + else + { + packageSubDirectory += directoryBlocks[i]; + if (i != directoryBlocks.Length - 1) packageSubDirectory += "/"; + } + } + + Console.WriteLine(identityPath); + Console.WriteLine(packageDisplayName); + Console.WriteLine(packageSubDirectory); + + } + + public string PackageName + { + get { return packageDisplayName; } + } + + public string SubDirectory + { + get { return packageSubDirectory; } + } + } +} \ No newline at end of file diff --git a/OpenInclude.Utility/UnityPath.cs b/OpenInclude.Utility/UnityPath.cs new file mode 100644 index 0000000..64e3d3f --- /dev/null +++ b/OpenInclude.Utility/UnityPath.cs @@ -0,0 +1,73 @@ +using System; +using System.IO; + +namespace OpenInclude.Utility +{ + public class UnityPath + { + private string m_path; + + public string Root { get; } + + public UnityPath(string path) + { + this.m_path = path; + + if (path.Contains("Assets")) + { + Root = path.Substring(0, path.IndexOf("Assets", StringComparison.Ordinal) - 1); + } + else if (path.Contains("Packages")) + { + Root = path.Substring(0, path.IndexOf("Packages", StringComparison.Ordinal) - 1); + } + else if (path.Contains("Library\\PackageCache")) + { + Root = path.Substring(0, path.IndexOf("Library\\PackageCache", StringComparison.Ordinal) - 1); + } + + Console.WriteLine($"ROOT - {Root}"); + } + + public string GetResolvedPath(string packageName) + { + DirectoryInfo di; + DirectoryInfo[] subDirs; + + di = new DirectoryInfo(Root + "/Packages"); + subDirs = di.GetDirectories(); + + foreach (var dir in subDirs) + { + if (dir.FullName.Contains(packageName)) + { + return dir.FullName; + } + } + + di = new DirectoryInfo(Root + "/Library/PackageCache"); + subDirs = di.GetDirectories(); + + foreach (var dir in subDirs) + { + if (dir.FullName.Contains(packageName)) + { + return dir.FullName; + } + } + + di = new DirectoryInfo(Root + "/Assets"); + subDirs = di.GetDirectories(); + + foreach (var dir in subDirs) + { + if (dir.FullName.Contains(packageName)) + { + return dir.FullName; + } + } + + return string.Empty; + } + } +} \ No newline at end of file diff --git a/OpenInclude/OpenInclude.cs b/OpenInclude/OpenInclude.cs new file mode 100644 index 0000000..7ada360 --- /dev/null +++ b/OpenInclude/OpenInclude.cs @@ -0,0 +1,206 @@ +using System; +using System.Text; +using System.IO; +using System.Collections.Generic; +using System.Threading.Tasks; +using Microsoft.VisualStudio.Language.Intellisense; +using Microsoft.VisualStudio.Text; +using Microsoft.VisualStudio.Text.Editor; +using Microsoft.VisualStudio.Text.Operations; +using Microsoft.VisualStudio.Utilities; +using System.ComponentModel.Composition; +using System.Threading; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using EnvDTE; +using Microsoft.VisualStudio.Imaging.Interop; +using Microsoft.VisualStudio.Shell; +using Microsoft.VisualStudio.Shell.Interop; +using OpenInclude.Utility; +using Task = System.Threading.Tasks.Task; + +namespace OpenInclude +{ + internal static class FileAndContentTypeDefinitions + { + [Export] [Name("shader")] [BaseDefinition("text")] + internal static ContentTypeDefinition shaderContentTypeDefinition; + + [Export] [Name(".shader")] [ContentType("shader")] + internal static FileExtensionToContentTypeDefinition shaderFileExtensionDefinition; + + [Export] + [Name(".hlsl")] + [ContentType("shader")] + internal static FileExtensionToContentTypeDefinition HLSLFileExtensionDefinition; + + [Export] + [Name(".glsl")] + [ContentType("shader")] + internal static FileExtensionToContentTypeDefinition GLSLFileExtensionDefinition; + + [Export] + [Name(".cginc")] + [ContentType("shader")] + internal static FileExtensionToContentTypeDefinition CGINCLUDEFileExtensionDefinition; + } + + internal abstract class OpenIncludeSuggestedActionSourceProviderBase : ISuggestedActionsSourceProvider + { + [Import(typeof(ITextStructureNavigatorSelectorService))] + internal ITextStructureNavigatorSelectorService NavigatorService { get; set; } + + public ISuggestedActionsSource CreateSuggestedActionsSource(ITextView textView, ITextBuffer textBuffer) + { + if (textBuffer == null || textView == null) + { + return null; + } + + return new OpenIncludeSuggestedActionSource(this, textView, textBuffer); + } + } + + [Export(typeof(ISuggestedActionsSourceProvider))] + [Name("Open Include Text Suggested Action ")] + [ContentType("text")] + internal class OpenIncludeSuggestedActionSourceProviderText : OpenIncludeSuggestedActionSourceProviderBase + { + + } + + [Export(typeof(ISuggestedActionsSourceProvider))] + [Name("Open Include Text Suggested Action ")] + [ContentType("shader")] + internal class OpenIncludeSuggestedActionSourceProviderShader : OpenIncludeSuggestedActionSourceProviderBase + { + + } + + internal class OpenDocumentAction : ISuggestedAction + { + private readonly ITrackingSpan m_span; + private readonly string m_display; + private readonly ITextSnapshot m_snapshot; + + public OpenDocumentAction(ITrackingSpan span) + { + m_span = span; + m_snapshot = span.TextBuffer.CurrentSnapshot; + + m_display = string.Format("Open '{0}'", GetExportedPath(GetTrimText(span))); + } + + private string GetTrimText(ITrackingSpan span) + { + string text = span.GetText(m_snapshot); + return text.Replace(" ", ""); + } + + private string GetExportedPath(string trimmedText) + { + var text = trimmedText.Replace("#include", "").Replace("\"", "").Replace(" ", ""); + return text; + } + + public Task GetPreviewAsync(CancellationToken cancellationToken) + { + DTE dte = Package.GetGlobalService(typeof(SDTE)) as DTE; + string docName = dte.ActiveDocument.FullName; + + var includeLine = GetExportedPath(GetTrimText(m_span)); + + var currentDocument1 = new UnityPath(docName); + var includeDocument = new UnityInclude(includeLine); + + var resolved = currentDocument1.GetResolvedPath(includeDocument.PackageName) + "/" + includeDocument.SubDirectory; + + var sr = new StreamReader(resolved); + StringBuilder sb = new StringBuilder(); + + sb.AppendLine($"// {resolved}\n"); + for (int i = 0; i < 5; ++i) + { + sb.AppendLine(sr.ReadLine()); + } + sb.AppendLine("..."); + + var textBlock = new TextBlock(); + textBlock.Padding = new Thickness(5); + + textBlock.Inlines.Add(new Run() + { + Text = $"{sb.ToString()}" + }); + + return Task.FromResult(textBlock); + } + + public Task> GetActionSetsAsync(CancellationToken cancellationToken) + { + return Task.FromResult>(null); + } + + public bool HasActionSets + { + get { return false; } + } + public string DisplayText + { + get { return m_display; } + } + public ImageMoniker IconMoniker + { + get { return default(ImageMoniker); } + } + public string IconAutomationText + { + get + { + return null; + } + } + public string InputGestureText + { + get + { + return null; + } + } + public bool HasPreview + { + get { return true; } + } + + public void Invoke(CancellationToken cancellationToken) + { + ThreadHelper.JoinableTaskFactory.RunAsync(async () => + { + await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); + + var dte = (DTE)Package.GetGlobalService(typeof(SDTE)); + var path = dte.ActiveDocument.FullName; + + var includeLine = GetExportedPath(GetTrimText(m_span)); + + var currentDocument1 = new UnityPath(path); + var includeDocument = new UnityInclude(includeLine); + + var resolved = currentDocument1.GetResolvedPath(includeDocument.PackageName) + "/" + includeDocument.SubDirectory; + dte.ItemOperations.OpenFile(resolved); + }); + } + + public void Dispose() + { + } + + public bool TryGetTelemetryId(out Guid telemetryId) + { + // This is a sample action and doesn't participate in LightBulb telemetry + telemetryId = Guid.Empty; + return false; + } + } +} diff --git a/OpenInclude/OpenInclude.csproj b/OpenInclude/OpenInclude.csproj new file mode 100644 index 0000000..7c433ab --- /dev/null +++ b/OpenInclude/OpenInclude.csproj @@ -0,0 +1,95 @@ + + + + 16.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {22247888-E1F7-4A0A-8B3D-2EB59D639777} + Library + Properties + OpenInclude + OpenInclude + v4.7.2 + true + true + true + false + false + true + true + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + Designer + + + + + + + + + + + + + + + + + + + + + {471d9d31-de12-4242-8ab5-b98ffc7e87ac} + OpenInclude.Utility + + + + + Always + true + + + + + + \ No newline at end of file diff --git a/OpenInclude/OpenIncludePackage.cs b/OpenInclude/OpenIncludePackage.cs new file mode 100644 index 0000000..dd67eea --- /dev/null +++ b/OpenInclude/OpenIncludePackage.cs @@ -0,0 +1,53 @@ +using Microsoft.VisualStudio.Shell; +using System; +using System.Runtime.InteropServices; +using System.Threading; +using Task = System.Threading.Tasks.Task; + +namespace OpenInclude +{ + /// + /// This is the class that implements the package exposed by this assembly. + /// + /// + /// + /// The minimum requirement for a class to be considered a valid package for Visual Studio + /// is to implement the IVsPackage interface and register itself with the shell. + /// This package uses the helper classes defined inside the Managed Package Framework (MPF) + /// to do it: it derives from the Package class that provides the implementation of the + /// IVsPackage interface and uses the registration attributes defined in the framework to + /// register itself and its components with the shell. These attributes tell the pkgdef creation + /// utility what data to put into .pkgdef file. + /// + /// + /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file. + /// + /// + [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] + [Guid(OpenIncludePackage.PackageGuidString)] + public sealed class OpenIncludePackage : AsyncPackage + { + /// + /// OpenIncludePackage GUID string. + /// + public const string PackageGuidString = "7e7e8d36-5f66-4283-978f-31726eaa2dc6"; + + #region Package Members + + /// + /// Initialization of the package; this method is called right after the package is sited, so this is the place + /// where you can put all the initialization code that rely on services provided by VisualStudio. + /// + /// A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down. + /// A provider for progress updates. + /// A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method. + protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + // When initialized asynchronously, the current thread may be a background thread at this point. + // Do any initialization that requires the UI thread after switching to the UI thread. + await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + } + + #endregion + } +} diff --git a/OpenInclude/OpenIncludeSuggestedActionSource.cs b/OpenInclude/OpenIncludeSuggestedActionSource.cs new file mode 100644 index 0000000..a44c0dd --- /dev/null +++ b/OpenInclude/OpenIncludeSuggestedActionSource.cs @@ -0,0 +1,96 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.VisualStudio.Language.Intellisense; +using Microsoft.VisualStudio.Text; +using Microsoft.VisualStudio.Text.Editor; +using Microsoft.VisualStudio.Text.Operations; + +namespace OpenInclude +{ + internal class OpenIncludeSuggestedActionSource : ISuggestedActionsSource + { + private readonly OpenIncludeSuggestedActionSourceProviderBase m_provider; + private readonly ITextView m_textView; + private readonly ITextBuffer m_textBuffer; + + public OpenIncludeSuggestedActionSource(OpenIncludeSuggestedActionSourceProviderBase provider, ITextView textView, + ITextBuffer textBuffer) + { + this.m_provider = provider; + this.m_textView = textView; + this.m_textBuffer = textBuffer; + } + + private bool TryGetWordUnderCaret(out TextExtent wordExtent) + { + ITextCaret caret = m_textView.Caret; + SnapshotPoint point; + + if (caret.Position.BufferPosition > 0) + { + point = caret.Position.BufferPosition - 1; + } + else + { + wordExtent = default(TextExtent); + return false; + } + + ITextStructureNavigator navigator = m_provider.NavigatorService.GetTextStructureNavigator(m_textBuffer); + + wordExtent = navigator.GetExtentOfWord(point); + return true; + } + + public Task HasSuggestedActionsAsync(ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, CancellationToken cancellationToken) + { + return Task.Factory.StartNew(() => + { + TextExtent extent; + if (TryGetWordUnderCaret(out extent)) + { + // don't display the action if the extent has whitespace + return extent.IsSignificant; + } + return false; + }); + } + + public IEnumerable GetSuggestedActions(ISuggestedActionCategorySet requestedActionCategories, SnapshotSpan range, CancellationToken cancellationToken) + { + TextExtent extent; + if (TryGetWordUnderCaret(out extent) && extent.IsSignificant) + { + ITextSnapshotLine line = range.Snapshot.GetLineFromPosition(range.Start.Position); + + var lineSpan = range.Snapshot.CreateTrackingSpan(line.Extent, SpanTrackingMode.EdgeInclusive); + + if (!lineSpan.GetText(lineSpan.TextBuffer.CurrentSnapshot).Contains("#include")) + { + return Enumerable.Empty(); + } + + var openAction = new OpenDocumentAction(lineSpan); + + return new SuggestedActionSet[] { new SuggestedActionSet(new ISuggestedAction[] { openAction }) }; + } + return Enumerable.Empty(); + } + + public event EventHandler SuggestedActionsChanged; + + public void Dispose() + { + } + + public bool TryGetTelemetryId(out Guid telemetryId) + { + // This is a sample provider and doesn't participate in LightBulb telemetry + telemetryId = Guid.Empty; + return false; + } + } +} \ No newline at end of file diff --git a/OpenInclude/Properties/AssemblyInfo.cs b/OpenInclude/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f5a9622 --- /dev/null +++ b/OpenInclude/Properties/AssemblyInfo.cs @@ -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("OpenInclude")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("OpenInclude")] +[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")] diff --git a/OpenInclude/calcifer_square.png b/OpenInclude/calcifer_square.png new file mode 100644 index 0000000..c21a833 Binary files /dev/null and b/OpenInclude/calcifer_square.png differ diff --git a/OpenInclude/source.extension.vsixmanifest b/OpenInclude/source.extension.vsixmanifest new file mode 100644 index 0000000..2e0d92a --- /dev/null +++ b/OpenInclude/source.extension.vsixmanifest @@ -0,0 +1,22 @@ + + + + + OpenInclude + Simple plugins to open include files in shader files. + calcifer_square.png + + + + + + + + + + + + + + + diff --git a/ShaderlabAlmighty.sln b/ShaderlabAlmighty.sln new file mode 100644 index 0000000..0ce5593 --- /dev/null +++ b/ShaderlabAlmighty.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31129.286 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ShaderlabAlmighty", "ShaderlabAlmighty\ShaderlabAlmighty.csproj", "{89AA9E43-9A5C-4A71-96A9-C5EC8EDD3550}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenInclude", "OpenInclude\OpenInclude.csproj", "{22247888-E1F7-4A0A-8B3D-2EB59D639777}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OpenInclude.Utility", "OpenInclude.Utility\OpenInclude.Utility.csproj", "{471D9D31-DE12-4242-8AB5-B98FFC7E87AC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {89AA9E43-9A5C-4A71-96A9-C5EC8EDD3550}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89AA9E43-9A5C-4A71-96A9-C5EC8EDD3550}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89AA9E43-9A5C-4A71-96A9-C5EC8EDD3550}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89AA9E43-9A5C-4A71-96A9-C5EC8EDD3550}.Release|Any CPU.Build.0 = Release|Any CPU + {22247888-E1F7-4A0A-8B3D-2EB59D639777}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {22247888-E1F7-4A0A-8B3D-2EB59D639777}.Debug|Any CPU.Build.0 = Debug|Any CPU + {22247888-E1F7-4A0A-8B3D-2EB59D639777}.Release|Any CPU.ActiveCfg = Release|Any CPU + {22247888-E1F7-4A0A-8B3D-2EB59D639777}.Release|Any CPU.Build.0 = Release|Any CPU + {471D9D31-DE12-4242-8AB5-B98FFC7E87AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {471D9D31-DE12-4242-8AB5-B98FFC7E87AC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {471D9D31-DE12-4242-8AB5-B98FFC7E87AC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {471D9D31-DE12-4242-8AB5-B98FFC7E87AC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F3D6DDCF-26E6-4C67-BBD7-D0F88D53FFE4} + EndGlobalSection +EndGlobal diff --git a/ShaderlabAlmighty/Properties/AssemblyInfo.cs b/ShaderlabAlmighty/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..7ce81ce --- /dev/null +++ b/ShaderlabAlmighty/Properties/AssemblyInfo.cs @@ -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("ShaderlabAlmighty")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("ShaderlabAlmighty")] +[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")] diff --git a/ShaderlabAlmighty/ShaderlabAlmighty.csproj b/ShaderlabAlmighty/ShaderlabAlmighty.csproj new file mode 100644 index 0000000..87a4fc9 --- /dev/null +++ b/ShaderlabAlmighty/ShaderlabAlmighty.csproj @@ -0,0 +1,72 @@ + + + + 16.0 + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + + + + Debug + AnyCPU + 2.0 + {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {89AA9E43-9A5C-4A71-96A9-C5EC8EDD3550} + Library + Properties + ShaderlabAlmighty + ShaderlabAlmighty + v4.7.2 + true + true + true + false + false + true + true + Program + $(DevEnvDir)devenv.exe + /rootsuffix Exp + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + Designer + + + + + + + + + + + + + \ No newline at end of file diff --git a/ShaderlabAlmighty/ShaderlabAlmightyPackage.cs b/ShaderlabAlmighty/ShaderlabAlmightyPackage.cs new file mode 100644 index 0000000..9562c69 --- /dev/null +++ b/ShaderlabAlmighty/ShaderlabAlmightyPackage.cs @@ -0,0 +1,53 @@ +using Microsoft.VisualStudio.Shell; +using System; +using System.Runtime.InteropServices; +using System.Threading; +using Task = System.Threading.Tasks.Task; + +namespace ShaderlabAlmighty +{ + /// + /// This is the class that implements the package exposed by this assembly. + /// + /// + /// + /// The minimum requirement for a class to be considered a valid package for Visual Studio + /// is to implement the IVsPackage interface and register itself with the shell. + /// This package uses the helper classes defined inside the Managed Package Framework (MPF) + /// to do it: it derives from the Package class that provides the implementation of the + /// IVsPackage interface and uses the registration attributes defined in the framework to + /// register itself and its components with the shell. These attributes tell the pkgdef creation + /// utility what data to put into .pkgdef file. + /// + /// + /// To get loaded into VS, the package must be referred by <Asset Type="Microsoft.VisualStudio.VsPackage" ...> in .vsixmanifest file. + /// + /// + [PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading = true)] + [Guid(ShaderlabAlmightyPackage.PackageGuidString)] + public sealed class ShaderlabAlmightyPackage : AsyncPackage + { + /// + /// ShaderlabAlmightyPackage GUID string. + /// + public const string PackageGuidString = "1b9a6fee-09c7-4b32-b691-6419f40c7815"; + + #region Package Members + + /// + /// Initialization of the package; this method is called right after the package is sited, so this is the place + /// where you can put all the initialization code that rely on services provided by VisualStudio. + /// + /// A cancellation token to monitor for initialization cancellation, which can occur when VS is shutting down. + /// A provider for progress updates. + /// A task representing the async work of package initialization, or an already completed task if there is none. Do not return null from this method. + protected override async Task InitializeAsync(CancellationToken cancellationToken, IProgress progress) + { + // When initialized asynchronously, the current thread may be a background thread at this point. + // Do any initialization that requires the UI thread after switching to the UI thread. + await this.JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken); + } + + #endregion + } +} diff --git a/ShaderlabAlmighty/source.extension.vsixmanifest b/ShaderlabAlmighty/source.extension.vsixmanifest new file mode 100644 index 0000000..1361d56 --- /dev/null +++ b/ShaderlabAlmighty/source.extension.vsixmanifest @@ -0,0 +1,20 @@ + + + + + ShaderlabAlmighty + Empty VSIX Project. + + + + + + + + + + + + + +