-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathFallbackOpenRecentVisualStudioCodeItem.cs
More file actions
40 lines (34 loc) · 1.26 KB
/
Copy pathFallbackOpenRecentVisualStudioCodeItem.cs
File metadata and controls
40 lines (34 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Modifications copyright (c) 2025 tanchekwei
// Licensed under the MIT License. See the LICENSE file in the project root for details.
using Microsoft.CommandPalette.Extensions.Toolkit;
using Windows.ApplicationModel;
namespace WorkspaceLauncherForVSCode.Pages;
internal sealed partial class FallbackOpenRecentVisualStudioCodeItem : FallbackCommandItem
{
private readonly VisualStudioCodePage _page;
public FallbackOpenRecentVisualStudioCodeItem(
VisualStudioCodePage page
)
: base(new NoOpCommand(), string.Empty, $"{Package.Current.Id.Name}.{nameof(FallbackOpenRecentVisualStudioCodeItem)}")
{
_page = page;
Title = string.Empty;
Subtitle = string.Empty;
Icon = Classes.Icon.VisualStudioAndVisualStudioCode;
}
public override void UpdateQuery(string query)
{
Command = new NoOpCommand();
Title = string.Empty;
Subtitle = Classes.Constant.VisualStudioCodeDisplayName;
Icon = null;
if (string.IsNullOrWhiteSpace(query) || _page.AllWorkspaces.Count == 0)
{
return;
}
_page.SetSearchText(query);
Title = $"Search for \"{query}\"";
Icon = Classes.Icon.VisualStudioAndVisualStudioCode;
Command = _page;
}
}