Skip to content

Commit b235330

Browse files
committed
1.8.0.0
1 parent 0e725f2 commit b235330

File tree

71 files changed

+2165
-452
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+2165
-452
lines changed

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# File-scoped namespace declarations
2+
dotnet_diagnostic.IDE0161.severity = refactoring
3+
csharp_style_namespace_declarations = file_scoped
4+
# Sort using and Import directives with System.* appearing first
5+
dotnet_sort_system_directives_first = true
6+
dotnet_separate_import_directive_groups = false
7+
dotnet_style_namespace_match_folder = true
8+
dotnet_diagnostic.IDE0130.severity = warning

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"[csharp]": {
3+
"editor.defaultFormatter": "ms-dotnettools.csharp",
4+
"editor.codeActionsOnSave": ["source.organizeImports", "source.fixAll"]
5+
},
6+
}

Assets/screenshot1.png

-32.1 KB
Loading

Assets/screenshot2.png

-4.04 KB
Loading

GUIDE.md

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Project Guide: Workspace Launcher for VS Code
1+
# Project Guide: Workspace Launcher for Visual Studio & VS Code
22

33
This document provides an overview of the project's architecture, focusing on its design principles and key components.
44

@@ -8,31 +8,39 @@ The extension is designed following SOLID principles to ensure it is maintainabl
88

99
### Key Principles
1010

11-
* **Single Responsibility Principle (SRP):** Each class has a single, well-defined responsibility. This is exemplified by the service layer, where responsibilities are highly granular. For instance, `VisualStudioCodeInstanceProvider` is solely responsible for discovering Visual Studio Code installations. `VisualStudioCodeWorkspaceProvider` orchestrates workspace discovery, which is further delegated to specialized reader classes like `VscdbWorkspaceReader` and `StorageJsonWorkspaceReader`, each handling a specific data source.
11+
* **Single Responsibility Principle (SRP):** Each class has a single, well-defined responsibility. This is exemplified by the service layer, where responsibilities are highly granular. For instance, `VisualStudioCodeInstanceProvider` is solely responsible for discovering Visual Studio Code installations, while `VisualStudioProvider` is responsible for discovering Visual Studio solutions.
1212
* **Dependency Inversion Principle (DIP):** High-level modules do not depend on low-level modules; both depend on abstractions. This is achieved through the use of interfaces like `IVisualStudioCodeService`. The `WorkspaceLauncherForVSCodeCommandsProvider` and `VisualStudioCodePage` depend on the `IVisualStudioCodeService` interface, not the concrete `VisualStudioCodeService` implementation. This decoupling allows for easier testing and maintenance.
1313

1414
## Project Structure
1515

16-
The project is organized into the following key directories within the `VisualStudioCode` project:
16+
The project is organized into the following key directories within the `WorkspaceLauncherForVSCode` project:
1717

1818
- **`/`**:
1919
- [`WorkspaceLauncherForVSCode.cs`](./WorkspaceLauncherForVSCode.cs) - The main extension implementation.
2020
- **`/Classes`**: Contains core data models and helper classes.
2121
- [`SettingsManager.cs`](./Classes/SettingsManager.cs) - Manages user-configurable settings.
2222
- `VisualStudioCodeInstance.cs`, `VisualStudioCodeWorkspace.cs` - Core data models.
2323
- **`/Commands`**: Contains command implementations that are executed by the user.
24-
- `OpenVisualStudioCodeCommand.cs` - The primary command for launching a selected workspace.
25-
- `CopyPathCommand.cs` - Copies the workspace path to the clipboard.
24+
- `OpenVisualStudioCodeCommand.cs` - The primary command for launching a selected VS Code workspace.
25+
- `OpenSolutionCommand.cs` - The primary command for launching a selected Visual Studio solution.
26+
- `CopyPathCommand.cs` - Copies the workspace or solution path to the clipboard.
2627
- `RemoveWorkspaceCommand.cs` - Removes a workspace from the recently opened list.
28+
- **`/Components`**: Contains components for window management, adapted from the WindowWalker extension.
29+
- `Window.cs` - Represents a single open window.
30+
- `WindowProcess.cs` - Manages process information for a window.
31+
- `OpenWindows.cs` - Manages the collection of open windows.
32+
- **`/Helpers`**: Contains helper classes, including `NativeMethods.cs` for P/Invoke signatures.
2733
- **`/Interfaces`**: Defines the contracts for services.
28-
- `IVisualStudioCodeService.cs` - The contract for the main Visual Studio Code service.
34+
- `IVisualStudioCodeService.cs` - The contract for the main service.
2935
- **`/Pages`**: Contains UI components.
30-
- [`VisualStudioCodePage.cs`](./Pages/VisualStudioCodePage.cs) - A dynamic list page that displays discovered workspaces.
36+
- [`VisualStudioCodePage.cs`](./Pages/VisualStudioCodePage.cs) - A dynamic list page that displays discovered workspaces and solutions.
3137
- **`/Services`**: Contains the primary service implementations.
3238
- [`WorkspaceLauncherForVSCodeCommandsProvider.cs`](./Services/WorkspaceLauncherForVSCodeCommandsProvider.cs) - The entry point for providing commands to the Command Palette.
3339
- [`VisualStudioCodeService.cs`](./Services/VisualStudioCodeService.cs) - Acts as a facade, orchestrating calls to more specialized provider classes.
3440
- [`VisualStudioCodeInstanceProvider.cs`](./Services/VisualStudioCodeInstanceProvider.cs) - Discovers all installed instances of Visual Studio Code.
35-
- [`VisualStudioCodeWorkspaceProvider.cs`](./Services/VisualStudioCodeWorkspaceProvider.cs) - Orchestrates the process of finding recent workspaces.
41+
- [`VisualStudioCodeWorkspaceProvider.cs`](./Services/VisualStudioCodeWorkspaceProvider.cs) - Orchestrates the process of finding recent VS Code workspaces.
42+
- [`VisualStudioProvider.cs`](./Services/VisualStudioProvider.cs) - Orchestrates the process of finding recent Visual Studio solutions.
43+
- **`/Services/VisualStudio`**: Contains the integrated source code for discovering Visual Studio instances and their recent items.
3644
- **`/Workspaces`**: Contains workspace-related logic.
3745
- **`/Models`**: C# models that map to the JSON structures of Visual Studio Code's workspace storage.
3846
- **`/Readers`**: Specialized classes for reading and parsing workspace data.
@@ -41,11 +49,29 @@ The project is organized into the following key directories within the `VisualSt
4149

4250
## Core Components
4351

52+
### WindowWalker Integration
53+
54+
The extension integrates logic from the **WindowWalker** extension to provide window-switching functionality. When a user attempts to open a Visual Studio solution, the extension first checks if that solution is already open in an existing Visual Studio instance.
55+
56+
- The `OpenWindows` class enumerates all open windows on the system.
57+
- The `Window` and `WindowProcess` classes gather information about each window, including its title and process name.
58+
- The `OpenSolutionCommand` checks the titles of open `devenv.exe` processes to see if the solution is already open. If a match is found, the extension switches to that window instead of launching a new process.
59+
4460
### Services and Providers
4561

46-
* **`IVisualStudioCodeService` / `VisualStudioCodeService`**: This service acts as the primary entry point for interacting with local Visual Studio Code data. It delegates the complex tasks of instance and workspace discovery to specialized provider classes.
62+
* **`IVisualStudioCodeService` / `VisualStudioCodeService`**: This service acts as the primary entry point for interacting with local Visual Studio and Visual Studio Code data. It delegates the complex tasks of instance and workspace/solution discovery to specialized provider classes.
4763
* **`VisualStudioCodeInstanceProvider`**: A static provider class responsible for discovering all installed instances of Visual Studio Code (Stable, Insiders, User, System) by scanning known locations and the system's PATH environment variable.
48-
* **`VisualStudioCodeWorkspaceProvider`**: This static provider orchestrates the process of finding recently opened workspaces. It doesn't perform the reading itself but delegates the task to specialized reader classes.
64+
* **`VisualStudioCodeWorkspaceProvider`**: This static provider orchestrates the process of finding recently opened VS Code workspaces. It doesn't perform the reading itself but delegates the task to specialized reader classes.
65+
* **`VisualStudioProvider`**: This static provider orchestrates the process of finding recently opened Visual Studio solutions. It uses the integrated `VisualStudioService` to discover Visual Studio instances and their recent items.
66+
67+
### Visual Studio Integration
68+
69+
The extension now includes the core logic from the `PowerToys-Run-VisualStudio` project to discover Visual Studio installations and their recent solutions. This is accomplished by:
70+
1. Using `vswhere.exe` to find all Visual Studio installations on the system.
71+
2. Parsing the `ApplicationPrivateSettings.xml` file for each installation to find the location of the `CodeContainers.json` file.
72+
3. Reading and deserializing the `CodeContainers.json` file to get a list of recent solutions.
73+
74+
This integration provides a seamless experience, allowing users to access both Visual Studio solutions and VS Code workspaces from a single interface.
4975

5076
### Workspace Readers and Performance
5177

@@ -59,14 +85,14 @@ To ensure high performance and low memory usage, the extension uses the `System.
5985

6086
### UI and Commands
6187

62-
* **`WorkspaceLauncherForVSCodeCommandsProvider`**: The main entry point for providing commands to the Command Palette. It initializes the required services (`SettingsManager`, `VisualStudioCodeService`) and creates the top-level command items. It also listens for settings changes to reload Visual Studio Code instances when necessary.
63-
* **`VisualStudioCodePage`**: A dynamic list page that displays the discovered Visual Studio Code workspaces. It receives the `IVisualStudioCodeService` to fetch workspace data asynchronously and handles user interactions like searching and scrolling.
64-
* **`OpenVisualStudioCodeCommand`**: The primary command responsible for launching a selected Visual Studio Code workspace.
88+
* **`WorkspaceLauncherForVSCodeCommandsProvider`**: The main entry point for providing commands to the Command Palette. It initializes the required services and creates the top-level command items.
89+
* **`VisualStudioCodePage`**: A dynamic list page that displays the discovered workspaces and solutions. It receives the `IVisualStudioCodeService` to fetch data asynchronously and handles user interactions like searching and scrolling.
90+
* **`OpenVisualStudioCodeCommand` & `OpenSolutionCommand`**: The primary commands responsible for launching a selected VS Code workspace or Visual Studio solution.
6591

6692
#### Secondary Commands
67-
Beyond the primary action of opening a workspace, the extension provides secondary commands for managing the workspace list:
93+
Beyond the primary action of opening a workspace or solution, the extension provides secondary commands for managing the list:
6894

69-
* **`CopyPathCommand`**: This command allows the user to copy the full file path of a workspace or folder directly to the clipboard, providing a quick way to access the location of the project.
70-
* **`RemoveWorkspaceCommand`**: This command provides the functionality to remove a workspace or folder entry from the Visual Studio Code's list of recently opened items. It first presents a confirmation dialog to prevent accidental removals. The command directly modifies the `state.vscdb` or `storage.json` files where VS Code stores this information.
95+
* **`CopyPathCommand`**: This command allows the user to copy the full file path of a workspace, solution, or folder directly to the clipboard.
96+
* **`RemoveWorkspaceCommand`**: This command provides the functionality to remove a workspace entry from the Visual Studio Code's list of recently opened items (not applicable to Visual Studio solutions).
7197

7298
This architecture ensures a clean separation of concerns, making the codebase easier to understand, extend, and debug.

LICENSE.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
MIT License
22

3+
Copyright (c) 2025 Davide Giacometti
34
Copyright (c) 2025 Jonah Fintz
45
Copyright (c) 2025 tanchekwei
6+
Copyright (c) 2020 Betsegaw Tadele
7+
Copyright (c) 2025 Microsoft Corporation
58

69
Permission is hereby granted, free of charge, to any person obtaining a copy
710
of this software and associated documentation files (the "Software"), to deal

NOTICE

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
**Copyright and Notices**
2+
3+
This software is made possible by the contributions of its developers and the open-source projects it is built upon.
4+
5+
Copyright © 2025 tanchekwei
6+
7+
The following copyrights are acknowledged for the respective components and adaptations included in this software:
8+
9+
* Copyright © 2025 Jonah Fintz
10+
* Copyright © 2025 Davide Giacometti
11+
* Copyright © 2020 Betsegaw Tadele
12+
* Copyright © 2025 Microsoft Corporation
13+
14+
---
15+
16+
**Third-Party Acknowledgements**
17+
18+
This extension adapts and combines functionality from the following open-source projects. I acknowledge and appreciate the availability of their work under open-source licenses:
19+
20+
* CommandPaletteVSCode by Jonah Fintz
21+
Source: [https://github.com/JonahFintzDev/CommandPaletteVSCode](https://github.com/JonahFintzDev/CommandPaletteVSCode)
22+
23+
* PowerToys-Run-VisualStudio by Davide Giacometti
24+
Source: [https://github.com/davidegiacometti/PowerToys-Run-VisualStudio](https://github.com/davidegiacometti/PowerToys-Run-VisualStudio)
25+
26+
* VisualStudioExtension by Davide Giacometti
27+
Source: [https://github.com/davidegiacometti/CmdPal-Extensions/tree/main/src/VisualStudioExtension](https://github.com/davidegiacometti/CmdPal-Extensions/tree/main/src/VisualStudioExtension)
28+
29+
* Window Walker PowerToys Command Palette Extension, based on the original work by Betsegaw Tadele and integrated into the Microsoft PowerToys
30+
Source: [https://github.com/microsoft/PowerToys/tree/main/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker](https://github.com/microsoft/PowerToys/tree/main/src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.WindowWalker)
31+
32+
All third-party components are used in accordance with their original licensing terms. Please visit the source repositories for more information.

README.md

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,23 @@
1-
# Workspace Launcher for VS Code
1+
# Workspace Launcher for Visual Studio / Code
22

33
## Overview
44

5-
This project provides a command palette extension for opening Visual Studio Code workspaces.
5+
This project provides a command palette extension for opening Visual Studio solutions and Visual Studio Code workspaces from a single, unified interface.
66

7-
![Workspace Launcher for VS Code](./Assets/screenshot1.png)
8-
9-
## Replacing PowerToys Run
10-
Suggested usage to replace PowerToys Run with this extension:
11-
12-
1. Open the Command Palette settings > Extensions > Workspace Launcher for VS Code.
13-
2. Assign **Alt + Space** as the global hotkey (requires disabling PowerToys Run) or assign `{` as an alias with Direct toggled.
14-
15-
![Replacing PowerToys Run](./Assets/screenshot2.png)
7+
![Workspace Launcher for Visual Studio / Code](./Assets/screenshot1.png)
168

179
## Features
1810

11+
- **Unified Launcher**: Launch both Visual Studio solutions and Visual Studio Code workspaces from a single, convenient interface.
12+
- **Window-Switching**: If a Visual Studio solution is already open, the extension will switch to the existing window instead of opening a new instance.
1913
- **Workspace Management**: Retrieve and display a list of available workspaces, including their paths and types (e.g., Local, WSL, Remote).
20-
- **Command Execution**: Open workspaces in Visual Studio Code using a dedicated command.
21-
- **Multi-Installation Support**: Works for multiple installations of Visual Studio Code, including Insider and system installations.
22-
- **Secondary Actions**: Access additional commands for each workspace entry:
23-
- **Copy Path**: Copies the full file path of the workspace or folder to the clipboard.
24-
- **Remove from List**: Removes the workspace entry from Visual Studio Code's list of recently opened projects. A confirmation is required to prevent accidental removal.
25-
- **Open in Explorer**: Opens the workspace or folder location in the default file explorer.
26-
- **Refresh Workspaces**: Manually reloads the list of workspaces to reflect any recent changes.
14+
- **Command Execution**: Open solutions in Visual Studio and workspaces in Visual Studio Code using dedicated commands.
15+
- **Multi-Installation Support**: Works for multiple installations of Visual Studio and Visual Studio Code, including Insider and system installations.
16+
- **Secondary Actions**: Access additional commands for each entry:
17+
- **Copy Path**: Copies the full file path of the solution, workspace, or folder to the clipboard.
18+
- **Remove from List**: Removes the workspace entry from Visual Studio Code's list of recently opened projects (not available for Visual Studio solutions).
19+
- **Open in Explorer**: Opens the solution, workspace, or folder location in the default file explorer.
20+
- **Refresh Workspaces**: Manually reloads the list of solutions and workspaces to reflect any recent changes.
2721

2822
## Installation
2923

@@ -39,7 +33,7 @@ Suggested usage to replace PowerToys Run with this extension:
3933
### Via Command Palette
4034

4135
1. Open Command Palette
42-
2. Select "Workspace Launcher for VS Code"
36+
2. Select "Workspace Launcher for Visual Studio / Code"
4337

4438
<!-- ### Via Winget
4539
@@ -49,11 +43,20 @@ Suggested usage to replace PowerToys Run with this extension:
4943
winget install 15722UsefulApp.WorkspaceLauncherForVSCode
5044
```
5145
-->
46+
5247
### Manual Installation
5348

5449
1. Make sure you use the latest version of PowerToys.
5550
2. Install the application by double-clicking the `.msix` file.
5651

52+
## Replacing PowerToys Run
53+
Suggested usage to replace PowerToys Run with this extension:
54+
55+
1. Open the Command Palette settings > Extensions > Workspace Launcher for Visual Studio / Code.
56+
2. Assign **Alt + Space** as the global hotkey (requires disabling PowerToys Run) or assign `{` as an alias with Direct toggled.
57+
58+
![Replacing PowerToys Run](./Assets/screenshot2.png)
59+
5760
## Settings
5861

5962
- **Preferred Edition**: Determines which edition (Default or Insider) is used when a folder or workspace has been opened in both editions of Visual Studio Code.
@@ -67,7 +70,12 @@ Suggested usage to replace PowerToys Run with this extension:
6770

6871
## How It Works
6972

70-
This extension scans for installations of Visual Studio Code on your system, including stable, Insiders, and system-wide installations. It then reads the workspace history from Visual Studio Code's internal storage files (`state.vscdb` and `storage.json`) to populate the list of recent workspaces.
73+
This extension discovers installations of Visual Studio and Visual Studio Code on your system.
74+
- For **Visual Studio Code**, it reads the workspace history from the internal storage files (`state.vscdb` and `storage.json`).
75+
- For **Visual Studio**, it uses `vswhere.exe` to find installations and then reads their configuration files to discover recent solutions.
76+
- The extension also includes logic from the **WindowWalker** extension to detect if a solution is already open. If so, it switches to the existing Visual Studio window instead of creating a new one.
77+
78+
The results are then combined into a single, unified list for easy access.
7179

7280
For more detailed technical information about the project's architecture and components, please see the [Project Guide](./GUIDE.md).
7381

0 commit comments

Comments
 (0)