From 45b689b145a0503cb31da56920b2b2c9584e37c0 Mon Sep 17 00:00:00 2001 From: Allister Beharry Date: Wed, 20 Nov 2024 13:49:08 -0400 Subject: [PATCH] Begin package.json context menu command. --- .../CompileContracts.cs | 3 ++ .../BuildSystem/Solidity.targets | 2 +- .../SolidityProjectItemContextMenuProvider.cs | 39 ------------------- .../Stratis.VS.StratisEVM.csproj | 1 - .../StratisEVMPackage.cs | 7 ++++ 5 files changed, 11 insertions(+), 41 deletions(-) delete mode 100644 src/Stratis.VS.StratisEVM/SolidityProjectItemContextMenuProvider.cs diff --git a/src/Stratis.VS.SolidityProjectBuildTasks/CompileContracts.cs b/src/Stratis.VS.SolidityProjectBuildTasks/CompileContracts.cs index 7a4eb08..490610c 100644 --- a/src/Stratis.VS.SolidityProjectBuildTasks/CompileContracts.cs +++ b/src/Stratis.VS.SolidityProjectBuildTasks/CompileContracts.cs @@ -10,6 +10,9 @@ public class CompileContracts : Task [Required] public string ExtDir { get; set; } + [Required] + public string ProjectDir { get; set; } + [Required] public ITaskItem[] Contracts { get; set; } diff --git a/src/Stratis.VS.StratisEVM/BuildSystem/Solidity.targets b/src/Stratis.VS.StratisEVM/BuildSystem/Solidity.targets index a7dfa41..739680f 100644 --- a/src/Stratis.VS.StratisEVM/BuildSystem/Solidity.targets +++ b/src/Stratis.VS.StratisEVM/BuildSystem/Solidity.targets @@ -74,7 +74,7 @@ - + diff --git a/src/Stratis.VS.StratisEVM/SolidityProjectItemContextMenuProvider.cs b/src/Stratis.VS.StratisEVM/SolidityProjectItemContextMenuProvider.cs deleted file mode 100644 index 7a7e13c..0000000 --- a/src/Stratis.VS.StratisEVM/SolidityProjectItemContextMenuProvider.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -using Microsoft.VisualStudio.ProjectSystem; -using Microsoft.VisualStudio.ProjectSystem.VS; - -namespace Stratis.VS.StratisEVM -{ - [Export(typeof(IProjectItemContextMenuProvider))] - [AppliesTo(SolidityUnconfiguredProject.UniqueCapability)] - [Order(99)] - internal class SolidityProjectItemContextMenuProvider : IProjectItemContextMenuProvider - { - public bool TryGetContextMenu(IProjectTree projectItem, out Guid menuCommandGuid, out int menuCommandId) - { - menuCommandGuid = StratisEVMPackageIds.Guid2; - menuCommandId = 4128; - if (projectItem.FilePath.EndsWith(".sol")) - { - return false; - } - else - { - return false; - } - } - - public bool TryGetMixedItemsContextMenu(IEnumerable projectItems, out Guid menuCommandGuid, out int menuCommandId) - { - menuCommandGuid = StratisEVMPackageIds.GuidStratisEVMPackageCmdSet; - menuCommandId = StratisEVMPackageIds.Cmd1Id; - return false; // we let others display a mixed item menu - } - } -} diff --git a/src/Stratis.VS.StratisEVM/Stratis.VS.StratisEVM.csproj b/src/Stratis.VS.StratisEVM/Stratis.VS.StratisEVM.csproj index 677e8c5..5af18ce 100644 --- a/src/Stratis.VS.StratisEVM/Stratis.VS.StratisEVM.csproj +++ b/src/Stratis.VS.StratisEVM/Stratis.VS.StratisEVM.csproj @@ -47,7 +47,6 @@ 4 - diff --git a/src/Stratis.VS.StratisEVM/StratisEVMPackage.cs b/src/Stratis.VS.StratisEVM/StratisEVMPackage.cs index f9df962..10b1638 100644 --- a/src/Stratis.VS.StratisEVM/StratisEVMPackage.cs +++ b/src/Stratis.VS.StratisEVM/StratisEVMPackage.cs @@ -45,6 +45,11 @@ namespace Stratis.VS.StratisEVM expression: "(SingleProject | MultipleProjects) & Solidity", termNames: new[] { "SingleProject", "MultipleProjects", "Solidity" }, termValues: new[] { SolutionHasSingleProject_string, SolutionHasMultipleProjects_string, "HierSingleSelectionName:.sol$" })] + [ProvideUIContextRule(NPMFileUIContextRule, + name: "NPM Configuration Files", + expression: "(SingleProject | MultipleProjects) & Solidity", + termNames: new[] { "SingleProject", "MultipleProjects", "Solidity" }, + termValues: new[] { SolutionHasSingleProject_string, SolutionHasMultipleProjects_string, "HierSingleSelectionName:package.json$" })] public sealed class StratisEVMPackage : AsyncPackage, IVsSolutionEvents7 { /// @@ -53,6 +58,8 @@ public sealed class StratisEVMPackage : AsyncPackage, IVsSolutionEvents7 public const string PackageGuidString = "711b90a1-97e6-4b9a-91c4-3d62ccd32d4e"; public const string SolidityFileUIContextRule = "82268519-FB9D-4B7E-8B01-2A311F4181E2"; + + public const string NPMFileUIContextRule = "9A7CA75A-FA6E-45B2-B6E9-4BFF0AB7BB88"; #region Constructors static StratisEVMPackage() {