Skip to content

Commit f55c9c5

Browse files
authored
Recompiled with R# SDK 2021.3.0-eap03 and removed explicit DTE dependencies (#83)
* Recompiled with R# SDK 2021.3.0-eap03 and removed explicit DTE dependencies * Recompiled with R# SDK 2021.3.0-eap05 and migrated to R# DTE wrapper * Bump Version * Recompiled with R# SDK 2021.3.0-eap07 and applied api changes * Fix OptiosPage template selector * remove unnecessary binding redirects * Recompiled with R# SDK 2021.3.0-eap08 and resolved dependency issues * tested only VS2019 and VS2022
1 parent a949371 commit f55c9c5

18 files changed

Lines changed: 1666 additions & 1741 deletions

Project/Src/InstallSupport/TestCop.nuspec

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
<authors>Alcaeus</authors>
99
<description>Easily switch between unit tests and code. Create missing associated files. Includes highlightings and test templates to keep test projects neat and tidy. Works with NUnit, MSTest, xUnit ...</description>
1010
<releaseNotes>
11-
1.10.15.2-EAP BugFix - Fix automatic shortcut assignment
12-
1.10.15.1-EAP Recompiled with R# SDK 2021.3.0-eap01
13-
1.10.14.1 Upgraded to .NET 4.7.2 and Recompiled with R# SDK 2021.2
11+
1.10.15.5-EAP Recompiled with R# SDK 2021.3.0-eap07 and applied api changes
12+
1.10.15.4-EAP Recompiled with R# SDK 2021.3.0-eap05 and migrated to R# DTE wrapper
13+
1.10.15.3-EAP Recompiled with R# SDK 2021.3.0-eap03 and removed explicit DTE dependencies
14+
1.10.15.2-EAP BugFix - Fix automatic shortcut assignment
15+
1.10.15.1-EAP Recompiled with R# SDK 2021.3.0-eap01
16+
1.10.14.1 Upgraded to .NET 4.7.2 and Recompiled with R# SDK 2021.2
1417
1.10.13.1 R#2021.1 Recompiled
1518
1.10.12.1 R#2020.3 Recompiled
1619
1.10.11.2 bug fix for R# option severity screen

Project/Src/TestCop.Plugin.Tests/TestCop.Plugin.Tests.csproj

Lines changed: 223 additions & 249 deletions
Large diffs are not rendered by default.

Project/Src/TestCop.Plugin.Tests/app.config

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22
<configuration>
33
<runtime>
44
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
5-
6-
<dependentAssembly>
7-
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
8-
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
9-
</dependentAssembly>
105
<dependentAssembly>
116
<assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
127
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />

Project/Src/TestCop.Plugin.Tests/packages.config

Lines changed: 115 additions & 145 deletions
Large diffs are not rendered by default.

Project/Src/TestCop.Plugin/Helper/DTEHelper.cs

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,43 +6,41 @@
66

77
namespace TestCop.Plugin.Helper
88
{
9-
using System;
10-
11-
using EnvDTE;
12-
13-
using EnvDTE80;
14-
159
using JetBrains;
1610
using JetBrains.ReSharper.Resources.Shell;
1711
using JetBrains.Util.Logging;
12+
using JetBrains.VsIntegration.Interop.Declarations;
13+
using JetBrains.VsIntegration.Shell.EnvDte;
14+
15+
using System;
1816

1917
public static class DTEHelper
2018
{
2119
public static bool VisualStudioIsPresent()
2220
{
23-
return Shell.Instance.HasComponent<DTE2>();
21+
return Shell.Instance.HasComponent<IEnvDteWrapper>();
2422
}
2523

2624
public static void RefreshSolutionExplorerWindow()
2725
{
28-
DTE2 dte = Shell.Instance.GetComponent<DTE2>();
29-
dte.Commands.Raise("{1496A755-94DE-11D0-8C3F-00C04FC2AAE2}", 222, null, null);
26+
IEnvDteWrapper dte = Shell.Instance.GetComponent<IEnvDteWrapper>();
27+
dte.Commands.Raise(VsConstants.VSStd2K.ToString(), (int)VsKnownCommands.VSStd2KCmdID.SLNREFRESH, null, null);
3028
}
3129

3230
/// <summary>
3331
/// Must run on main UI thread
3432
/// </summary>
3533
public static void PrintoutKeyboardShortcut(bool showOutputPane, string macroName, string keyboardShortcut)
3634
{
37-
DTE2 dte = Shell.Instance.GetComponent<DTE2>();
35+
IEnvDteWrapper dte = Shell.Instance.GetComponent<IEnvDteWrapper>();
3836

3937
try
4038
{
41-
Command command = dte.Commands.Item(macroName);
39+
IEnvDteCommand command = dte.Commands.TryGetCommand(macroName);
4240

4341
if (command != null)
4442
{
45-
object[] currentBindings = (object[])command.Bindings;
43+
object[] currentBindings = command.Bindings;
4644

4745
if (currentBindings.Length > 0)
4846
{
@@ -73,15 +71,15 @@ public static void PrintoutKeyboardShortcut(bool showOutputPane, string macroNam
7371
/// </summary>
7472
public static void AssignKeyboardShortcutIfMissing(bool showOutputPane, string macroName, string keyboardShortcut)
7573
{
76-
DTE2 dte = Shell.Instance.GetComponent<DTE2>();
74+
IEnvDteWrapper dte = Shell.Instance.GetComponent<IEnvDteWrapper>();
7775

7876
try
7977
{
80-
Command command = dte.Commands.Item(macroName);
78+
IEnvDteCommand command = dte.Commands.TryGetCommand(macroName);
8179

8280
if (command != null)
8381
{
84-
object[] currentBindings = (object[])command.Bindings;
82+
object[] currentBindings = command.Bindings;
8583

8684
if (currentBindings.Length > 0)
8785
{
@@ -115,41 +113,30 @@ public static void AssignKeyboardShortcutIfMissing(bool showOutputPane, string m
115113
}
116114
}
117115

118-
public static OutputWindowPane GetOutputWindowPane(string name, bool show)
116+
public static IEnvDteOutputWindowPane GetOutputWindowPane(string name, bool show)
119117
{
120-
DTE2 dte = Shell.Instance.GetComponent<DTE2>();
118+
IEnvDteWrapper dte = Shell.Instance.GetComponent<IEnvDteWrapper>();
121119
return GetOutputWindowPane(dte, name, show);
122120
}
123121

124122
/// <summary>
125123
/// Must run on main UI thread
126124
/// </summary>
127-
private static OutputWindowPane GetOutputWindowPane(DTE2 dte, string name, bool show)
125+
private static IEnvDteOutputWindowPane GetOutputWindowPane(IEnvDteWrapper dte, string name, bool show)
128126
{
129-
/* If compilation generates:: 'EnvDTE.Constants' can be used only as one of its applicable interfaces
130-
* then set DTE assembly reference property Embed Interop Types = false */
131-
132-
Window win = dte.Windows.Item(Constants.vsWindowKindOutput);
127+
IEnvDteWindow window = dte.Windows.TryGetWindow(VsConstants.StandardToolWindows.Output.ToString("B"));
128+
window.Activate();
133129

134130
if (show)
135131
{
136-
win.Visible = true;
132+
window.Visible = true;
137133
}
138134

139-
OutputWindow ow = (OutputWindow)win.Object;
140-
OutputWindowPane owpane;
141-
142-
try
143-
{
144-
owpane = ow.OutputWindowPanes.Item(name);
145-
}
146-
catch (Exception)
147-
{
148-
owpane = ow.OutputWindowPanes.Add(name);
149-
}
135+
IEnvDteOutputWindow outputWindow = dte.Windows.Dte.TryCreateOutputWindow(window.Object);
136+
IEnvDteOutputWindowPane outputWindowPane = outputWindow?.OutputWindowPanes.TryGetPane(name) ?? outputWindow?.OutputWindowPanes.Add(name);
150137

151-
owpane.Activate();
152-
return owpane;
138+
outputWindowPane?.Activate();
139+
return outputWindowPane;
153140
}
154141
}
155142
}

0 commit comments

Comments
 (0)