├── .github └── FUNDING.yml ├── Images ├── bUnit.png ├── Routes.png ├── RazorMenuContext.png ├── SolutionRazorContext.png ├── ComponentUsagesExample.png └── SolutionRazorCsContext.png ├── BlazmExtension ├── BlazmExtension.Tests │ ├── GlobalUsings.cs │ ├── BlazmExtension.Tests.csproj │ └── ExtensionTests.cs ├── BlazmExtension │ ├── Resources │ │ ├── Icon.png │ │ ├── bunit.png │ │ ├── Images.png │ │ ├── CSFileNode.png │ │ ├── JSScript.png │ │ ├── StyleSheet.png │ │ └── CSRazorFile.png │ ├── Dialogs │ │ ├── Routing │ │ │ ├── RoutingItem.cs │ │ │ ├── RoutingWindow.cs │ │ │ ├── ProvideToolboxControlAttribute.cs │ │ │ ├── RoutingWindowControl.xaml │ │ │ └── RoutingWindowControl.xaml.cs │ │ ├── ComponentReferences │ │ │ ├── ComponentReferencesWindow.cs │ │ │ ├── ComponentReferencesControl.xaml.cs │ │ │ └── ComponentReferencesControl.xaml │ │ ├── FileNameDialog.xaml.cs │ │ └── FileNameDialog.xaml │ ├── Singletons │ │ └── ComponentNameProvider.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── source.extension.cs │ ├── Commands │ │ ├── CreateIsolatedCssCommand.cs │ │ ├── CreateIsolatedJavaScriptCommand.cs │ │ ├── RoutingWindowCommand.cs │ │ ├── QuickSaveCommand.cs │ │ ├── ExtractToComponent.cs │ │ ├── RunDotnetWatchCommand.cs │ │ ├── SwitchToNestedFile.cs │ │ ├── FindComponentUsagesCommand.cs │ │ ├── FindComponentUsagesSECommand.cs │ │ ├── MoveNamespaceCommand.cs │ │ ├── CreatebUnitTestCsCommand.cs │ │ ├── CreatebUnitTestRazorCommand.cs │ │ ├── CreateCodebehindCommand.cs │ │ └── MoveCodebehindToRazor.cs │ ├── BlazmExtensionPackage.cs │ ├── source.extension.vsixmanifest │ ├── Extensions │ │ ├── StringExtensions.cs │ │ ├── EnvDteExtensionMethods.cs │ │ ├── ProjectHelpers.cs │ │ └── TypeDefinitionExtensions.cs │ ├── VSCommandTable.cs │ ├── BlazmExtension.csproj │ └── VSCommandTable.vsct └── BlazmExtension.sln ├── LICENSE ├── .gitignore └── README.md /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | github: EngstromJimmy 3 | -------------------------------------------------------------------------------- /Images/bUnit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/Images/bUnit.png -------------------------------------------------------------------------------- /Images/Routes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/Images/Routes.png -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension.Tests/GlobalUsings.cs: -------------------------------------------------------------------------------- 1 | global using Microsoft.VisualStudio.TestTools.UnitTesting; -------------------------------------------------------------------------------- /Images/RazorMenuContext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/Images/RazorMenuContext.png -------------------------------------------------------------------------------- /Images/SolutionRazorContext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/Images/SolutionRazorContext.png -------------------------------------------------------------------------------- /Images/ComponentUsagesExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/Images/ComponentUsagesExample.png -------------------------------------------------------------------------------- /Images/SolutionRazorCsContext.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/Images/SolutionRazorCsContext.png -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/BlazmExtension/BlazmExtension/Resources/Icon.png -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Resources/bunit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/BlazmExtension/BlazmExtension/Resources/bunit.png -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Resources/Images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/BlazmExtension/BlazmExtension/Resources/Images.png -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Resources/CSFileNode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/BlazmExtension/BlazmExtension/Resources/CSFileNode.png -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Resources/JSScript.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/BlazmExtension/BlazmExtension/Resources/JSScript.png -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Resources/StyleSheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/BlazmExtension/BlazmExtension/Resources/StyleSheet.png -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Resources/CSRazorFile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/EngstromJimmy/Blazm.Extension/main/BlazmExtension/BlazmExtension/Resources/CSRazorFile.png -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Dialogs/Routing/RoutingItem.cs: -------------------------------------------------------------------------------- 1 | namespace BlazmExtension.Dialogs.Routing; 2 | 3 | public partial class RoutingWindowControl 4 | { 5 | public class RoutingItem 6 | { 7 | public string Name { get; set; } 8 | public string Content { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Dialogs/ComponentReferences/ComponentReferencesWindow.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.InteropServices; 2 | 3 | namespace BlazmExtension.Dialogs.ComponentReferences 4 | { 5 | [Guid("9d25178e-8686-452e-8491-7be334532c87")] 6 | public class ComponentReferencesWindow : ToolWindowPane 7 | { 8 | public ComponentReferencesWindow() : base(null) 9 | { 10 | this.Caption = "Component Usages"; 11 | this.Content = new ComponentReferencesControl(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Singletons/ComponentNameProvider.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace BlazmExtension.Singletons 5 | { 6 | public static class ComponentNameProvider 7 | { 8 | private static List ComponentNames { get; set; } = new List(); 9 | 10 | public static void SetComponentNames(IEnumerable componentNames) 11 | { 12 | if (componentNames != null) 13 | { 14 | ComponentNames = componentNames.ToList(); 15 | } 16 | } 17 | public static IEnumerable GetComponentNames() 18 | { 19 | return ComponentNames; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using BlazmExtension; 2 | using System.Reflection; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle(Vsix.Name)] 6 | [assembly: AssemblyDescription(Vsix.Description)] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyCompany(Vsix.Author)] 9 | [assembly: AssemblyProduct(Vsix.Name)] 10 | [assembly: AssemblyCopyright(Vsix.Author)] 11 | [assembly: AssemblyTrademark("")] 12 | [assembly: AssemblyCulture("")] 13 | 14 | [assembly: ComVisible(false)] 15 | 16 | [assembly: AssemblyVersion(Vsix.Version)] 17 | [assembly: AssemblyFileVersion(Vsix.Version)] 18 | 19 | namespace System.Runtime.CompilerServices 20 | { 21 | public class IsExternalInit { } 22 | } -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension.Tests/BlazmExtension.Tests.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | false 9 | true 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/source.extension.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace BlazmExtension 7 | { 8 | internal sealed partial class Vsix 9 | { 10 | public const string Id = "BlazmExtension.a0f59921-9553-46c5-b0cf-4c4921326541"; 11 | public const string Name = "BlazmExtension"; 12 | public const string Description = @"Extension that helps you with common Blazor tasks like creating a Isolated CSS or JavaScript from a context menu item"; 13 | public const string Language = "en-US"; 14 | public const string Version = "1.7.8"; 15 | public const string Author = "EngstromJimmy"; 16 | public const string Tags = ""; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Jimmy Engstrom 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Commands/CreateIsolatedCssCommand.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using EnvDTE80; 3 | using System.IO; 4 | 5 | namespace BlazmExtension 6 | { 7 | [Command(PackageIds.CreateIsolatedCss)] 8 | internal sealed class CreateIsolatedCssCommand : BaseCommand 9 | { 10 | protected override Task InitializeCompletedAsync() 11 | { 12 | Command.Supported = false; 13 | return base.InitializeCompletedAsync(); 14 | } 15 | 16 | protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) 17 | { 18 | var dte = await Package.GetServiceAsync(typeof(DTE)) as DTE2; 19 | UIHierarchy uih = (UIHierarchy)dte.Windows.Item(EnvDTE.Constants.vsWindowKindSolutionExplorer).Object; 20 | Array selectedItems = (Array)uih.SelectedItems; 21 | foreach (UIHierarchyItem selItem in selectedItems) 22 | { 23 | ProjectItem prjItem = selItem.Object as ProjectItem; 24 | string filePath = prjItem.Properties.Item("FullPath").Value.ToString(); 25 | 26 | var newfilePath = filePath + ".css"; 27 | if (!File.Exists(newfilePath)) 28 | { 29 | File.WriteAllText(newfilePath, ""); 30 | } 31 | } 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Dialogs/Routing/RoutingWindow.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.VisualStudio.Shell; 2 | using System; 3 | using System.Runtime.InteropServices; 4 | 5 | namespace BlazmExtension.Dialogs.Routing; 6 | 7 | /// 8 | /// This class implements the tool window exposed by this package and hosts a user control. 9 | /// 10 | /// 11 | /// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane, 12 | /// usually implemented by the package implementer. 13 | /// 14 | /// This class derives from the ToolWindowPane class provided from the MPF in order to use its 15 | /// implementation of the IVsUIElementPane interface. 16 | /// 17 | /// 18 | [Guid("eb70ef4f-9898-4e9d-91c3-419ef679d727")] 19 | public class RoutingWindow : ToolWindowPane 20 | { 21 | /// 22 | /// Initializes a new instance of the class. 23 | /// 24 | public RoutingWindow() : base(null) 25 | { 26 | this.Caption = "Blazor Routes"; 27 | 28 | // This is the user control hosted by the tool window; Note that, even if this class implements IDisposable, 29 | // we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on 30 | // the object returned by the Content property. 31 | this.Content = new RoutingWindowControl(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Dialogs/FileNameDialog.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows; 4 | using System.Windows.Input; 5 | using System.Windows.Media.Imaging; 6 | 7 | namespace StageCoder 8 | { 9 | public partial class FileNameDialog : Window 10 | { 11 | private const string DEFAULT_TEXT = "Enter a name for the component"; 12 | 13 | 14 | public FileNameDialog() 15 | { 16 | InitializeComponent(); 17 | 18 | Loaded += (s, e) => 19 | { 20 | //Icon = BitmapFrame.Create(new Uri("pack://application:,,,/AddAnyFile;component/Resources/icon.png", UriKind.RelativeOrAbsolute)); 21 | Title = "Save selection as a new component"; 22 | 23 | Name.Focus(); 24 | Name.CaretIndex = 0; 25 | Name.Text = DEFAULT_TEXT; 26 | Name.Select(0, Name.Text.Length); 27 | 28 | Name.PreviewKeyDown += (a, b) => 29 | { 30 | if (b.Key == Key.Escape) 31 | { 32 | if (string.IsNullOrWhiteSpace(Name.Text) || Name.Text == DEFAULT_TEXT) 33 | { 34 | Close(); 35 | } 36 | else 37 | { 38 | Name.Text = string.Empty; 39 | } 40 | } 41 | else if (Name.Text == DEFAULT_TEXT) 42 | { 43 | Name.Text = string.Empty; 44 | btnCreate.IsEnabled = true; 45 | } 46 | }; 47 | 48 | }; 49 | } 50 | 51 | public string Input => Name.Text.Trim(); 52 | 53 | private void Button_Click(object sender, RoutedEventArgs e) 54 | { 55 | DialogResult = true; 56 | Close(); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Commands/CreateIsolatedJavaScriptCommand.cs: -------------------------------------------------------------------------------- 1 | using EnvDTE; 2 | using EnvDTE80; 3 | using Microsoft.VisualStudio.Shell; 4 | using Microsoft.VisualStudio.Shell.Interop; 5 | using System.ComponentModel.Design; 6 | using System.IO; 7 | using System.Linq; 8 | using System.Security.Policy; 9 | 10 | namespace BlazmExtension 11 | { 12 | [Command(PackageIds.CreateIsolatedJavaScript)] 13 | internal sealed class CreateIsolatedJavaScriptCommand : BaseCommand 14 | { 15 | 16 | protected override Task InitializeCompletedAsync() 17 | { 18 | Command.Supported = false; 19 | return base.InitializeCompletedAsync(); 20 | } 21 | protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) 22 | { 23 | var dte = await Package.GetServiceAsync(typeof(DTE)) as DTE2; 24 | UIHierarchy uih = (UIHierarchy)dte.Windows.Item(EnvDTE.Constants.vsWindowKindSolutionExplorer).Object; 25 | Array selectedItems = (Array)uih.SelectedItems; 26 | foreach (UIHierarchyItem selItem in selectedItems) 27 | { 28 | ProjectItem prjItem = selItem.Object as ProjectItem; 29 | string filePath = prjItem.Properties.Item("FullPath").Value.ToString(); 30 | 31 | var newfilePath = filePath + ".js"; 32 | if (!File.Exists(newfilePath)) 33 | { 34 | File.WriteAllText(newfilePath, ""); 35 | } 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /BlazmExtension/BlazmExtension/Dialogs/FileNameDialog.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |