Skip to content

Commit c039772

Browse files
NicoB1981sharomank
authored andcommitted
Adjustments to support VS 2019
+ modified vsixmanifest to install on VS 2019 (had to remove nuget https://github.com/axodox/VsixUpdater for that) + Updated all NuGet Packages to current versions, so that project would compile (included a number of new packages from dependencies) + Changed RegexTesterPackage to derive from AsyncPackage to be compatible with new async loading model (avoids deprecation warning in VS2019).
1 parent 482a283 commit c039772

12 files changed

+300
-136
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ TestResults
88
## Ignore Visual Studio temporary files, build results, and
99
## files generated by popular Visual Studio add-ons.
1010
RegexTester.sln.ide
11+
.vs
1112

1213
# User-specific files
1314
*.suo

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Regex Tester
22
============
3-
This extension is a tool for testing regular expressions in Visual Studio 2017 (see versions for VS 2010-2015 in releases).
3+
This extension is a tool for testing regular expressions in Visual Studio 2019 (see previous versions in releases).
44

55
Tool simple and easy to use, the processing occurs in a background thread.
66

RegexTester/Properties/AssemblyInfo.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,33 @@
33
using System.Resources;
44
using System.Runtime.InteropServices;
55

6-
// General Information about an assembly is controlled through the following
6+
// General Information about an assembly is controlled through the following
77
// set of attributes. Change these attribute values to modify the information
88
// associated with an assembly.
99
[assembly: AssemblyTitle("Regex Tester")]
10-
[assembly: AssemblyDescription("Regular Expression Tester for Visual Studio 2017.")]
10+
[assembly: AssemblyDescription("Regular Expression Tester for Visual Studio.")]
1111
[assembly: AssemblyConfiguration("")]
1212
[assembly: AssemblyCompany("Roman Kurbangaliyev")]
1313
[assembly: AssemblyProduct("Regex Tester")]
1414
[assembly: AssemblyCopyright("Copyright © Roman Kurbangaliyev 2017")]
1515
[assembly: AssemblyTrademark("")]
16-
[assembly: AssemblyCulture("")]
17-
[assembly: ComVisible(false)]
16+
[assembly: AssemblyCulture("")]
17+
[assembly: ComVisible(false)]
1818
[assembly: CLSCompliant(false)]
1919
[assembly: NeutralResourcesLanguage("en-US")]
2020

2121
// Version information for an assembly consists of the following four values:
2222
//
2323
// Major Version
24-
// Minor Version
24+
// Minor Version
2525
// Build Number
2626
// Revision
2727
//
28-
// You can specify all the values or you can default the Revision and Build Numbers
28+
// You can specify all the values or you can default the Revision and Build Numbers
2929
// by using the '*' as shown below:
3030

31-
[assembly: AssemblyVersion("2.0.0.0")]
32-
[assembly: AssemblyFileVersion("2.0.0.0")]
31+
[assembly: AssemblyVersion("2.1.0.0")]
32+
[assembly: AssemblyFileVersion("2.1.0.0")]
3333

3434

3535

RegexTester/RegexTester.csproj

+148-51
Large diffs are not rendered by default.

RegexTester/RegexTesterPackage.cs

+24-16
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using System.Diagnostics;
44
using System.Globalization;
55
using System.Runtime.InteropServices;
6+
using System.Threading;
7+
using System.Threading.Tasks;
68
using Microsoft.VisualStudio.Shell;
79
using Microsoft.VisualStudio.Shell.Interop;
810

@@ -14,13 +16,13 @@ namespace Sharomank.RegexTester
1416
/// The minimum requirement for a class to be considered a valid package for Visual Studio
1517
/// is to implement the IVsPackage interface and register itself with the shell.
1618
/// This package uses the helper classes defined inside the Managed Package Framework (MPF)
17-
/// to do it: it derives from the Package class that provides the implementation of the
18-
/// IVsPackage interface and uses the registration attributes defined in the framework to
19+
/// to do it: it derives from the Package class that provides the implementation of the
20+
/// IVsPackage interface and uses the registration attributes defined in the framework to
1921
/// register itself and its components with the shell.
2022
/// </summary>
2123
// This attribute tells the PkgDef creation utility (CreatePkgDef.exe) that this class is
2224
// a package.
23-
[PackageRegistration(UseManagedResourcesOnly = true)]
25+
[PackageRegistration(UseManagedResourcesOnly = true, AllowsBackgroundLoading =true)]
2426
// This attribute is used to register the informations needed to show the this package
2527
// in the Help/About dialog of Visual Studio.
2628
[InstalledProductRegistration("#110", "#112", "1.0", IconResourceID = 400)]
@@ -29,13 +31,13 @@ namespace Sharomank.RegexTester
2931
// This attribute registers a tool window exposed by this package.
3032
[ProvideToolWindow(typeof(RegexTesterWindow))]
3133
[Guid(GuidList.guidRegexTesterPkgString)]
32-
public sealed class RegexTesterPackage : Package
34+
public sealed class RegexTesterPackage : AsyncPackage
3335
{
3436
/// <summary>
3537
/// Default constructor of the package.
36-
/// Inside this method you can place any initialization code that does not require
37-
/// any Visual Studio service because at this point the package object is created but
38-
/// not sited yet inside Visual Studio environment. The place to do all the other
38+
/// Inside this method you can place any initialization code that does not require
39+
/// any Visual Studio service because at this point the package object is created but
40+
/// not sited yet inside Visual Studio environment. The place to do all the other
3941
/// initialization is the Initialize method.
4042
/// </summary>
4143
public RegexTesterPackage()
@@ -44,12 +46,13 @@ public RegexTesterPackage()
4446
}
4547

4648
/// <summary>
47-
/// This function is called when the user clicks the menu item that shows the
48-
/// tool window. See the Initialize method to see how the menu item is associated to
49+
/// This function is called when the user clicks the menu item that shows the
50+
/// tool window. See the Initialize method to see how the menu item is associated to
4951
/// this function using the OleMenuCommandService service and the MenuCommand class.
5052
/// </summary>
5153
private void ShowToolWindow(object sender, EventArgs e)
5254
{
55+
ThreadHelper.ThrowIfNotOnUIThread();
5356
// Get the instance number 0 of this tool window. This window is single instance so this instance
5457
// is actually the only one.
5558
// The last flag is set to true so that if the tool window does not exists it will be created.
@@ -71,21 +74,26 @@ private void ShowToolWindow(object sender, EventArgs e)
7174
/// Initialization of the package; this method is called right after the package is sited, so this is the place
7275
/// where you can put all the initilaization code that rely on services provided by VisualStudio.
7376
/// </summary>
74-
protected override void Initialize()
77+
protected async override System.Threading.Tasks.Task InitializeAsync(CancellationToken cancellationToken, IProgress<ServiceProgressData> progress)
7578
{
76-
Trace.WriteLine (string.Format(CultureInfo.CurrentCulture, "Entering Initialize() of: {0}", this.ToString()));
77-
base.Initialize();
79+
Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering InitializeAsync of: {0}", this.ToString()));
80+
await base.InitializeAsync(cancellationToken, progress);
7881

79-
// Add our command handlers for menu (commands must exist in the .vsct file)
80-
OleMenuCommandService mcs = GetService(typeof(IMenuCommandService)) as OleMenuCommandService;
81-
if ( null != mcs )
82+
83+
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
84+
85+
// Add our command handlers for menu (commands must exist in the .vsct file)
86+
OleMenuCommandService mcs = await GetServiceAsync(typeof(IMenuCommandService)) as OleMenuCommandService;
87+
if (null != mcs)
8288
{
8389
// Create the command for the tool window
8490
CommandID toolwndCommandID = new CommandID(GuidList.guidRegexTesterCmdSet, (int)PkgCmdIDList.cmdidRegexTester);
8591
MenuCommand menuToolWin = new MenuCommand(ShowToolWindow, toolwndCommandID);
86-
mcs.AddCommand( menuToolWin );
92+
mcs.AddCommand(menuToolWin);
8793
}
94+
8895
}
96+
8997
#endregion
9098

9199
}

RegexTester/Resources/Resources.Designer.cs

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RegexTester/UserControls/RegexTesterMain.xaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
<TabControl Name="MainTabControl" SelectionChanged="MainTabControl_SelectionChanged">
1111
<TabControl.ContextMenu>
1212
<ContextMenu>
13-
<MenuItem Name="MenuItem_CloseTab" Header="Close Tab" InputGestureText="Ctrl+Shift+W" Click="MenuItem_CloseTab_Click"/>
13+
<MenuItem Name="MenuItem_CloseTab" Header="Close Tab" InputGestureText="Ctrl+W" Click="MenuItem_CloseTab_Click"/>
1414
<MenuItem Name="MenuItem_CloseOtherTabs" Header="Close Others Tabs" Click="MenuItem_CloseOtherTabs_Click" />
1515
<MenuItem Name="MenuItem_CloseAllTabs" Header="Close All Tabs" Click="MenuItem_CloseAllTabs_Click" />
1616
<Separator />
17-
<MenuItem Name="MenuItem_NewTab" Header="New Tab" InputGestureText="Ctrl+Shift+T" Click="MenuItem_NewTab_Click" />
17+
<MenuItem Name="MenuItem_NewTab" Header="New Tab" Click="MenuItem_NewTab_Click" />
1818
</ContextMenu>
1919
</TabControl.ContextMenu>
2020
<TabItem Header="+" Name="tabItemCreator" ToolTip="New Tab" FontWeight="Normal" FontSize="12" IsSelected="False" />

RegexTester/UserControls/RegexTesterMain.xaml.cs

+3-5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ private void AddNewTab()
2929
newTab.Header = GetTabItemName(MainTabControl);
3030
newTab.Content = new RegexTesterPage();
3131
MainTabControl.Items.Add(newTab);
32+
3233
Dispatcher.BeginInvoke(new Action(() => { newTab.Focus(); }));
3334
}
3435

@@ -54,12 +55,9 @@ private void MainTabControl_SelectionChanged(object sender, SelectionChangedEven
5455

5556
private void RootControl_KeyDown(object sender, KeyEventArgs e)
5657
{
57-
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control)
58+
if ((Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control && e.Key == Key.W)
5859
{
59-
if (e.Key == Key.T)
60-
AddNewTab();
61-
else if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift && e.Key == Key.W)
62-
CloseTab();
60+
CloseTab();
6361
}
6462
}
6563

RegexTester/app.config

+29-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,34 @@
1010
<assemblyIdentity name="Microsoft.VisualStudio.CoreUtility" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
1111
<bindingRedirect oldVersion="0.0.0.0-15.0.0.0" newVersion="15.0.0.0" />
1212
</dependentAssembly>
13+
<dependentAssembly>
14+
<assemblyIdentity name="Microsoft.VisualStudio.Threading" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
15+
<bindingRedirect oldVersion="0.0.0.0-16.0.0.0" newVersion="16.0.0.0" />
16+
</dependentAssembly>
17+
<dependentAssembly>
18+
<assemblyIdentity name="Microsoft.VisualStudio.Shell.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
19+
<bindingRedirect oldVersion="0.0.0.0-16.0.0.0" newVersion="16.0.0.0" />
20+
</dependentAssembly>
21+
<dependentAssembly>
22+
<assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
23+
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
24+
</dependentAssembly>
25+
<dependentAssembly>
26+
<assemblyIdentity name="StreamJsonRpc" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
27+
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
28+
</dependentAssembly>
29+
<dependentAssembly>
30+
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
31+
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
32+
</dependentAssembly>
33+
<dependentAssembly>
34+
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
35+
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
36+
</dependentAssembly>
37+
<dependentAssembly>
38+
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
39+
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
40+
</dependentAssembly>
1341
</assemblyBinding>
1442
</runtime>
15-
</configuration>
43+
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>

RegexTester/changes.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
Version 2.0.0 - May 3, 2017:
1+
Version 2.1.0 - May 13, 2019:
2+
- Migration to Visual Studio 2019.
3+
4+
Version 2.0.0 - May 3, 2017:
25
- Migration to Visual Studio 2017.
3-
NOTE: Old releases are available on GitHub here: https://github.com/sharomank/regex-tester/releases
46

57
Version 1.5.2 - Jul 30, 2015:
68
- Improve regex parsing when regular expression is changing (issue #7).
@@ -14,6 +16,8 @@ Version 1.5.0 - Feb 19, 2015:
1416
Version 1.4.2 - Aug 21, 2013:
1517
- Added support for Visual Studio 2013.
1618

19+
NOTE: Old releases are available on GitHub here: https://github.com/sharomank/regex-tester/releases
20+
1721
Old Versions:
1822
1.4.1 - Fixed support for Visual Studio 2010.
1923
1.4.0 - Added feature "Output mode", you can generate C# samples for yours regex.

0 commit comments

Comments
 (0)