Skip to content

Commit 01bb574

Browse files
authored
Merge pull request #1 from Odotocodot/dev
Version 1.0
2 parents f62c63a + ab3e0b1 commit 01bb574

19 files changed

Lines changed: 188 additions & 117 deletions

Flow.Launcher.Plugin.VisualStudio.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
<PackageTags>flow-launcher flow-plugin</PackageTags>
1111
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
1212
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
13-
<UseWPF>true</UseWPF>
14-
<UseWindowsForms>true</UseWindowsForms>
13+
<UseWPF>true</UseWPF>
14+
<UseWindowsForms>true</UseWindowsForms>
1515
</PropertyGroup>
1616

1717
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
@@ -31,7 +31,6 @@
3131
<ItemGroup>
3232
<PackageReference Include="Flow.Launcher.Plugin" Version="4.1.0" />
3333
<PackageReference Include="System.Drawing.Common" Version="7.0.0" />
34-
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
3534
</ItemGroup>
3635

3736
</Project>

IconProvider.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ public class IconProvider
99
{
1010
public const string DefaultIcon = ImageFolderName + "\\icon.png";
1111
public const string Remove = ImageFolderName +"\\delete.png";
12+
public const string Folder = ImageFolderName +"\\folder.png";
1213

1314
private const string ImageFolderName = "Images";
1415
private const string VSIconsFolderName = "VSIcons";
@@ -17,12 +18,15 @@ public class IconProvider
1718
private readonly string vsIconsDirectoryPath;
1819

1920
public string Windows { get; init; }
21+
public string Notification { get; init; }
22+
2023

2124
public IconProvider(PluginInitContext context)
2225
{
2326
vsIcons = new ConcurrentDictionary<string, string>();
2427

2528
Windows = Path.Combine(context.CurrentPluginMetadata.PluginDirectory, ImageFolderName, "windows.png");
29+
Notification = Path.Combine(context.CurrentPluginMetadata.PluginDirectory, ImageFolderName, "notification.png");
2630

2731
vsIconsDirectoryPath = Path.Combine(context.CurrentPluginMetadata.PluginDirectory, ImageFolderName, VSIconsFolderName);
2832
Directory.CreateDirectory(vsIconsDirectoryPath);

Images/folder.png

2.14 KB
Loading

Images/icon.png

17.2 KB
Loading

Images/notification.png

9.73 KB
Loading

LICENSE.txt

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

3-
Copyright (c) [year] [fullname]
3+
Copyright (c) 2023 Odotocodot
44

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

Main.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Linq;
55
using System.Threading;
66
using System.Threading.Tasks;
7-
using System.Windows.Controls;
87

98
namespace Flow.Launcher.Plugin.VisualStudio
109
{
@@ -27,7 +26,7 @@ public async Task InitAsync(PluginInitContext context)
2726
context.API.VisibilityChanged += OnVisibilityChanged;
2827

2928
iconProvider = new IconProvider(context);
30-
plugin = await VisualStudioPlugin.Create(settings, context);
29+
plugin = await VisualStudioPlugin.Create(settings, context, iconProvider);
3130
entryHighlightData = new Dictionary<Entry, List<int>>();
3231
}
3332

@@ -69,6 +68,7 @@ public async Task<List<Result>> QueryAsync(Query query, CancellationToken token)
6968
{
7069
return SingleResult("No recent items found");
7170
}
71+
7272
entryHighlightData.Clear();
7373
var selectedRecentItems = query.Search switch
7474
{
@@ -112,7 +112,18 @@ public List<Result> LoadContextMenus(Result selectedResult)
112112
context.API.ChangeQuery(context.CurrentPluginMetadata.ActionKeyword, false);
113113
return true;
114114
}
115-
}).ToList();
115+
}).Append(new Result
116+
{
117+
Title = $"Open in File Explorer",
118+
SubTitle = currentEntry.Path,
119+
IcoPath = IconProvider.Folder,
120+
Action = c =>
121+
{
122+
context.API.OpenDirectory(Path.GetDirectoryName(currentEntry.Path), currentEntry.Path);
123+
return true;
124+
}
125+
})
126+
.ToList();
116127
}
117128
return null;
118129
}
@@ -176,7 +187,7 @@ private bool TypeSearch(Entry entry, Query query, TypeKeyword typeKeyword)
176187
return entry.ItemType == typeKeyword.Type && FuzzySearch(entry, search);
177188
}
178189
}
179-
public Control CreateSettingPanel()
190+
public System.Windows.Controls.Control CreateSettingPanel()
180191
{
181192
return new UI.SettingsView(new UI.SettingsViewModel(settings, plugin, iconProvider, this));
182193
}

Readme.md

Lines changed: 72 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,75 @@
1-
Visual Studio for Flow Launcher
2-
==================
1+
<p align="center">
2+
<a href="https://flowlauncher.com">
3+
<img src="doc/flow.png" width=12.5%>
4+
</a>
5+
<a href="https://visualstudio.microsoft.com">
6+
<img src= "doc/vs_2022.png" width=12.5%>
7+
</a>
8+
</p>
39

4-
A [Flow launcher](https://github.com/Flow-Launcher/Flow.Launcher) to let you quickly open your recent projects, solutions and files in Visual Studio
10+
<h1 align="center">Visual Studio for Flow Launcher</h1>
511

6-
### Usage
12+
A [Flow launcher](https://github.com/Flow-Launcher/Flow.Launcher) plugin to let you quickly open your recent Visual Studio projects, solutions and files, as well as remove those pesky entries that exist no more!
713

8-
[ <arguments>
14+
## Installation
15+
Type
16+
```
17+
pm install Visual Studio Launcher
18+
```
19+
in Flow Launcher.
20+
> [!IMPORTANT]
21+
> Requires at least Flow Launcher version 1.16.
22+
23+
## Features
24+
### Searching
25+
26+
Search all your recent items from **all** your Visual Studio installations.
27+
28+
| Command | Description |
29+
| :-------------------- | :--------------------------------------------------------- |
30+
| `[ {your search}` | Search all recent items (if empty shows all). |
31+
| `[ p: {your search}` | Search only recent projects (if empty shows all projects). |
32+
| `[ f: {your search}` | Search only recent files (if empty shows all files). |
33+
34+
![default_search](doc/default_search.png)
35+
36+
> [!NOTE]
37+
> Theoretically works with any number of Visual Studio installations, provided they are Visual Studio 2017 version 15.2 or later, as it requires [vswhere](https://github.com/microsoft/vswhere).
38+
39+
### Context Menu
40+
41+
Press <kbd>⇧ Shift</kbd> + <kbd>⇥ Tab</kbd> or right-click on a search result (a recent item) to open the context menu shown below.
42+
43+
This allows for:
44+
- Opening the item in a specific installation of Visual Studio.
45+
- Removing the item from Visual Studio's recent items list.
46+
- Opening the item in your default file manager.
47+
48+
![context_menu](doc/context_menu.png)
49+
50+
> [!NOTE]
51+
> The recent items list is ***shared*** between all your Visual Studio installations (although it can get out of sync), therefore, if you remove an item, it removes it from **all** Visual Studio installations recent item list.
52+
53+
### Settings
54+
55+
![settings](doc/settings.png)
56+
57+
1. The default Visual Studio installation to open a search result with (when you press <kbd>⏎ Enter</kbd> or left-click). Clicking shows a dropdown of all the Visual Studio installations found on your system.
58+
2. Refresh the list of Visual Studio installations.
59+
3. Clear invalid items from the recent items list i.e. if the path to said item does not exist remove it.
60+
4. Removes all items from the recent items list.
61+
5. Manage the backup (by default the backup is updated once a day, provided Flow Launcher has been launched that day).
62+
1. Restore recent items to the current backup
63+
2. Backup recent items right now
64+
3. Stop automatically updating the backup
65+
66+
## Known Issues
67+
68+
- Sometimes the icons for each Visual Studio installation in the [context menu](#context-menu) are not shown, restarting Flow Launcher should fix the issue.
69+
70+
## Acknowledgements
71+
72+
- This [blog post](https://www.thomasbogholm.net/2021/06/18/pruning-recent-projects-in-start-page-of-visual-studio-2019-open-recent/) on where the recent items in Visual Studio are actually stored.
73+
- The [Visual Studio Code plugin](https://github.com/taooceros/Flow.Plugin.VSCodeWorkspace) for Flow Launcher.
74+
- Microsoft for the Visual Studio icons.
75+
- [Icons8](https://icons8.com/) for the other icons.

Settings.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ public class Settings
66
{
77
//If null let windows decide;
88
public string DefaultVSId { get; set; }
9+
public bool AutoUpdateBackup { get; set; } = true;
910
public DateTime LastBackup { get; set; } = DateTime.MinValue;
1011
public Entry[] EntriesBackup { get; set; }
1112
}

UI/SettingsView.xaml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
mc:Ignorable="d">
1212
<UserControl.Resources>
1313
<ResourceDictionary>
14-
<vm:SettingsViewModel x:Key="DummyInstance" />
1514
<ResourceDictionary.MergedDictionaries>
1615
<ResourceDictionary Source="Styles.xaml" />
1716
</ResourceDictionary.MergedDictionaries>
@@ -104,18 +103,15 @@
104103
</Style>
105104
</Button.Style>
106105
<Button.ContextMenu>
107-
<ContextMenu Opened="UpdateBackupTime">
108-
<MenuItem Click="RevertToBackup">
109-
<MenuItem.Header>
110-
<TextBlock>
111-
<Run Text="Revert to Backup&#x09;&#x09;" />
112-
<Run Text="{Binding Source={StaticResource DummyInstance}, Path=LastBackup}" />
113-
</TextBlock>
114-
</MenuItem.Header>
115-
</MenuItem>
116-
<!--<MenuItem Click="" Header="Backup Now" />-->
117-
<MenuItem Header="The list of recent items is backed up once a day, provided&#10;Flow Launcher has been opened at least once." IsEnabled="False" />
118-
<!--<MenuItem Header="Create backups" IsCheckable="True" />-->
106+
<ContextMenu Name="CtxMenu" Opened="UpdateBackupTime">
107+
<MenuItem Header="{Binding LastBackup, Mode=OneWay}" IsEnabled="False" />
108+
<MenuItem Click="RevertToBackup" Header="Revert to Backup" />
109+
<MenuItem Click="BackupNow" Header="Backup Now" />
110+
<MenuItem
111+
Header="Automatically Update Backup"
112+
IsCheckable="True"
113+
IsChecked="{Binding AutoUpdateBackup}" />
114+
<MenuItem Header="The list of recent items backup is updated&#10;once a day, provided Flow Launcher has&#10;been opened at least once." IsEnabled="False" />
119115
</ContextMenu>
120116
</Button.ContextMenu>
121117
<TextBlock

0 commit comments

Comments
 (0)