mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[PT Run][VSCode] Add DevContainer workspaces to search results (#14313)
* [PT Run] (VSCode Workspaces Plugin) Added devcontainers * [PT Run] (VSCode Workspaces Plugin) Added localization for dev container workspace type * [PT Run] (VSCode Workspaces Plugin) Streamlined result title for different workspace types
This commit is contained in:
@@ -44,13 +44,9 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces
|
|||||||
var title = $"{a.FolderName}";
|
var title = $"{a.FolderName}";
|
||||||
|
|
||||||
var typeWorkspace = a.WorkspaceTypeToString();
|
var typeWorkspace = a.WorkspaceTypeToString();
|
||||||
if (a.TypeWorkspace == TypeWorkspace.Codespaces)
|
if (a.TypeWorkspace != TypeWorkspace.Local)
|
||||||
{
|
{
|
||||||
title += $" - {typeWorkspace}";
|
title = $"{title}{(a.ExtraInfo != null ? $" - {a.ExtraInfo}" : string.Empty)} ({typeWorkspace})";
|
||||||
}
|
|
||||||
else if (a.TypeWorkspace != TypeWorkspace.Local)
|
|
||||||
{
|
|
||||||
title += $" - {(a.ExtraInfo != null ? $"{a.ExtraInfo} ({typeWorkspace})" : typeWorkspace)}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var tooltip = new ToolTipData(title, $"{Resources.Workspace}{(a.TypeWorkspace != TypeWorkspace.Local ? $" {Resources.In} {typeWorkspace}" : string.Empty)}: {SystemPath.RealPath(a.RelativePath)}");
|
var tooltip = new ToolTipData(title, $"{Resources.Workspace}{(a.TypeWorkspace != TypeWorkspace.Local ? $" {Resources.In} {typeWorkspace}" : string.Empty)}: {SystemPath.RealPath(a.RelativePath)}");
|
||||||
|
|||||||
@@ -105,6 +105,15 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized string similar to Dev Container.
|
||||||
|
/// </summary>
|
||||||
|
internal static string TypeWorkspaceDevContainer {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TypeWorkspaceDevContainer", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to Local.
|
/// Looks up a localized string similar to Local.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -142,4 +142,8 @@
|
|||||||
<value>Workspace</value>
|
<value>Workspace</value>
|
||||||
<comment>It refers to the "Visual Studio Code workspace"</comment>
|
<comment>It refers to the "Visual Studio Code workspace"</comment>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TypeWorkspaceDevContainer" xml:space="preserve">
|
||||||
|
<value>Dev Container</value>
|
||||||
|
<comment>As in "Visual Studio Code Dev Container workspace "</comment>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -16,6 +16,8 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.WorkspacesHelper
|
|||||||
|
|
||||||
private static readonly Regex CodespacesWorkspace = new Regex(@"^vscode-remote://vsonline\+(.+?(?=\/))(.+)$", RegexOptions.Compiled);
|
private static readonly Regex CodespacesWorkspace = new Regex(@"^vscode-remote://vsonline\+(.+?(?=\/))(.+)$", RegexOptions.Compiled);
|
||||||
|
|
||||||
|
private static readonly Regex DevContainerWorkspace = new Regex(@"^vscode-remote://dev-container\+(.+?(?=\/))(.+)$", RegexOptions.Compiled);
|
||||||
|
|
||||||
public static (TypeWorkspace? TypeWorkspace, string MachineName, string Path) GetTypeWorkspace(string uri)
|
public static (TypeWorkspace? TypeWorkspace, string MachineName, string Path) GetTypeWorkspace(string uri)
|
||||||
{
|
{
|
||||||
if (LocalWorkspace.IsMatch(uri))
|
if (LocalWorkspace.IsMatch(uri))
|
||||||
@@ -51,7 +53,16 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.WorkspacesHelper
|
|||||||
|
|
||||||
if (match.Groups.Count > 1)
|
if (match.Groups.Count > 1)
|
||||||
{
|
{
|
||||||
return (TypeWorkspace.Codespaces, string.Empty, match.Groups[2].Value);
|
return (TypeWorkspace.Codespaces, null, match.Groups[2].Value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (DevContainerWorkspace.IsMatch(uri))
|
||||||
|
{
|
||||||
|
var match = DevContainerWorkspace.Match(uri);
|
||||||
|
|
||||||
|
if (match.Groups.Count > 1)
|
||||||
|
{
|
||||||
|
return (TypeWorkspace.DevContainer, null, match.Groups[2].Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.WorkspacesHelper
|
|||||||
case TypeWorkspace.RemoteContainers: return Resources.TypeWorkspaceContainer;
|
case TypeWorkspace.RemoteContainers: return Resources.TypeWorkspaceContainer;
|
||||||
case TypeWorkspace.RemoteSSH: return "SSH";
|
case TypeWorkspace.RemoteSSH: return "SSH";
|
||||||
case TypeWorkspace.RemoteWSL: return "WSL";
|
case TypeWorkspace.RemoteWSL: return "WSL";
|
||||||
|
case TypeWorkspace.DevContainer: return Resources.TypeWorkspaceDevContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
@@ -43,5 +44,6 @@ namespace Community.PowerToys.Run.Plugin.VSCodeWorkspaces.WorkspacesHelper
|
|||||||
RemoteWSL = 3,
|
RemoteWSL = 3,
|
||||||
RemoteSSH = 4,
|
RemoteSSH = 4,
|
||||||
RemoteContainers = 5,
|
RemoteContainers = 5,
|
||||||
|
DevContainer = 6,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user