├── README.md ├── src ├── Debouncer.cs ├── IconMapper.cs ├── Options │ └── General.cs ├── Resources │ └── Icon.png ├── Commands │ ├── DeleteCommand.cs │ ├── NewFileCommand.cs │ ├── AddFolderCommand.cs │ ├── OpenInDefaultProgramCommand.cs │ ├── RemoveFolderCommand.cs │ ├── CopyFullPathCommand.cs │ ├── OpenInExplorerCommand.cs │ ├── EnableWorkspaceCommand.cs │ ├── OpenInVsCodeCommand.cs │ ├── OpenInTerminalCommand.cs │ ├── NewFolderCommand.cs │ └── RenameCommand.cs ├── MEF │ ├── WorkspaceItemNode.cs │ ├── WorkspaceRootNode.cs │ ├── WorkspaceItemSourceProvider.cs │ ├── WorkspaceItemType.cs │ ├── WorkspaceItemNodeDragDropSourceController.cs │ ├── WorkspaceItemInvocationController.cs │ ├── WorkspaceItemContextMenuController.cs │ └── WorkspaceItemNodeTooltip.cs ├── WorkspaceFilesPackage.cs ├── source.extension.vsixmanifest ├── Properties │ └── AssemblyInfo.cs ├── Relationships.cs ├── source.extension.cs ├── VSCommandTable.cs ├── WorkspaceFiles.csproj └── VSCommandTable.vsct ├── .github ├── FUNDING.yml ├── workflows │ └── build.yaml ├── copilot-instructions.md ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── CODE_OF_CONDUCT.md └── CONTRIBUTING.md ├── art ├── animation.gif └── add-physical-folder.png ├── vs-publish.json ├── WorkspaceFiles.sln ├── .gitattributes ├── .editorconfig ├── .gitignore ├── PERFORMANCE_OPTIMIZATIONS.md └── LICENSE.txt /README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/README.md -------------------------------------------------------------------------------- /src/Debouncer.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/Debouncer.cs -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: madskristensen 4 | -------------------------------------------------------------------------------- /art/animation.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/art/animation.gif -------------------------------------------------------------------------------- /src/IconMapper.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/IconMapper.cs -------------------------------------------------------------------------------- /src/Options/General.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/Options/General.cs -------------------------------------------------------------------------------- /src/Resources/Icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/Resources/Icon.png -------------------------------------------------------------------------------- /.github/workflows/build.yaml: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/.github/workflows/build.yaml -------------------------------------------------------------------------------- /art/add-physical-folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/art/add-physical-folder.png -------------------------------------------------------------------------------- /src/Commands/DeleteCommand.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/Commands/DeleteCommand.cs -------------------------------------------------------------------------------- /src/MEF/WorkspaceItemNode.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/MEF/WorkspaceItemNode.cs -------------------------------------------------------------------------------- /src/MEF/WorkspaceRootNode.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/MEF/WorkspaceRootNode.cs -------------------------------------------------------------------------------- /src/WorkspaceFilesPackage.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/WorkspaceFilesPackage.cs -------------------------------------------------------------------------------- /.github/copilot-instructions.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/.github/copilot-instructions.md -------------------------------------------------------------------------------- /src/Commands/NewFileCommand.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/Commands/NewFileCommand.cs -------------------------------------------------------------------------------- /src/Commands/AddFolderCommand.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/Commands/AddFolderCommand.cs -------------------------------------------------------------------------------- /src/source.extension.vsixmanifest: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/source.extension.vsixmanifest -------------------------------------------------------------------------------- /src/MEF/WorkspaceItemSourceProvider.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/madskristensen/WorkspaceFiles/HEAD/src/MEF/WorkspaceItemSourceProvider.cs -------------------------------------------------------------------------------- /src/MEF/WorkspaceItemType.cs: -------------------------------------------------------------------------------- 1 | namespace WorkspaceFiles 2 | { 3 | public enum WorkspaceItemType 4 | { 5 | File, 6 | Folder, 7 | Root 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Commands/OpenInDefaultProgramCommand.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace WorkspaceFiles 4 | { 5 | [Command(PackageIds.OpenInDefaultProgram)] 6 | internal sealed class OpenInDefaultProgramCommand : BaseCommand 7 | { 8 | protected override void Execute(object sender, EventArgs e) 9 | { 10 | Process.Start(WorkspaceItemContextMenuController.CurrentItem.Info.FullName); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Commands/RemoveFolderCommand.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace WorkspaceFiles 4 | { 5 | [Command(PackageIds.RemoveFolder)] 6 | internal sealed class RemoveFolderCommand : BaseCommand 7 | { 8 | protected override void Execute(object sender, EventArgs e) 9 | { 10 | FileSystemInfo item = WorkspaceItemContextMenuController.CurrentItem?.Info; 11 | 12 | if (item != null) 13 | { 14 | RemoveFolderRequest?.Invoke(this, item.FullName); 15 | } 16 | } 17 | 18 | public static event EventHandler RemoveFolderRequest; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | -------------------------------------------------------------------------------- /vs-publish.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/vsix-publish", 3 | "categories": [ "other", "team development" ], 4 | "private": false, 5 | "identity": { 6 | "internalName": "WorkflowBrowser", 7 | "tags": [ "files", "folders", "workspace", "repo" ] 8 | }, 9 | "assetFiles": [ 10 | { 11 | "pathOnDisk": "art/animation.gif", 12 | "targetPath": "art/animation.gif" 13 | }, 14 | { 15 | "pathOnDisk": "art/add-physical-folder.png", 16 | "targetPath": "art/add-physical-folder.png" 17 | } 18 | ], 19 | "overview": "README.md", 20 | "publisher": "MadsKristensen", 21 | "repo": "https://github.com/madskristensen/WorkspaceFiles" 22 | } -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /src/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.InteropServices; 3 | 4 | using WorkspaceFiles; 5 | 6 | [assembly: AssemblyTitle(Vsix.Name)] 7 | [assembly: AssemblyDescription(Vsix.Description)] 8 | [assembly: AssemblyConfiguration("")] 9 | [assembly: AssemblyCompany(Vsix.Author)] 10 | [assembly: AssemblyProduct(Vsix.Name)] 11 | [assembly: AssemblyCopyright(Vsix.Author)] 12 | [assembly: AssemblyTrademark("")] 13 | [assembly: AssemblyCulture("")] 14 | 15 | [assembly: ComVisible(false)] 16 | 17 | [assembly: AssemblyVersion(Vsix.Version)] 18 | [assembly: AssemblyFileVersion(Vsix.Version)] 19 | 20 | namespace System.Runtime.CompilerServices 21 | { 22 | public class IsExternalInit { } 23 | } -------------------------------------------------------------------------------- /src/Commands/CopyFullPathCommand.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace WorkspaceFiles 4 | { 5 | [Command(PackageIds.CopyFullPath)] 6 | internal sealed class CopyFullPathCommand : BaseCommand 7 | { 8 | protected override Task InitializeCompletedAsync() 9 | { 10 | Command.Supported = false; 11 | return base.InitializeCompletedAsync(); 12 | } 13 | protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) 14 | { 15 | Clipboard.SetText(WorkspaceItemContextMenuController.CurrentItem.Info.FullName); 16 | 17 | await VS.StatusBar.ShowMessageAsync("Full path copied to clipboard"); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Commands/OpenInExplorerCommand.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | 3 | namespace WorkspaceFiles 4 | { 5 | [Command(PackageIds.OpenInExplorer)] 6 | internal sealed class OpenInExplorerCommand : BaseCommand 7 | { 8 | protected override void Execute(object sender, EventArgs e) 9 | { 10 | WorkspaceItemNode item = WorkspaceItemContextMenuController.CurrentItem; 11 | 12 | var arg = $"\"{item.Info?.FullName}\""; 13 | 14 | if (item.Type == WorkspaceItemType.File) 15 | { 16 | arg = $"/select, \"{item.Info.FullName}\""; 17 | } 18 | 19 | Process.Start("explorer.exe", arg); 20 | 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Commands/EnableWorkspaceCommand.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Internal.VisualStudio.PlatformUI; 2 | 3 | namespace WorkspaceFiles 4 | { 5 | [Command(PackageIds.ToggleWorkspace)] 6 | internal sealed class EnableWorkspaceCommand : BaseCommand 7 | { 8 | protected override async Task ExecuteAsync(OleMenuCmdEventArgs e) 9 | { 10 | Command.Checked = !Command.Checked; 11 | General options = await General.GetLiveInstanceAsync(); 12 | options.Enabled = Command.Checked; 13 | await options.SaveAsync(); 14 | } 15 | 16 | protected override void BeforeQueryStatus(EventArgs e) 17 | { 18 | Command.Visible = HierarchyUtilities.IsSolutionOpen; 19 | Command.Checked = General.Instance.Enabled; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Relationships.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Internal.VisualStudio.PlatformUI; 2 | 3 | namespace WorkspaceFiles 4 | { 5 | internal static class Relationships 6 | { 7 | public static IAttachedRelationship Contains { get; } = new ContainsAttachedRelationship(); 8 | 9 | public static IAttachedRelationship ContainedBy { get; } = new ContainedByAttachedRelationship(); 10 | 11 | private sealed class ContainsAttachedRelationship : IAttachedRelationship 12 | { 13 | public string Name => KnownRelationships.Contains; 14 | public string DisplayName => KnownRelationships.Contains; 15 | } 16 | 17 | private sealed class ContainedByAttachedRelationship : IAttachedRelationship 18 | { 19 | public string Name => KnownRelationships.ContainedBy; 20 | public string DisplayName => KnownRelationships.ContainedBy; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/MEF/WorkspaceItemNodeDragDropSourceController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Windows; 4 | using System.Windows.Input; 5 | using Microsoft.Internal.VisualStudio.PlatformUI; 6 | 7 | namespace WorkspaceFiles 8 | { 9 | internal class WorkspaceItemNodeDragDropSourceController : IDragDropSourceController 10 | { 11 | public bool DoDragDrop(IEnumerable items) 12 | { 13 | if (!items.OfType().Any()) 14 | { 15 | return false; 16 | } 17 | 18 | var path = (items.FirstOrDefault() as WorkspaceItemNode)?.Info.FullName; 19 | 20 | DependencyObject dragSource = (Keyboard.FocusedElement as DependencyObject) ?? Application.Current.MainWindow; 21 | var dataObj = new DataObject(DataFormats.FileDrop, items.OfType().Select(i => i.Info.FullName).ToArray()); 22 | DragDrop.DoDragDrop(dragSource, dataObj, DragDropEffects.Move); 23 | 24 | return true; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Commands/OpenInVsCodeCommand.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.IO; 3 | 4 | namespace WorkspaceFiles 5 | { 6 | [Command(PackageIds.OpenInVsCode)] 7 | internal sealed class OpenInVsCodeCommand : BaseCommand 8 | { 9 | protected override void Execute(object sender, EventArgs e) 10 | { 11 | var path = WorkspaceItemContextMenuController.CurrentItem.Info.FullName; 12 | var isDirectory = Directory.Exists(path); 13 | 14 | var args = isDirectory ? "." : $"{path}"; 15 | 16 | var start = new ProcessStartInfo() 17 | { 18 | FileName = $"cmd.exe", 19 | Arguments = $"/C code \"{args}\"", 20 | CreateNoWindow = true, 21 | UseShellExecute = false, 22 | WindowStyle = ProcessWindowStyle.Hidden, 23 | }; 24 | 25 | if (isDirectory) 26 | { 27 | start.WorkingDirectory = path; 28 | } 29 | 30 | Process.Start(start); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/source.extension.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 1.0.44 4 | // Available from https://marketplace.visualstudio.com/items?itemName=MadsKristensen.VsixSynchronizer64 5 | // 6 | // ------------------------------------------------------------------------------ 7 | namespace WorkspaceFiles 8 | { 9 | internal sealed partial class Vsix 10 | { 11 | public const string Id = "WorkspaceFiles.e5308ac4-ca47-4992-945b-9b144a10c2d0"; 12 | public const string Name = "File Explorer"; 13 | public const string Description = @"Gives access to all files and folders from the file system under the repo- or solution root folder. All in the same Solution Explorer view."; 14 | public const string Language = "en-US"; 15 | public const string Version = "1.0.1000"; 16 | public const string Author = "Mads Kristensen"; 17 | public const string Tags = "files, folders, repo, root"; 18 | public const bool IsPreview = false; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Commands/OpenInTerminalCommand.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics; 2 | using System.IO; 3 | 4 | namespace WorkspaceFiles 5 | { 6 | [Command(PackageIds.OpenInTerminal)] 7 | internal sealed class OpenInTerminalCommand : BaseCommand 8 | { 9 | protected override void Execute(object sender, EventArgs e) 10 | { 11 | WorkspaceItemNode item = WorkspaceItemContextMenuController.CurrentItem; 12 | var path = WorkspaceItemContextMenuController.CurrentItem.Info.FullName; 13 | 14 | if (!Directory.Exists(path)) 15 | { 16 | path = Path.GetDirectoryName(path); 17 | } 18 | 19 | var exe = "cmd.exe"; 20 | var args = $"/c wt.exe -d \"{path}\""; 21 | 22 | var pi = new ProcessStartInfo 23 | { 24 | FileName = exe, 25 | Arguments = args, 26 | WorkingDirectory = path, 27 | CreateNoWindow = true, 28 | UseShellExecute = false, 29 | WindowStyle = ProcessWindowStyle.Hidden, 30 | }; 31 | Process.Start(pi); 32 | 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/MEF/WorkspaceItemInvocationController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | using System.Linq; 4 | using System.Windows.Forms; 5 | using Microsoft.Internal.VisualStudio.PlatformUI; 6 | 7 | namespace WorkspaceFiles 8 | { 9 | internal class WorkspaceItemInvocationController : IInvocationController 10 | { 11 | public bool Invoke(IEnumerable items, InputSource inputSource, bool preview) 12 | { 13 | foreach (WorkspaceItemNode item in items.OfType()) 14 | { 15 | if (item.Info is FileInfo) 16 | { 17 | if (preview) 18 | { 19 | VS.Documents.OpenInPreviewTabAsync(item.Info.FullName).FireAndForget(); 20 | } 21 | else 22 | { 23 | VS.Documents.OpenAsync(item.Info.FullName).FireAndForget(); 24 | } 25 | } 26 | else 27 | { 28 | SendKeys.Send("{RIGHT}"); 29 | } 30 | } 31 | 32 | return true; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/Commands/NewFolderCommand.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using Microsoft.VisualStudio.PlatformUI; 3 | 4 | namespace WorkspaceFiles 5 | { 6 | [Command(PackageIds.NewFolder)] 7 | internal sealed class NewFolderCommand : BaseCommand 8 | { 9 | protected override void Execute(object sender, EventArgs e) 10 | { 11 | var itemPath = WorkspaceItemContextMenuController.CurrentItem.Info.FullName; 12 | var result = TextInputDialog.Show( 13 | "New Folder", 14 | "Enter the name of the new folder. (Note that folders are not automatically added into projects)", 15 | "NewFolder", 16 | input => 17 | { 18 | // Check if the folder name is valid and does not exist. 19 | // Note that we use Path.GetInvalidFileNameChars() instead of Path.GetInvalidPathChars() 20 | // so we avoid creating a folder that is a subfolder. 21 | var isValidName = input.IndexOfAny(Path.GetInvalidPathChars()) == -1; 22 | var folderExists = Directory.Exists(Path.Combine(itemPath, input)); 23 | return isValidName && !folderExists; 24 | }, 25 | out var folderName 26 | ); 27 | 28 | // If the user cancels the dialog, return. 29 | if (!result) return; 30 | 31 | // Create the new folder. 32 | var folderPath = Path.Combine(itemPath, folderName); 33 | Directory.CreateDirectory(folderPath); 34 | } 35 | } 36 | } -------------------------------------------------------------------------------- /src/MEF/WorkspaceItemContextMenuController.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | using System.Windows; 4 | using Microsoft.Internal.VisualStudio.PlatformUI; 5 | using Microsoft.VisualStudio; 6 | using Microsoft.VisualStudio.Shell.Interop; 7 | 8 | namespace WorkspaceFiles 9 | { 10 | internal class WorkspaceItemContextMenuController : IContextMenuController 11 | { 12 | public static WorkspaceItemNode CurrentItem { get; private set; } 13 | 14 | public bool ShowContextMenu(IEnumerable items, Point location) 15 | { 16 | ThreadHelper.ThrowIfNotOnUIThread(); 17 | 18 | CurrentItem = items.OfType().FirstOrDefault(); 19 | 20 | if (CurrentItem == null) 21 | { 22 | return false; 23 | } 24 | 25 | IVsUIShell shell = VS.GetRequiredService(); 26 | Guid guid = PackageGuids.WorkspaceFiles; 27 | 28 | var result = shell.ShowContextMenu( 29 | dwCompRole: 0, 30 | rclsidActive: ref guid, 31 | nMenuId: GetMenuFromNodeType(), 32 | pos: [new POINTS() { x = (short)location.X, y = (short)location.Y }], 33 | pCmdTrgtActive: null); 34 | 35 | return ErrorHandler.Succeeded(result); 36 | } 37 | 38 | private static int GetMenuFromNodeType() 39 | { 40 | return CurrentItem.Type switch 41 | { 42 | WorkspaceItemType.File => PackageIds.FileContextMenu, 43 | WorkspaceItemType.Folder => PackageIds.FolderContextMenu, 44 | WorkspaceItemType.Root => PackageIds.RootContextMenu, 45 | _ => throw new NotImplementedException("WorkspaceItemType not supported"), 46 | }; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /WorkspaceFiles.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.10.34517.293 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WorkspaceFiles", "src\WorkspaceFiles.csproj", "{91446405-EABE-46D6-9EB9-505A14B74DE0}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|arm64 = Debug|arm64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|arm64 = Release|arm64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Debug|arm64.ActiveCfg = Debug|arm64 21 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Debug|arm64.Build.0 = Debug|arm64 22 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Debug|x86.ActiveCfg = Debug|x86 23 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Debug|x86.Build.0 = Debug|x86 24 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Release|arm64.ActiveCfg = Release|arm64 27 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Release|arm64.Build.0 = Release|arm64 28 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Release|x86.ActiveCfg = Release|x86 29 | {91446405-EABE-46D6-9EB9-505A14B74DE0}.Release|x86.Build.0 = Release|x86 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | GlobalSection(ExtensibilityGlobals) = postSolution 35 | SolutionGuid = {6FDAD619-AB07-4097-8C91-508C480D0C16} 36 | EndGlobalSection 37 | EndGlobal 38 | -------------------------------------------------------------------------------- /src/VSCommandTable.cs: -------------------------------------------------------------------------------- 1 | // ------------------------------------------------------------------------------ 2 | // 3 | // This file was generated by VSIX Synchronizer 4 | // 5 | // ------------------------------------------------------------------------------ 6 | namespace WorkspaceFiles 7 | { 8 | using System; 9 | 10 | /// 11 | /// Helper class that exposes all GUIDs used across VS Package. 12 | /// 13 | internal sealed partial class PackageGuids 14 | { 15 | public const string WorkspaceFilesString = "d428d0a0-b960-4617-a7fd-15743d49e72e"; 16 | public static Guid WorkspaceFiles = new Guid(WorkspaceFilesString); 17 | } 18 | /// 19 | /// Helper class that encapsulates all CommandIDs uses across VS Package. 20 | /// 21 | internal sealed partial class PackageIds 22 | { 23 | public const int RootContextMenu = 0x0001; 24 | public const int FileContextMenu = 0x0002; 25 | public const int FolderContextMenu = 0x0003; 26 | public const int RootContextMenuGroup = 0x0010; 27 | public const int FileContextMenuGroup = 0x0020; 28 | public const int FolderContextMenuGroup = 0x0030; 29 | public const int FileOpenGroup = 0x0040; 30 | public const int FolderOpenGroup = 0x0041; 31 | public const int RootOpenGroup = 0x0042; 32 | public const int SolutionToolbarGroup = 0x0050; 33 | public const int FileOperationsGroup = 0x0060; 34 | public const int FolderOperationsGroup = 0x0061; 35 | public const int RootOperationsGroup = 0x0062; 36 | public const int AddItemGroup = 0x0070; 37 | public const int Delete = 0x0200; 38 | public const int OpenInExplorer = 0x0300; 39 | public const int ToggleWorkspace = 0x0400; 40 | public const int CopyFullPath = 0x0500; 41 | public const int OpenInDefaultProgram = 0x0600; 42 | public const int Rename = 0x0700; 43 | public const int AddFolder = 0x0800; 44 | public const int RemoveFolder = 0x0900; 45 | public const int NewFolder = 0x1000; 46 | public const int NewFile = 0x1001; 47 | public const int OpenInVsCode = 0x1002; 48 | public const int OpenInTerminal = 0x1003; 49 | } 50 | } -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /src/MEF/WorkspaceItemNodeTooltip.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Linq; 3 | using System.Threading.Tasks; 4 | using System.Windows.Controls; 5 | using System.Windows.Media.Imaging; 6 | using Microsoft.VisualStudio.Threading; 7 | 8 | namespace WorkspaceFiles.MEF 9 | { 10 | internal class WorkspaceItemNodeTooltip 11 | { 12 | private static readonly string[] _imageExt = [".png", ".jpg", ".jpeg", ".gif", ".webp", ".gif", ".tif", ".tiff", ".ico", ".bmp", ".wmp"]; 13 | 14 | public static object GetTooltip(WorkspaceItemNode node) 15 | { 16 | if (node.IsCut) 17 | { 18 | return "File is matching a pattern in the .gitignore file"; 19 | } 20 | 21 | FileSystemInfo info = node.Info; 22 | 23 | if (File.Exists(info.FullName) && IsImage(info.Name)) 24 | { 25 | // Create placeholder image control that will load asynchronously 26 | var imageControl = new Image 27 | { 28 | MaxHeight = 100, 29 | MaxWidth = 100 30 | }; 31 | 32 | // Load image asynchronously to avoid blocking UI thread 33 | _ = LoadImageAsync(info.FullName, imageControl); 34 | 35 | return imageControl; 36 | } 37 | return null; 38 | } 39 | 40 | private static async Task LoadImageAsync(string imagePath, Image imageControl) 41 | { 42 | try 43 | { 44 | // Switch to background thread for I/O operation 45 | await TaskScheduler.Default; 46 | 47 | // Load image on background thread 48 | var bitmap = new BitmapImage(); 49 | bitmap.BeginInit(); 50 | bitmap.CacheOption = BitmapCacheOption.OnLoad; 51 | bitmap.CreateOptions = BitmapCreateOptions.IgnoreColorProfile; // Performance optimization 52 | bitmap.UriSource = new Uri(imagePath); 53 | bitmap.EndInit(); 54 | bitmap.Freeze(); // Make it thread-safe for UI thread access 55 | 56 | // Switch back to UI thread to update the control 57 | await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); 58 | imageControl.Source = bitmap; 59 | } 60 | catch 61 | { 62 | // Silently handle errors (e.g., corrupted images, access denied) 63 | // Could optionally show a placeholder icon 64 | } 65 | } 66 | 67 | private static bool IsImage(string fileName) 68 | { 69 | var extension = Path.GetExtension(fileName).ToLowerInvariant(); 70 | return _imageExt.Contains(extension); 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /src/Commands/RenameCommand.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using EnvDTE; 3 | using Microsoft.VisualStudio.PlatformUI; 4 | 5 | namespace WorkspaceFiles 6 | { 7 | [Command(PackageIds.Rename)] 8 | internal sealed class RenameCommand : BaseCommand 9 | { 10 | protected override void Execute(object sender, EventArgs e) 11 | { 12 | var oldItemPath = WorkspaceItemContextMenuController.CurrentItem.Info.FullName; 13 | var oldItemName = WorkspaceItemContextMenuController.CurrentItem.Info.Name; 14 | 15 | var fileAttributes = File.GetAttributes(oldItemPath); 16 | var isDirectory = fileAttributes.HasFlag(FileAttributes.Directory); 17 | 18 | var result = TextInputDialog.Show( 19 | "Rename File", 20 | $"Enter the new name of the file for {oldItemName}.", 21 | oldItemName, 22 | userInput => 23 | { 24 | var OperationResult = string.Empty; 25 | 26 | if (!userInput.Equals(oldItemName)) 27 | { 28 | var isValidName = userInput.IndexOfAny(Path.GetInvalidFileNameChars()) == -1; 29 | 30 | bool exists; 31 | 32 | if (isDirectory) 33 | { 34 | exists = Directory.Exists(Path.Combine(Directory.GetParent(oldItemPath).FullName, userInput)); 35 | } 36 | else 37 | { 38 | exists = File.Exists(Path.Combine(oldItemPath, userInput)); 39 | } 40 | 41 | if (isValidName && !exists) 42 | { 43 | return true; 44 | } 45 | 46 | if (exists) 47 | { 48 | OperationResult = $"{(isDirectory ? "Directory" : "File")} \"{userInput}\" already exists."; 49 | } 50 | else 51 | { 52 | OperationResult = $"Invalid {(isDirectory ? "directory" : "file")} name \"{userInput}\"."; 53 | } 54 | } 55 | else 56 | { 57 | OperationResult = $"You must enter different name than current \"{userInput}\" to rename {(isDirectory ? "directory" : "file")}."; 58 | } 59 | 60 | VS.MessageBox.ShowWarning(OperationResult); 61 | 62 | return false; 63 | }, 64 | out var newItemName 65 | ); 66 | 67 | // If the user cancels the dialog, return. 68 | if (!result) 69 | { 70 | return; 71 | } 72 | 73 | if (isDirectory) 74 | { 75 | var newFolderPath = Path.Combine(Directory.GetParent(oldItemPath).FullName, newItemName); 76 | 77 | Directory.Move(oldItemPath, newFolderPath); 78 | } 79 | else 80 | { 81 | var newFilePath = Path.Combine(Path.GetDirectoryName(oldItemPath), newItemName); 82 | 83 | File.Move(oldItemPath, newFilePath); 84 | } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome:http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Don't use tabs for indentation. 7 | [*] 8 | indent_style = space 9 | end_of_line = crlf 10 | # (Please don't specify an indent_size here; that has too many unintended consequences.) 11 | 12 | # Code files 13 | [*.{cs,csx,vb,vbx}] 14 | indent_size = 4 15 | 16 | # Xml project files 17 | [*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}] 18 | indent_size = 2 19 | 20 | # Xml config files 21 | [*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}] 22 | indent_size = 2 23 | 24 | # JSON files 25 | [*.json] 26 | indent_size = 2 27 | 28 | # Dotnet code style settings: 29 | [*.{cs,vb}] 30 | # Sort using and Import directives with System.* appearing first 31 | dotnet_sort_system_directives_first = true 32 | dotnet_separate_import_directive_groups = false 33 | 34 | # Avoid "this." and "Me." if not necessary 35 | dotnet_style_qualification_for_field = false : suggestion 36 | dotnet_style_qualification_for_property = false : suggestion 37 | dotnet_style_qualification_for_method = false : suggestion 38 | dotnet_style_qualification_for_event = false : suggestion 39 | 40 | # Use language keywords instead of framework type names for type references 41 | dotnet_style_predefined_type_for_locals_parameters_members = true : suggestion 42 | dotnet_style_predefined_type_for_member_access = true : suggestion 43 | 44 | # Suggest more modern language features when available 45 | dotnet_style_object_initializer = true : suggestion 46 | dotnet_style_collection_initializer = true : suggestion 47 | dotnet_style_coalesce_expression = true : suggestion 48 | dotnet_style_null_propagation = true : suggestion 49 | dotnet_style_explicit_tuple_names = true : suggestion 50 | 51 | # Naming rules - async methods to be prefixed with Async 52 | dotnet_naming_rule.async_methods_must_end_with_async.severity = warning 53 | dotnet_naming_rule.async_methods_must_end_with_async.symbols = method_symbols 54 | dotnet_naming_rule.async_methods_must_end_with_async.style = end_in_async_style 55 | 56 | dotnet_naming_symbols.method_symbols.applicable_kinds = method 57 | dotnet_naming_symbols.method_symbols.required_modifiers = async 58 | 59 | dotnet_naming_style.end_in_async_style.capitalization = pascal_case 60 | dotnet_naming_style.end_in_async_style.required_suffix = Async 61 | 62 | # Naming rules - private fields must start with an underscore 63 | dotnet_naming_rule.field_must_start_with_underscore.severity = warning 64 | dotnet_naming_rule.field_must_start_with_underscore.symbols = private_fields 65 | dotnet_naming_rule.field_must_start_with_underscore.style = start_underscore_style 66 | 67 | dotnet_naming_symbols.private_fields.applicable_kinds = field 68 | dotnet_naming_symbols.private_fields.applicable_accessibilities = private 69 | 70 | dotnet_naming_style.start_underscore_style.capitalization = camel_case 71 | dotnet_naming_style.start_underscore_style.required_prefix = _ 72 | 73 | # CSharp code style settings: 74 | [*.cs] 75 | # Prefer "var" everywhere 76 | csharp_style_var_for_built_in_types = true : suggestion 77 | csharp_style_var_when_type_is_apparent = true : suggestion 78 | csharp_style_var_elsewhere = false : suggestion 79 | 80 | # Prefer method-like constructs to have a block body 81 | csharp_style_expression_bodied_methods = false : none 82 | csharp_style_expression_bodied_constructors = false : none 83 | csharp_style_expression_bodied_operators = false : none 84 | 85 | # Prefer property-like constructs to have an expression-body 86 | csharp_style_expression_bodied_properties = true : none 87 | csharp_style_expression_bodied_indexers = true : none 88 | csharp_style_expression_bodied_accessors = true : none 89 | 90 | # Suggest more modern language features when available 91 | csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion 92 | csharp_style_pattern_matching_over_as_with_null_check = true : suggestion 93 | csharp_style_inlined_variable_declaration = true : suggestion 94 | csharp_style_throw_expression = true : suggestion 95 | csharp_style_conditional_delegate_call = true : suggestion 96 | 97 | # Newline settings 98 | csharp_new_line_before_open_brace = all 99 | csharp_new_line_before_else = true 100 | csharp_new_line_before_catch = true 101 | csharp_new_line_before_finally = true 102 | csharp_new_line_before_members_in_object_initializers = true 103 | csharp_new_line_before_members_in_anonymous_types = true -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | We as members, contributors, and leaders pledge to make participation in our 6 | community a harassment-free experience for everyone, regardless of age, body 7 | size, visible or invisible disability, ethnicity, sex characteristics, gender 8 | identity and expression, level of experience, education, socio-economic status, 9 | nationality, personal appearance, race, religion, or sexual identity 10 | and orientation. 11 | 12 | We pledge to act and interact in ways that contribute to an open, welcoming, 13 | diverse, inclusive, and healthy community. 14 | 15 | ## Our Standards 16 | 17 | Examples of behavior that contributes to a positive environment for our 18 | community include: 19 | 20 | * Demonstrating empathy and kindness toward other people 21 | * Being respectful of differing opinions, viewpoints, and experiences 22 | * Giving and gracefully accepting constructive feedback 23 | * Accepting responsibility and apologizing to those affected by our mistakes, 24 | and learning from the experience 25 | * Focusing on what is best not just for us as individuals, but for the 26 | overall community 27 | 28 | Examples of unacceptable behavior include: 29 | 30 | * The use of sexualized language or imagery, and sexual attention or 31 | advances of any kind 32 | * Trolling, insulting or derogatory comments, and personal or political attacks 33 | * Public or private harassment 34 | * Publishing others' private information, such as a physical or email 35 | address, without their explicit permission 36 | * Other conduct which could reasonably be considered inappropriate in a 37 | professional setting 38 | 39 | ## Enforcement Responsibilities 40 | 41 | Community leaders are responsible for clarifying and enforcing our standards of 42 | acceptable behavior and will take appropriate and fair corrective action in 43 | response to any behavior that they deem inappropriate, threatening, offensive, 44 | or harmful. 45 | 46 | Community leaders have the right and responsibility to remove, edit, or reject 47 | comments, commits, code, wiki edits, issues, and other contributions that are 48 | not aligned to this Code of Conduct, and will communicate reasons for moderation 49 | decisions when appropriate. 50 | 51 | ## Scope 52 | 53 | This Code of Conduct applies within all community spaces, and also applies when 54 | an individual is officially representing the community in public spaces. 55 | Examples of representing our community include using an official e-mail address, 56 | posting via an official social media account, or acting as an appointed 57 | representative at an online or offline event. 58 | 59 | ## Enforcement 60 | 61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 62 | reported to the community leaders responsible for enforcement at 63 | @mkristensen on Twitter. 64 | All complaints will be reviewed and investigated promptly and fairly. 65 | 66 | All community leaders are obligated to respect the privacy and security of the 67 | reporter of any incident. 68 | 69 | ## Enforcement Guidelines 70 | 71 | Community leaders will follow these Community Impact Guidelines in determining 72 | the consequences for any action they deem in violation of this Code of Conduct: 73 | 74 | ### 1. Correction 75 | 76 | **Community Impact**: Use of inappropriate language or other behavior deemed 77 | unprofessional or unwelcome in the community. 78 | 79 | **Consequence**: A private, written warning from community leaders, providing 80 | clarity around the nature of the violation and an explanation of why the 81 | behavior was inappropriate. A public apology may be requested. 82 | 83 | ### 2. Warning 84 | 85 | **Community Impact**: A violation through a single incident or series 86 | of actions. 87 | 88 | **Consequence**: A warning with consequences for continued behavior. No 89 | interaction with the people involved, including unsolicited interaction with 90 | those enforcing the Code of Conduct, for a specified period of time. This 91 | includes avoiding interactions in community spaces as well as external channels 92 | like social media. Violating these terms may lead to a temporary or 93 | permanent ban. 94 | 95 | ### 3. Temporary Ban 96 | 97 | **Community Impact**: A serious violation of community standards, including 98 | sustained inappropriate behavior. 99 | 100 | **Consequence**: A temporary ban from any sort of interaction or public 101 | communication with the community for a specified period of time. No public or 102 | private interaction with the people involved, including unsolicited interaction 103 | with those enforcing the Code of Conduct, is allowed during this period. 104 | Violating these terms may lead to a permanent ban. 105 | 106 | ### 4. Permanent Ban 107 | 108 | **Community Impact**: Demonstrating a pattern of violation of community 109 | standards, including sustained inappropriate behavior, harassment of an 110 | individual, or aggression toward or disparagement of classes of individuals. 111 | 112 | **Consequence**: A permanent ban from any sort of public interaction within 113 | the community. 114 | 115 | ## Attribution 116 | 117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 118 | version 2.0, available at 119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. 120 | 121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct 122 | enforcement ladder](https://github.com/mozilla/diversity). 123 | 124 | [homepage]: https://www.contributor-covenant.org 125 | 126 | For answers to common questions about this code of conduct, see the FAQ at 127 | https://www.contributor-covenant.org/faq. Translations are available at 128 | https://www.contributor-covenant.org/translations. 129 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Looking to contribute something? **Here's how you can help.** 4 | 5 | Please take a moment to review this document in order to make the contribution 6 | process easy and effective for everyone involved. 7 | 8 | Following these guidelines helps to communicate that you respect the time of 9 | the developers managing and developing this open source project. In return, 10 | they should reciprocate that respect in addressing your issue or assessing 11 | patches and features. 12 | 13 | 14 | ## Using the issue tracker 15 | 16 | The issue tracker is the preferred channel for [bug reports](#bug-reports), 17 | [features requests](#feature-requests) and 18 | [submitting pull requests](#pull-requests), but please respect the 19 | following restrictions: 20 | 21 | * Please **do not** use the issue tracker for personal support requests. Stack 22 | Overflow is a better place to get help. 23 | 24 | * Please **do not** derail or troll issues. Keep the discussion on topic and 25 | respect the opinions of others. 26 | 27 | * Please **do not** open issues or pull requests which *belongs to* third party 28 | components. 29 | 30 | 31 | ## Bug reports 32 | 33 | A bug is a _demonstrable problem_ that is caused by the code in the repository. 34 | Good bug reports are extremely helpful, so thanks! 35 | 36 | Guidelines for bug reports: 37 | 38 | 1. **Use the GitHub issue search** — check if the issue has already been 39 | reported. 40 | 41 | 2. **Check if the issue has been fixed** — try to reproduce it using the 42 | latest `master` or development branch in the repository. 43 | 44 | 3. **Isolate the problem** — ideally create an 45 | [SSCCE](http://www.sscce.org/) and a live example. 46 | Uploading the project on cloud storage (OneDrive, DropBox, et el.) 47 | or creating a sample GitHub repository is also helpful. 48 | 49 | 50 | A good bug report shouldn't leave others needing to chase you up for more 51 | information. Please try to be as detailed as possible in your report. What is 52 | your environment? What steps will reproduce the issue? What browser(s) and OS 53 | experience the problem? Do other browsers show the bug differently? What 54 | would you expect to be the outcome? All these details will help people to fix 55 | any potential bugs. 56 | 57 | Example: 58 | 59 | > Short and descriptive example bug report title 60 | > 61 | > A summary of the issue and the Visual Studio, browser, OS environments 62 | > in which it occurs. If suitable, include the steps required to reproduce the bug. 63 | > 64 | > 1. This is the first step 65 | > 2. This is the second step 66 | > 3. Further steps, etc. 67 | > 68 | > `` - a link to the project/file uploaded on cloud storage or other publicly accessible medium. 69 | > 70 | > Any other information you want to share that is relevant to the issue being 71 | > reported. This might include the lines of code that you have identified as 72 | > causing the bug, and potential solutions (and your opinions on their 73 | > merits). 74 | 75 | 76 | ## Feature requests 77 | 78 | Feature requests are welcome. But take a moment to find out whether your idea 79 | fits with the scope and aims of the project. It's up to *you* to make a strong 80 | case to convince the project's developers of the merits of this feature. Please 81 | provide as much detail and context as possible. 82 | 83 | 84 | ## Pull requests 85 | 86 | Good pull requests, patches, improvements and new features are a fantastic 87 | help. They should remain focused in scope and avoid containing unrelated 88 | commits. 89 | 90 | **Please ask first** before embarking on any significant pull request (e.g. 91 | implementing features, refactoring code, porting to a different language), 92 | otherwise you risk spending a lot of time working on something that the 93 | project's developers might not want to merge into the project. 94 | 95 | Please adhere to the [coding guidelines](#code-guidelines) used throughout the 96 | project (indentation, accurate comments, etc.) and any other requirements 97 | (such as test coverage). 98 | 99 | Adhering to the following process is the best way to get your work 100 | included in the project: 101 | 102 | 1. [Fork](http://help.github.com/fork-a-repo/) the project, clone your fork, 103 | and configure the remotes: 104 | 105 | ```bash 106 | # Clone your fork of the repo into the current directory 107 | git clone https://github.com//.git 108 | # Navigate to the newly cloned directory 109 | cd 110 | # Assign the original repo to a remote called "upstream" 111 | git remote add upstream https://github.com/madskristensen/.git 112 | ``` 113 | 114 | 2. If you cloned a while ago, get the latest changes from upstream: 115 | 116 | ```bash 117 | git checkout master 118 | git pull upstream master 119 | ``` 120 | 121 | 3. Create a new topic branch (off the main project development branch) to 122 | contain your feature, change, or fix: 123 | 124 | ```bash 125 | git checkout -b 126 | ``` 127 | 128 | 4. Commit your changes in logical chunks. Please adhere to these [git commit 129 | message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) 130 | or your code is unlikely be merged into the main project. Use Git's 131 | [interactive rebase](https://help.github.com/articles/interactive-rebase) 132 | feature to tidy up your commits before making them public. Also, prepend name of the feature 133 | to the commit message. For instance: "SCSS: Fixes compiler results for IFileListener.\nFixes `#123`" 134 | 135 | 5. Locally merge (or rebase) the upstream development branch into your topic branch: 136 | 137 | ```bash 138 | git pull [--rebase] upstream master 139 | ``` 140 | 141 | 6. Push your topic branch up to your fork: 142 | 143 | ```bash 144 | git push origin 145 | ``` 146 | 147 | 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/) 148 | with a clear title and description against the `master` branch. 149 | 150 | 151 | ## Code guidelines 152 | 153 | - Always use proper indentation. 154 | - In Visual Studio under `Tools > Options > Text Editor > C# > Advanced`, make sure 155 | `Place 'System' directives first when sorting usings` option is enabled (checked). 156 | - Before committing, organize usings for each updated C# source file. Either you can 157 | right-click editor and select `Organize Usings > Remove and sort` OR use extension 158 | like [BatchFormat](https://marketplace.visualstudio.com/items?itemName=vs-publisher-147549.BatchFormat). 159 | - Before committing, run Code Analysis in `Debug` configuration and follow the guidelines 160 | to fix CA issues. Code Analysis commits can be made separately. 161 | -------------------------------------------------------------------------------- /src/WorkspaceFiles.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) 5 | preview 6 | 7 | 8 | 9 | Debug 10 | AnyCPU 11 | 2.0 12 | {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 13 | {91446405-EABE-46D6-9EB9-505A14B74DE0} 14 | Library 15 | Properties 16 | WorkspaceFiles 17 | WorkspaceFiles 18 | v4.8 19 | true 20 | true 21 | true 22 | true 23 | false 24 | true 25 | true 26 | Program 27 | $(DevEnvDir)devenv.exe 28 | /rootsuffix Exp 29 | 30 | 31 | true 32 | full 33 | false 34 | bin\Debug\ 35 | DEBUG;TRACE 36 | prompt 37 | 4 38 | 39 | 40 | pdbonly 41 | true 42 | bin\Release\ 43 | TRACE 44 | prompt 45 | 4 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | True 74 | True 75 | source.extension.vsixmanifest 76 | 77 | 78 | True 79 | True 80 | VSCommandTable.vsct 81 | 82 | 83 | 84 | 85 | 86 | 87 | Designer 88 | VsixManifestGenerator 89 | source.extension.cs 90 | 91 | 92 | Resources\LICENSE.txt 93 | true 94 | Always 95 | 96 | 97 | PreserveNewest 98 | true 99 | 100 | 101 | 102 | 103 | Menus.ctmenu 104 | VsctGenerator 105 | VSCommandTable.cs 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | compile; build; native; contentfiles; analyzers; buildtransitive 121 | 122 | 123 | 3.0.2 124 | 125 | 126 | 9.0.4 127 | 128 | 129 | runtime; build; native; contentfiles; analyzers; buildtransitive 130 | all 131 | 132 | 133 | 134 | 135 | 142 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Build results 17 | [Dd]ebug/ 18 | [Dd]ebugPublic/ 19 | [Rr]elease/ 20 | [Rr]eleases/ 21 | x64/ 22 | x86/ 23 | [Aa][Rr][Mm]/ 24 | [Aa][Rr][Mm]64/ 25 | bld/ 26 | [Bb]in/ 27 | [Oo]bj/ 28 | [Ll]og/ 29 | 30 | # Visual Studio 2015/2017 cache/options directory 31 | .vs/ 32 | # Uncomment if you have tasks that create the project's static files in wwwroot 33 | #wwwroot/ 34 | 35 | # Visual Studio 2017 auto generated files 36 | Generated\ Files/ 37 | 38 | # MSTest test Results 39 | [Tt]est[Rr]esult*/ 40 | [Bb]uild[Ll]og.* 41 | 42 | # NUNIT 43 | *.VisualState.xml 44 | TestResult.xml 45 | 46 | # Build Results of an ATL Project 47 | [Dd]ebugPS/ 48 | [Rr]eleasePS/ 49 | dlldata.c 50 | 51 | # Benchmark Results 52 | BenchmarkDotNet.Artifacts/ 53 | 54 | # .NET Core 55 | project.lock.json 56 | project.fragment.lock.json 57 | artifacts/ 58 | 59 | # StyleCop 60 | StyleCopReport.xml 61 | 62 | # Files built by Visual Studio 63 | *_i.c 64 | *_p.c 65 | *_h.h 66 | *.ilk 67 | *.meta 68 | *.obj 69 | *.iobj 70 | *.pch 71 | *.pdb 72 | *.ipdb 73 | *.pgc 74 | *.pgd 75 | *.rsp 76 | *.sbr 77 | *.tlb 78 | *.tli 79 | *.tlh 80 | *.tmp 81 | *.tmp_proj 82 | *_wpftmp.csproj 83 | *.log 84 | *.vspscc 85 | *.vssscc 86 | .builds 87 | *.pidb 88 | *.svclog 89 | *.scc 90 | 91 | # Chutzpah Test files 92 | _Chutzpah* 93 | 94 | # Visual C++ cache files 95 | ipch/ 96 | *.aps 97 | *.ncb 98 | *.opendb 99 | *.opensdf 100 | *.sdf 101 | *.cachefile 102 | *.VC.db 103 | *.VC.VC.opendb 104 | 105 | # Visual Studio profiler 106 | *.psess 107 | *.vsp 108 | *.vspx 109 | *.sap 110 | 111 | # Visual Studio Trace Files 112 | *.e2e 113 | 114 | # TFS 2012 Local Workspace 115 | $tf/ 116 | 117 | # Guidance Automation Toolkit 118 | *.gpState 119 | 120 | # ReSharper is a .NET coding add-in 121 | _ReSharper*/ 122 | *.[Rr]e[Ss]harper 123 | *.DotSettings.user 124 | 125 | # JustCode is a .NET coding add-in 126 | .JustCode 127 | 128 | # TeamCity is a build add-in 129 | _TeamCity* 130 | 131 | # DotCover is a Code Coverage Tool 132 | *.dotCover 133 | 134 | # AxoCover is a Code Coverage Tool 135 | .axoCover/* 136 | !.axoCover/settings.json 137 | 138 | # Visual Studio code coverage results 139 | *.coverage 140 | *.coveragexml 141 | 142 | # NCrunch 143 | _NCrunch_* 144 | .*crunch*.local.xml 145 | nCrunchTemp_* 146 | 147 | # MightyMoose 148 | *.mm.* 149 | AutoTest.Net/ 150 | 151 | # Web workbench (sass) 152 | .sass-cache/ 153 | 154 | # Installshield output folder 155 | [Ee]xpress/ 156 | 157 | # DocProject is a documentation generator add-in 158 | DocProject/buildhelp/ 159 | DocProject/Help/*.HxT 160 | DocProject/Help/*.HxC 161 | DocProject/Help/*.hhc 162 | DocProject/Help/*.hhk 163 | DocProject/Help/*.hhp 164 | DocProject/Help/Html2 165 | DocProject/Help/html 166 | 167 | # Click-Once directory 168 | publish/ 169 | 170 | # Publish Web Output 171 | *.[Pp]ublish.xml 172 | *.azurePubxml 173 | # Note: Comment the next line if you want to checkin your web deploy settings, 174 | # but database connection strings (with potential passwords) will be unencrypted 175 | *.pubxml 176 | *.publishproj 177 | 178 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 179 | # checkin your Azure Web App publish settings, but sensitive information contained 180 | # in these scripts will be unencrypted 181 | PublishScripts/ 182 | 183 | # NuGet Packages 184 | *.nupkg 185 | # The packages folder can be ignored because of Package Restore 186 | **/[Pp]ackages/* 187 | # except build/, which is used as an MSBuild target. 188 | !**/[Pp]ackages/build/ 189 | # Uncomment if necessary however generally it will be regenerated when needed 190 | #!**/[Pp]ackages/repositories.config 191 | # NuGet v3's project.json files produces more ignorable files 192 | *.nuget.props 193 | *.nuget.targets 194 | 195 | # Microsoft Azure Build Output 196 | csx/ 197 | *.build.csdef 198 | 199 | # Microsoft Azure Emulator 200 | ecf/ 201 | rcf/ 202 | 203 | # Windows Store app package directories and files 204 | AppPackages/ 205 | BundleArtifacts/ 206 | Package.StoreAssociation.xml 207 | _pkginfo.txt 208 | *.appx 209 | 210 | # Visual Studio cache files 211 | # files ending in .cache can be ignored 212 | *.[Cc]ache 213 | # but keep track of directories ending in .cache 214 | !?*.[Cc]ache/ 215 | 216 | # Others 217 | ClientBin/ 218 | ~$* 219 | *~ 220 | *.dbmdl 221 | *.dbproj.schemaview 222 | *.jfm 223 | *.pfx 224 | *.publishsettings 225 | orleans.codegen.cs 226 | 227 | # Including strong name files can present a security risk 228 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 229 | #*.snk 230 | 231 | # Since there are multiple workflows, uncomment next line to ignore bower_components 232 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 233 | #bower_components/ 234 | 235 | # RIA/Silverlight projects 236 | Generated_Code/ 237 | 238 | # Backup & report files from converting an old project file 239 | # to a newer Visual Studio version. Backup files are not needed, 240 | # because we have git ;-) 241 | _UpgradeReport_Files/ 242 | Backup*/ 243 | UpgradeLog*.XML 244 | UpgradeLog*.htm 245 | ServiceFabricBackup/ 246 | *.rptproj.bak 247 | 248 | # SQL Server files 249 | *.mdf 250 | *.ldf 251 | *.ndf 252 | 253 | # Business Intelligence projects 254 | *.rdl.data 255 | *.bim.layout 256 | *.bim_*.settings 257 | *.rptproj.rsuser 258 | *- Backup*.rdl 259 | 260 | # Microsoft Fakes 261 | FakesAssemblies/ 262 | 263 | # GhostDoc plugin setting file 264 | *.GhostDoc.xml 265 | 266 | # Node.js Tools for Visual Studio 267 | .ntvs_analysis.dat 268 | node_modules/ 269 | 270 | # Visual Studio 6 build log 271 | *.plg 272 | 273 | # Visual Studio 6 workspace options file 274 | *.opt 275 | 276 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 277 | *.vbw 278 | 279 | # Visual Studio LightSwitch build output 280 | **/*.HTMLClient/GeneratedArtifacts 281 | **/*.DesktopClient/GeneratedArtifacts 282 | **/*.DesktopClient/ModelManifest.xml 283 | **/*.Server/GeneratedArtifacts 284 | **/*.Server/ModelManifest.xml 285 | _Pvt_Extensions 286 | 287 | # Paket dependency manager 288 | .paket/paket.exe 289 | paket-files/ 290 | 291 | # FAKE - F# Make 292 | .fake/ 293 | 294 | # JetBrains Rider 295 | .idea/ 296 | *.sln.iml 297 | 298 | # CodeRush personal settings 299 | .cr/personal 300 | 301 | # Python Tools for Visual Studio (PTVS) 302 | __pycache__/ 303 | *.pyc 304 | 305 | # Cake - Uncomment if you are using it 306 | # tools/** 307 | # !tools/packages.config 308 | 309 | # Tabs Studio 310 | *.tss 311 | 312 | # Telerik's JustMock configuration file 313 | *.jmconfig 314 | 315 | # BizTalk build output 316 | *.btp.cs 317 | *.btm.cs 318 | *.odx.cs 319 | *.xsd.cs 320 | 321 | # OpenCover UI analysis results 322 | OpenCover/ 323 | 324 | # Azure Stream Analytics local run output 325 | ASALocalRun/ 326 | 327 | # MSBuild Binary and Structured Log 328 | *.binlog 329 | 330 | # NVidia Nsight GPU debugger configuration file 331 | *.nvuser 332 | 333 | # MFractors (Xamarin productivity tool) working folder 334 | .mfractor/ 335 | 336 | # Local History for Visual Studio 337 | .localhistory/ 338 | 339 | # BeatPulse healthcheck temp database 340 | healthchecksdb -------------------------------------------------------------------------------- /PERFORMANCE_OPTIMIZATIONS.md: -------------------------------------------------------------------------------- 1 | # Performance Optimizations for WorkspaceFiles Extension 2 | 3 | This document outlines the performance optimizations implemented to improve the responsiveness and efficiency of the WorkspaceFiles Visual Studio extension. 4 | 5 | ## Summary of Optimizations 6 | 7 | ### ?? HIGH IMPACT Optimizations (Critical Performance Improvements) 8 | 9 | #### 1. **Asynchronous Image Loading in Tooltips** ? **HIGHEST IMPACT** 10 | **File:** `src\MEF\WorkspaceItemNodeTooltip.cs` 11 | 12 | **Problem:** Image tooltips were loading synchronously on the UI thread, causing Visual Studio to freeze when hovering over large images. 13 | 14 | **Solution:** 15 | - Load images asynchronously on background thread 16 | - Use `BitmapCreateOptions.IgnoreColorProfile` for faster loading 17 | - Freeze bitmap for thread-safe UI access 18 | - Graceful error handling for corrupted/inaccessible images 19 | 20 | **Impact:** Eliminates UI freezing when hovering over image files in the file explorer. 21 | 22 | #### 2. **Icon Caching and Service Optimization** ? **HIGH IMPACT** 23 | **File:** `src\IconMapper.cs` 24 | 25 | **Problem:** Icon resolution was expensive due to repeated Visual Studio service calls, string operations, and no caching mechanism. 26 | 27 | **Solution:** 28 | - Added `ConcurrentDictionary` caches for file and directory icons 29 | - Lazy initialization of `IVsImageService2` to avoid repeated service lookups 30 | - Pre-computed dictionary of special directory mappings for O(1) lookups 31 | - Use file extensions as cache keys for better cache efficiency 32 | - Eliminated repeated `ToLowerInvariant()` calls through caching 33 | 34 | **Impact:** Dramatically reduces icon resolution time, especially for large directory trees. Eliminates repeated expensive service calls and string operations. 35 | 36 | #### 3. **Optimized Directory Enumeration and File System Operations** ? **NEW HIGH IMPACT** 37 | **File:** `src\MEF\WorkspaceItemNode.cs` 38 | 39 | **Problem:** Directory enumeration used `GetFileSystemEntries()` which creates arrays and doesn't support lazy loading, causing performance issues with large directories. 40 | 41 | **Solution:** 42 | - Replaced `Directory.GetFileSystemEntries()` with `DirectoryInfo.EnumerateFileSystemInfos()` for lazy enumeration 43 | - Added early filtering using span-based system file detection to reduce memory allocations 44 | - Pre-compiled comparison delegate for faster sorting operations 45 | - Eliminated redundant `File.Exists()`/`Directory.Exists()` calls by using `FileSystemInfo` directly 46 | - Added graceful handling of access denied and directory not found exceptions 47 | 48 | **Impact:** Significantly faster directory loading, especially for large directories (>1000 files). Reduces memory pressure through lazy enumeration and span-based filtering. 49 | 50 | #### 4. **Optimized File System Watcher Configuration** 51 | **File:** `src\MEF\WorkspaceItemNode.cs` 52 | 53 | **Problem:** File system watchers were using default settings which could cause performance issues with large directories. 54 | 55 | **Solution:** 56 | - Set `IncludeSubdirectories = false` to only watch immediate children 57 | - Optimized `NotifyFilter` to only essential events 58 | - Increased `InternalBufferSize` to 32KB to handle rapid file changes 59 | - Enhanced filtering with span-based path checking to reduce string allocations 60 | - Fast rejection of system paths using `ReadOnlySpan` 61 | 62 | **Impact:** Significantly reduces unnecessary file system events and improves responsiveness during active development. Eliminates string allocations in file system event filtering. 63 | 64 | ### ?? MEDIUM IMPACT Optimizations 65 | 66 | #### 5. **Git Repository Root Caching** 67 | **File:** `src\MEF\WorkspaceRootNode.cs` 68 | 69 | **Problem:** Git repository root discovery was traversing directory tree on every call. 70 | 71 | **Solution:** 72 | - Added `ConcurrentDictionary` cache for Git root paths 73 | - Cache both positive and negative results 74 | - Thread-safe implementation for concurrent access 75 | 76 | **Impact:** Eliminates repeated directory traversals when determining workspace roots. 77 | 78 | #### 6. **GitIgnore File Caching** ? **NEW MEDIUM IMPACT** 79 | **File:** `src\MEF\WorkspaceRootNode.cs` 80 | 81 | **Problem:** `.gitignore` files were being read from disk repeatedly during directory traversals. 82 | 83 | **Solution:** 84 | - Added `ConcurrentDictionary` cache for loaded `.gitignore` files 85 | - Implemented negative caching for directories without `.gitignore` files 86 | - Graceful error handling for inaccessible files 87 | - Cache clearing method for memory management 88 | 89 | **Impact:** Reduces file system I/O operations when determining which files to ignore. Particularly beneficial in large repositories with complex directory structures. 90 | 91 | #### 7. **Controller Instance Caching** ? **NEW MEDIUM IMPACT** 92 | **File:** `src\MEF\WorkspaceItemNode.cs` 93 | 94 | **Problem:** Context menu, invocation, and drag-drop controllers were being instantiated for every node access. 95 | 96 | **Solution:** 97 | - Static caching of controller instances shared across all nodes 98 | - Eliminated repeated object allocations for stateless controllers 99 | 100 | **Impact:** Reduces memory allocations and garbage collection pressure, especially when dealing with large directory trees. 101 | 102 | #### 8. **Improved Collection Operations** 103 | **File:** `src\MEF\WorkspaceItemNode.cs` 104 | 105 | **Problem:** Inefficient dictionary lookups and sorting algorithms. 106 | 107 | **Solution:** 108 | - Use `TryGetValue()` instead of `ContainsKey()` + indexer access 109 | - Optimized sorting algorithm to avoid repeated type checks 110 | - Early exit when no changes are needed in refresh operations 111 | 112 | **Impact:** Faster collection updates and reduced CPU usage during file system changes. 113 | 114 | #### 9. **Enhanced Duplicate Detection** 115 | **File:** `src\MEF\WorkspaceRootNode.cs` 116 | 117 | **Solution:** 118 | - Replace LINQ `FirstOrDefault()` with `HashSet` for O(1) duplicate checking 119 | - Optimized pattern setup to avoid unnecessary LINQ operations 120 | 121 | **Impact:** Faster workspace initialization and reduced memory allocations. 122 | 123 | ### ?? LOW IMPACT Optimizations 124 | 125 | #### 10. **Improved Error Handling in Debouncer** 126 | **File:** `src\Debouncer.cs` 127 | 128 | **Problem:** Unhandled exceptions in background tasks could cause issues. 129 | 130 | **Solution:** 131 | - Added try-catch blocks around action execution 132 | - Ensured proper cleanup of cancellation tokens 133 | - Log errors instead of letting them propagate 134 | 135 | **Impact:** More stable background operations and better resource cleanup. 136 | 137 | ## Performance Testing Recommendations 138 | 139 | To validate these optimizations, consider testing: 140 | 141 | 1. **Directory Enumeration Performance:** 142 | - Test with directories containing >10,000 files 143 | - Measure time to expand large directory nodes 144 | - Verify memory usage stays constant during enumeration 145 | - Test with nested directory structures 146 | 147 | 2. **Icon Resolution Performance:** 148 | - Navigate through large directory trees (>1000 files) 149 | - Test repeated expansion/collapse of the same directories 150 | - Verify icons load instantly on subsequent access 151 | - Monitor memory usage for icon caches 152 | 153 | 3. **GitIgnore Processing Performance:** 154 | - Test with repositories having complex `.gitignore` hierarchies 155 | - Measure file filtering performance in large directories 156 | - Verify cache effectiveness with repeated operations 157 | 158 | 4. **Image Tooltip Performance:** 159 | - Hover over large image files (>5MB) in different formats 160 | - Test with multiple images in quick succession 161 | - Verify no UI freezing occurs 162 | 163 | 5. **File System Responsiveness:** 164 | - Create/delete multiple files rapidly in watched directories 165 | - Test with large directories (>1000 files) 166 | - Verify smooth scrolling and expansion of directory nodes 167 | 168 | 6. **Memory Usage:** 169 | - Monitor memory consumption during extended use 170 | - Check for memory leaks in file system watchers and caches 171 | - Verify proper disposal of resources 172 | - Test cache clearing mechanisms 173 | 174 | 7. **Large Repository Performance:** 175 | - Test with repositories containing >10,000 files 176 | - Test workspace initialization time 177 | - Verify Git root detection speed 178 | 179 | ## Implementation Notes 180 | 181 | ### Thread Safety 182 | - All background operations properly switch between UI and background threads 183 | - Concurrent collections used where appropriate 184 | - Proper disposal patterns maintained 185 | 186 | ### Memory Management 187 | - Span-based string operations to reduce allocations 188 | - Lazy enumeration to handle large directories efficiently 189 | - Cache clearing mechanisms for memory-conscious scenarios 190 | - Shared controller instances to reduce object creation 191 | 192 | ### Backward Compatibility 193 | - All optimizations maintain existing API contracts 194 | - No breaking changes to public interfaces 195 | - Graceful degradation for error scenarios 196 | 197 | ### Resource Management 198 | - Improved disposal patterns for file system watchers 199 | - Better cleanup of cancellation tokens 200 | - Reduced memory allocations in hot paths 201 | - Cache management for long-running sessions 202 | 203 | ## Monitoring and Metrics 204 | 205 | Consider adding performance counters for: 206 | - Directory enumeration times and file counts 207 | - Icon cache hit rates and memory usage 208 | - GitIgnore cache effectiveness 209 | - File system event processing time 210 | - Image loading duration 211 | - Memory usage patterns and allocation rates 212 | 213 | ## Future Optimization Opportunities 214 | 215 | 1. **Background Indexing:** Pre-cache file system information in background threads 216 | 2. **Virtual Scrolling:** For very large directories, implement virtualization in the UI 217 | 3. **Smart Filtering:** Use file extension patterns to pre-filter during enumeration 218 | 4. **Icon Preloading:** Preload common icons during extension initialization 219 | 5. **Incremental Updates:** Only refresh changed portions of directory trees 220 | 6. **Compression:** Compress cached data for memory efficiency in large repositories 221 | 222 | --- 223 | 224 | **Total Impact:** These optimizations provide dramatically improved responsiveness, especially in large codebases with thousands of files. Directory enumeration is now lazy and memory-efficient, icon resolution is cached for instant access, and file system operations are optimized to minimize I/O. The extension should remain responsive even in repositories with >10,000 files. -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Mads Kristensen 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /src/VSCommandTable.vsct: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | Workspace context menu 14 | This is a test 15 | 16 | 17 | 18 | 19 | Workspace context menu 20 | 21 | 22 | 23 | 24 | Workspace context menu 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 75 | 76 | 85 | 86 | 95 | 96 | 105 | 106 | 115 | 116 | 125 | 126 | 135 | 136 | 148 | 149 | 158 | 167 | 168 | 177 | 178 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | --------------------------------------------------------------------------------