Skip to content

Commit d465fa2

Browse files
committed
1.7.1.0
1 parent a263627 commit d465fa2

File tree

79 files changed

+2445
-945
lines changed

Some content is hidden

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

79 files changed

+2445
-945
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 1 deletion
This file was deleted.

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ artifacts/
6666
# ASP.NET Scaffolding
6767
ScaffoldingReadMe.txt
6868

69-
# StyleCop
70-
StyleCopReport.xml
71-
7269
# Files built by Visual Studio
7370
*_i.c
7471
*_p.c
@@ -355,7 +352,7 @@ healthchecksdb
355352
# Backup folder for Package Reference Convert tool in Visual Studio 2017
356353
MigrationBackup/
357354

358-
# Ionide (cross platform F# VS Code tools) working folder
355+
# Ionide (cross platform F# Visual Studio Code tools) working folder
359356
.ionide/
360357

361358
# Fody - auto-generated XML schema

Assets/screenshot1.png

113 KB
Loading

Assets/screenshot2.png

134 KB
Loading

Directory.Packages.props

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,9 @@
44
</PropertyGroup>
55
<ItemGroup>
66
<PackageVersion Include="Microsoft.CommandPalette.Extensions" Version="0.1.0" />
7-
<PackageVersion Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="9.0.0-preview.24508.2" />
87
<PackageVersion Include="Microsoft.Data.Sqlite" Version="9.0.4" />
9-
<PackageVersion Include="Microsoft.Web.WebView2" Version="1.0.2903.40" />
10-
<PackageVersion Include="Microsoft.Windows.CsWin32" Version="0.2.46-beta" />
11-
<PackageVersion Include="Microsoft.Windows.CsWinRT" Version="2.2.0" />
128
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
139
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.6.250205002" />
14-
<PackageVersion Include="Shmuelie.WinRTServer" Version="2.1.1" />
15-
<PackageVersion Include="StyleCop.Analyzers" Version="1.2.0-beta.556" />
1610
<PackageVersion Include="System.Text.Json" Version="9.0.3" />
1711
</ItemGroup>
1812
</Project>

GUIDE.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Project Guide: Workspace Launcher for VS Code
2+
3+
This document provides an overview of the project's architecture, focusing on its design principles and key components.
4+
5+
## Architecture Overview
6+
7+
The extension is designed following SOLID principles to ensure it is maintainable, scalable, and testable.
8+
9+
### Key Principles
10+
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.
12+
* **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.
13+
14+
## Project Structure
15+
16+
The project is organized into the following key directories within the `VisualStudioCode` project:
17+
18+
- **`/`**:
19+
- [`WorkspaceLauncherForVSCode.cs`](./WorkspaceLauncherForVSCode.cs) - The main extension implementation.
20+
- **`/Classes`**: Contains core data models and helper classes.
21+
- [`SettingsManager.cs`](./Classes/SettingsManager.cs) - Manages user-configurable settings.
22+
- `VisualStudioCodeInstance.cs`, `VisualStudioCodeWorkspace.cs` - Core data models.
23+
- **`/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.
26+
- `RemoveWorkspaceCommand.cs` - Removes a workspace from the recently opened list.
27+
- **`/Interfaces`**: Defines the contracts for services.
28+
- `IVisualStudioCodeService.cs` - The contract for the main Visual Studio Code service.
29+
- **`/Pages`**: Contains UI components.
30+
- [`VisualStudioCodePage.cs`](./Pages/VisualStudioCodePage.cs) - A dynamic list page that displays discovered workspaces.
31+
- **`/Services`**: Contains the primary service implementations.
32+
- [`WorkspaceLauncherForVSCodeCommandsProvider.cs`](./Services/WorkspaceLauncherForVSCodeCommandsProvider.cs) - The entry point for providing commands to the Command Palette.
33+
- [`VisualStudioCodeService.cs`](./Services/VisualStudioCodeService.cs) - Acts as a facade, orchestrating calls to more specialized provider classes.
34+
- [`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.
36+
- **`/Workspaces`**: Contains workspace-related logic.
37+
- **`/Models`**: C# models that map to the JSON structures of Visual Studio Code's workspace storage.
38+
- **`/Readers`**: Specialized classes for reading and parsing workspace data.
39+
- [`VscdbWorkspaceReader.cs`](./Workspaces/Readers/VscdbWorkspaceReader.cs) - Reads workspace data from the `state.vscdb` SQLite database.
40+
- [`StorageJsonWorkspaceReader.cs`](./Workspaces/Readers/StorageJsonWorkspaceReader.cs) - Reads workspace data from the `storage.json` file.
41+
42+
## Core Components
43+
44+
### Services and Providers
45+
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.
47+
* **`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.
49+
50+
### Workspace Readers and Performance
51+
52+
To ensure high performance and low memory usage, the extension uses the `System.Text.Json` source generator for deserializing workspace data. This avoids runtime reflection and minimizes allocations.
53+
54+
* **`VscdbWorkspaceReader` & `StorageJsonWorkspaceReader`**: These static reader classes are responsible for retrieving workspace information from Visual Studio Code's two primary data sources: the `state.vscdb` SQLite database and the `storage.json` file. Each reader is optimized to read its specific source and deserialize the data efficiently using source-generated models.
55+
56+
### Settings
57+
58+
* **`SettingsManager`**: Manages all user-configurable settings for the extension. It loads settings from a JSON file and provides them to the rest of the application. It raises an event when settings are changed, allowing other components to react accordingly.
59+
60+
### UI and Commands
61+
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.
65+
66+
#### Secondary Commands
67+
Beyond the primary action of opening a workspace, the extension provides secondary commands for managing the workspace list:
68+
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.
71+
72+
This architecture ensures a clean separation of concerns, making the codebase easier to understand, extend, and debug.

LICENSE.txt

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

33
Copyright (c) 2025 Jonah Fintz
4+
Copyright (c) 2025 tanchekwei
45

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

README.md

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,29 @@
1-
# Command Palette for Visual Studio Code
1+
# Workspace Launcher for VS Code
22

33
## Overview
44

55
This project provides a command palette extension for opening Visual Studio Code workspaces.
66

7-
![Command Palette for Visual Studio Code](./Assets/screenshot.png)
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)
816

917
## Features
1018

1119
- **Workspace Management**: Retrieve and display a list of available workspaces, including their paths and types (e.g., Local, WSL, Remote).
1220
- **Command Execution**: Open workspaces in Visual Studio Code using a dedicated command.
1321
- **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.
1427

1528
## Installation
1629

@@ -19,21 +32,21 @@ This project provides a command palette extension for opening Visual Studio Code
1932
2033
### Windows Store
2134

22-
<a href="https://apps.microsoft.com/detail/9PKCGVQ05TG1?mode=direct">
35+
<!-- <a href="https://apps.microsoft.com/detail/9PKCGVQ05TG1?mode=direct">
2336
<img src="https://get.microsoft.com/images/en-us%20light.svg" width="300"/>
24-
</a>
37+
</a> -->
2538

2639
### Via Command Palette
2740

2841
1. Open Command Palette
29-
2. Select "Command Palette - VS Code"
42+
2. Select "Workspace Launcher for VS Code"
3043

3144
### Via Winget
3245

3346
1. Open Command Prompt or PowerShell
3447
2. Run the following command:
3548
```bash
36-
winget install JonahFintzDEV.CommandPalette-VSCode
49+
winget install 15722UsefulApp.WorkspaceLauncherForVSCode
3750
```
3851

3952
### Manual Installation
@@ -43,40 +56,20 @@ This project provides a command palette extension for opening Visual Studio Code
4356

4457
## Settings
4558

46-
- **Preferred Edition**: Determines which edition (Default or Insider) is used when a folder or workspace has been opened in both editions of VS Code.
47-
- Options:
48-
- **Default**: Uses the standard VS Code edition
49-
- **Insider**: Uses the VS Code Insider edition
59+
- **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.
60+
- **Search By**: Choose what to search by (Path, Title, or Both).
5061
- **Use Strict Search**: Enables or disables strict search for workspaces.
51-
- **Strict Search**: Matches items where the search text appears as a contiguous substring in the item's title or subtitle. For example, searching for "abc" will match "abc" or "abc123" but not "a1b2c3".
52-
- **Show Details Panel**: Toggles the visibility of the details panel in the UI.
53-
- **Tags**: Configures the tags displayed for each workspace.
54-
- Options:
55-
- **None** (-): No tags are displayed.
56-
- **Type**: Displays the workspace type (e.g., Local, WSL, Remote).
57-
- **Target**: Displays the target instance name (e.g., VS Code, VS Code Insider).
58-
- **Type & Target**: Displays both the workspace type and the target instance name.
59-
- **Command Result Action**: Determines what should happen after opening a VS Code workspace.
60-
- Options:
61-
- **Dismiss**: Closes the Command Palette after opening the workspace
62-
- **Go Back**: Returns to the previous Command Palette view
63-
- **Keep Open**: Keeps the Command Palette open after opening the workspace
64-
65-
## Technical Information
66-
67-
- **Version**: 1.6.0.0
68-
- **Target Framework**: .NET 9.0 (Windows 10.0.22621.0)
69-
- **Minimum OS Version**: Windows 10 (10.0.19041.0)
70-
- **Architecture Support**: x64, ARM64
71-
- **Package Type**: MSIX (Microsoft Store app)
72-
73-
## Project Structure
74-
75-
- **Main Application**: [`CmdPalVsCode.cs`](VsCode/CmdPalVsCode.cs) - Main extension implementation
76-
- **Commands Provider**: [`CmdPalVsCodeCommandsProvider.cs`](VsCode/CmdPalVsCodeCommandsProvider.cs) - Command palette provider
77-
- **Settings Management**: [`SettingsManager.cs`](VsCode/Classes/SettingsManager.cs) - Handles user preferences
78-
- **VS Code Integration**: [`OpenVsCodeCommand.cs`](VsCode/Commands/OpenVsCodeCommand.cs) - Command execution logic
79-
- **UI Pages**: [`VSCodePage.cs`](VsCode/Pages/VSCodePage.cs) - Main interface page
62+
- **Page Size**: Sets the number of items to load and display at one time.
63+
- **Show Details Panel**: Toggles the visibility of the details panel.
64+
- **Tags**: Configures the tags displayed for each workspace (Type, Target, or both).
65+
- **Enable Visual Studio Code Installations**: Toggles which installations of Visual Studio Code to search for workspaces.
66+
- **Command Result Action**: Determines what should happen after opening a Visual Studio Code workspace.
67+
68+
## How It Works
69+
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.
71+
72+
For more detailed technical information about the project's architecture and components, please see the [Project Guide](./GUIDE.md).
8073

8174
## Contributing
8275

VsCode.sln

Lines changed: 0 additions & 42 deletions
This file was deleted.

VsCode/Assets/VsCodeIcon.png

-112 KB
Binary file not shown.

0 commit comments

Comments
 (0)