Skip to content

Commit 6cd7195

Browse files
author
Jefferson Pires
committedMar 24, 2024
- Added codeReview.png to Resources, introducing a new icon for the Code Review feature.
- Updated extension versions in `source.extension.vsixmanifest` and `VisualChatGPTStudio2019/source.extension.vsixmanifest` to `2.7.0`. - Included `codeReview.png` as a resource in `VisualChatGPTStudio.csproj` and `VisualChatGPTStudio2019/VisualChatGPTStudio2019.csproj`. - Added new command handler `TerminalWindowCodeReviewCommand.cs` for initiating code reviews. - Introduced new tool window `TerminalWindowCodeReview` and its control `TerminalWindowCodeReviewControl` for the Code Review feature. - Updated `VisualChatGPTStudioShared.projitems` to include new command and tool window files. - Registered `TerminalWindowCodeReview` tool window in `VisuallChatGPTStudioPackage.cs`. - Added a new command `cmdidTerminalWindowCodeReviewCommand` and its icon in `VSCommandTable.vsct` for accessing the Code Review feature from the Visual Studio interface.
1 parent 0104aea commit 6cd7195

12 files changed

+246
-2
lines changed
 

‎Resources/codeReview.png

365 Bytes
Loading

‎VSCommandTable.vsct

+12
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,13 @@
144144
<ButtonText>Visual chatGPT Studio Solution Context</ButtonText>
145145
</Strings>
146146
</Button>
147+
<Button guid="guidVisuallChatGPTStudioPackageCmdSet" id="cmdidTerminalWindowCodeReviewCommand" priority="0x0100" type="Button">
148+
<Parent guid="guidSHLMainMenu" id="IDG_VS_WNDO_OTRWNDWS1" />
149+
<Icon guid="VisuallChatGPTStudioCodeReviewIcon" id="codeReviewIcon" />
150+
<Strings>
151+
<ButtonText>Visual chatGPT Studio Code Review</ButtonText>
152+
</Strings>
153+
</Button>
147154
</Buttons>
148155

149156
<Bitmaps>
@@ -165,6 +172,7 @@
165172
<Bitmap guid="VisuallChatGPTStudioChatGPTIcon" href="Resources\bot.png" usedList="chatGPTIcon"/>
166173
<Bitmap guid="VisuallChatGPTStudioTurboIcon" href="Resources\turbo.png" usedList="turboIcon"/>
167174
<Bitmap guid="VisuallChatGPTStudioSolutionContextIcon" href="Resources\solutionContext.png" usedList="solutionContextIcon"/>
175+
<Bitmap guid="VisuallChatGPTStudioCodeReviewIcon" href="Resources\codeReview.png" usedList="codeReviewIcon"/>
168176
</Bitmaps>
169177
</Commands>
170178

@@ -288,6 +296,7 @@
288296
<IDSymbol value="256" name="cmdidTerminalWindowCommand" />
289297
<IDSymbol value="257" name="cmdidTerminalWindowTurboCommand" />
290298
<IDSymbol value="258" name="cmdidTerminalWindowSolutionContextCommand" />
299+
<IDSymbol value="259" name="cmdidTerminalWindowCodeReviewCommand" />
291300
</GuidSymbol>
292301

293302
<GuidSymbol name="VisuallChatGPTStudioCompleteIcon" value="{C12A8ED0-FBE5-4815-A3FB-2CB73AB06EEA}">
@@ -344,5 +353,8 @@
344353
<GuidSymbol name="VisuallChatGPTStudioSolutionContextIcon" value="{97050FA7-DEA5-4FBC-AF34-21425E9D807F}">
345354
<IDSymbol name="solutionContextIcon" value="1" />
346355
</GuidSymbol>
356+
<GuidSymbol name="VisuallChatGPTStudioCodeReviewIcon" value="{62CBC0F1-8649-4458-9B6F-68BBF0A746D9}">
357+
<IDSymbol name="codeReviewIcon" value="1" />
358+
</GuidSymbol>
347359
</Symbols>
348360
</CommandTable>

‎VisualChatGPTStudio.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@
192192
<IncludeInVSIX>true</IncludeInVSIX>
193193
</Content>
194194
<Resource Include="Resources\git.png" />
195+
<Resource Include="Resources\codeReview.png" />
195196
<Content Include="Resources\Icon.png">
196197
<IncludeInVSIX>true</IncludeInVSIX>
197198
</Content>

‎VisualChatGPTStudio2019/VisualChatGPTStudio2019.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@
233233
<Resource Include="..\Resources\git.png">
234234
<Link>Resources\git.png</Link>
235235
</Resource>
236+
<Resource Include="..\Resources\codeReview.png">
237+
<Link>Resources\codeReview.png</Link>
238+
</Resource>
236239
<Content Include="Icon2019.png">
237240
<IncludeInVSIX>true</IncludeInVSIX>
238241
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

‎VisualChatGPTStudio2019/source.extension.vsixmanifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
33
<Metadata>
4-
<Identity Id="VisualChatGPTStudio2019.4854bc98-735d-4622-a0cf-30454b50aa0f" Version="2.6.0" Language="en-US" Publisher="Jefferson Pires" />
4+
<Identity Id="VisualChatGPTStudio2019.4854bc98-735d-4622-a0cf-30454b50aa0f" Version="2.7.0" Language="en-US" Publisher="Jefferson Pires" />
55
<DisplayName>Visual chatGPT Studio 2019</DisplayName>
66
<Description xml:space="preserve">Add chatGPT functionalities directly on Visual Studio.</Description>
77
<Icon>Icon2019.png</Icon>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
using JeffPires.VisualChatGPTStudio.ToolWindows;
2+
using Microsoft.VisualStudio.Shell;
3+
using System;
4+
using System.ComponentModel.Design;
5+
using System.Threading.Tasks;
6+
7+
namespace JeffPires.VisualChatGPTStudio.Commands
8+
{
9+
/// <summary>
10+
/// Command handler
11+
/// </summary>
12+
internal sealed class TerminalWindowCodeReviewCommand
13+
{
14+
/// <summary>
15+
/// Command ID.
16+
/// </summary>
17+
public const int CommandId = 259;
18+
19+
/// <summary>
20+
/// Command menu group (command set GUID).
21+
/// </summary>
22+
public static readonly Guid CommandSet = new("8b0b1a54-4655-4dae-8984-022f82a739f2");
23+
24+
/// <summary>
25+
/// VS Package that provides this command, not null.
26+
/// </summary>
27+
private readonly AsyncPackage package;
28+
29+
/// <summary>
30+
/// This field holds a reference to the TerminalWindow object.
31+
/// </summary>
32+
private static TerminalWindowCodeReview window;
33+
34+
/// <summary>
35+
/// Initializes a new instance of the <see cref="TerminalWindowCommand"/> class.
36+
/// Adds our command handlers for menu (commands must exist in the command table file)
37+
/// </summary>
38+
/// <param name="package">Owner package, not null.</param>
39+
/// <param name="commandService">Command service to add command to, not null.</param>
40+
private TerminalWindowCodeReviewCommand(AsyncPackage package, OleMenuCommandService commandService)
41+
{
42+
this.package = package ?? throw new ArgumentNullException(nameof(package));
43+
commandService = commandService ?? throw new ArgumentNullException(nameof(commandService));
44+
45+
CommandID menuCommandID = new(CommandSet, CommandId);
46+
MenuCommand menuItem = new(this.Execute, menuCommandID);
47+
commandService.AddCommand(menuItem);
48+
}
49+
50+
/// <summary>
51+
/// Gets the instance of the command.
52+
/// </summary>
53+
public static TerminalWindowCodeReviewCommand Instance
54+
{
55+
get;
56+
private set;
57+
}
58+
59+
/// <summary>
60+
/// Initializes the singleton instance of the command.
61+
/// </summary>
62+
/// <param name="package">Owner package, not null.</param>
63+
public static async System.Threading.Tasks.Task InitializeAsync(AsyncPackage package)
64+
{
65+
// Switch to the main thread - the call to AddCommand in TerminalWindowCommand's constructor requires
66+
// the UI thread.
67+
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(package.DisposalToken);
68+
69+
OleMenuCommandService commandService = await package.GetServiceAsync((typeof(IMenuCommandService))) as OleMenuCommandService;
70+
Instance = new TerminalWindowCodeReviewCommand(package, commandService);
71+
72+
await InitializeToolWindowAsync(package);
73+
}
74+
75+
/// <summary>
76+
/// Shows the tool window when the menu item is clicked.
77+
/// </summary>
78+
/// <param name="sender">The event sender.</param>
79+
/// <param name="e">The event args.</param>
80+
private void Execute(object sender, EventArgs e)
81+
{
82+
_ = this.package.JoinableTaskFactory.RunAsync(async delegate
83+
{
84+
await package.ShowToolWindowAsync(typeof(TerminalWindowCodeReview), 0, true, package.DisposalToken);
85+
});
86+
}
87+
88+
/// <summary>
89+
/// Initializes the ToolWindow with the specified <paramref name="package"/>.
90+
/// </summary>
91+
/// <param name="package">The AsyncPackage to be initialized.</param>
92+
/// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
93+
private static async System.Threading.Tasks.Task InitializeToolWindowAsync(AsyncPackage package)
94+
{
95+
window = await package.FindToolWindowAsync(typeof(TerminalWindowCodeReview), 0, true, package.DisposalToken) as TerminalWindowCodeReview;
96+
97+
if ((null == window) || (null == window.Frame))
98+
{
99+
throw new NotSupportedException("Cannot create tool window");
100+
}
101+
102+
window.SetTerminalWindowProperties(((VisuallChatGPTStudioPackage)package).OptionsGeneral, package);
103+
}
104+
}
105+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using JeffPires.VisualChatGPTStudio.Options;
2+
using Microsoft.VisualStudio.Shell;
3+
using System;
4+
using System.Runtime.InteropServices;
5+
6+
namespace JeffPires.VisualChatGPTStudio.ToolWindows
7+
{
8+
/// <summary>
9+
/// This class implements the tool window exposed by this package and hosts a user control.
10+
/// </summary>
11+
/// <remarks>
12+
/// In Visual Studio tool windows are composed of a frame (implemented by the shell) and a pane,
13+
/// usually implemented by the package implementer.
14+
/// <para>
15+
/// This class derives from the ToolWindowPane class provided from the MPF in order to use its
16+
/// implementation of the IVsUIElementPane interface.
17+
/// </para>
18+
/// </remarks>
19+
[Guid("3CF59F3B-AB43-4723-A204-C1473A2C7F44")]
20+
public class TerminalWindowCodeReview : ToolWindowPane
21+
{
22+
/// <summary>
23+
/// Initializes a new instance of the <see cref="TerminalWindowCodeReview"/> class.
24+
/// </summary>
25+
public TerminalWindowCodeReview() : base(null)
26+
{
27+
this.Caption = "Visual chatGPT Studio Code Review";
28+
29+
// This is the user control hosted by the tool window; Note that, even if this class implements IDisposable,
30+
// we are not calling Dispose on this object. This is because ToolWindowPane calls Dispose on
31+
// the object returned by the Content property.
32+
this.Content = new TerminalWindowCodeReviewControl();
33+
}
34+
35+
/// <summary>
36+
/// Sets the terminal window properties.
37+
/// </summary>
38+
/// <param name="options">The options.</param>
39+
/// <param name="package">The package.</param>
40+
public void SetTerminalWindowProperties(OptionPageGridGeneral options, Package package)
41+
{
42+
((TerminalWindowCodeReviewControl)this.Content).StartControl(options, package);
43+
}
44+
}
45+
}

‎VisualChatGPTStudioShared/ToolWindows/CodeReview/TerminalWindowCodeReviewControl.cs

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
using JeffPires.VisualChatGPTStudio.Options;
2+
using Microsoft.VisualStudio.Shell;
3+
using UserControl = System.Windows.Controls.UserControl;namespace JeffPires.VisualChatGPTStudio.ToolWindows{
4+
/// <summary>
5+
/// Represents a user control for the Terminal Window Solution Context.
6+
/// </summary>
7+
public partial class TerminalWindowCodeReviewControl : UserControl {
8+
#region Properties
9+
private OptionPageGridGeneral options;
10+
private Package package;
11+
12+
#endregion Properties
13+
#region Constructors
14+
/// <summary>
15+
/// Initializes a new instance of the TerminalWindowSolutionContextControl class.
16+
/// </summary>
17+
public TerminalWindowCodeReviewControl() { this.InitializeComponent();
18+
19+
20+
}
21+
22+
#endregion Constructors
23+
#region Event Handlers
24+
25+
26+
27+
#endregion Event Handlers
28+
#region Methods
29+
30+
/// <summary>
31+
/// Starts the control with the given options and package.
32+
/// </summary>
33+
/// <param name="options">The options.</param>
34+
/// <param name="package">The package.</param>
35+
public void StartControl(OptionPageGridGeneral options, Package package)
36+
{
37+
this.options = options;
38+
this.package = package;
39+
}
40+
41+
#endregion Methods
42+
}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
<UserControl x:Class="JeffPires.VisualChatGPTStudio.ToolWindows.TerminalWindowCodeReviewControl"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:vsshell="clr-namespace:Microsoft.VisualStudio.Shell;assembly=Microsoft.VisualStudio.Shell.15.0"
8+
Background="{DynamicResource {x:Static vsshell:VsBrushes.WindowKey}}"
9+
Foreground="{DynamicResource {x:Static vsshell:VsBrushes.WindowTextKey}}"
10+
mc:Ignorable="d"
11+
d:DesignHeight="300" d:DesignWidth="300"
12+
Name="MyToolWindow">
13+
<Grid>
14+
<Grid.RowDefinitions>
15+
<RowDefinition Height="Auto"/>
16+
<RowDefinition Height="10"/>
17+
<RowDefinition Height="*" />
18+
</Grid.RowDefinitions>
19+
<Grid.ColumnDefinitions>
20+
<ColumnDefinition Width="Auto" />
21+
<ColumnDefinition Width="10" />
22+
<ColumnDefinition Width="*" />
23+
</Grid.ColumnDefinitions>
24+
25+
</Grid>
26+
</UserControl>
27+

‎VisualChatGPTStudioShared/VisualChatGPTStudioShared.projitems

+7
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<Compile Include="$(MSBuildThisFileDirectory)Commands\FindBugs.cs" />
2626
<Compile Include="$(MSBuildThisFileDirectory)Commands\Optimize.cs" />
2727
<Compile Include="$(MSBuildThisFileDirectory)Commands\OptimizeDiffView.cs" />
28+
<Compile Include="$(MSBuildThisFileDirectory)Commands\TerminalWindowCodeReviewCommand.cs" />
2829
<Compile Include="$(MSBuildThisFileDirectory)Commands\TerminalWindowSolutionContextCommand.cs" />
2930
<Compile Include="$(MSBuildThisFileDirectory)Commands\TerminalWindowCommand.cs" />
3031
<Compile Include="$(MSBuildThisFileDirectory)Commands\TerminalWindowTurboCommand.cs" />
@@ -37,6 +38,8 @@
3738
<Compile Include="$(MSBuildThisFileDirectory)Options\Commands\OptionCommands.cs">
3839
<SubType>Component</SubType>
3940
</Compile>
41+
<Compile Include="$(MSBuildThisFileDirectory)ToolWindows\CodeReview\TerminalWindowCodeReview.cs" />
42+
<Compile Include="$(MSBuildThisFileDirectory)ToolWindows\CodeReview\TerminalWindowCodeReviewControl.cs" />
4043
<Compile Include="$(MSBuildThisFileDirectory)ToolWindows\SolutionContext\TerminalWindowSolutionContext.cs" />
4144
<Compile Include="$(MSBuildThisFileDirectory)ToolWindows\TerminalWindow\TerminalWindow.cs" />
4245
<Compile Include="$(MSBuildThisFileDirectory)ToolWindows\SolutionContext\TerminalWindowSolutionContextControl.cs" />
@@ -71,6 +74,10 @@
7174
<SubType>Designer</SubType>
7275
<Generator>MSBuild:Compile</Generator>
7376
</Page>
77+
<Page Include="$(MSBuildThisFileDirectory)ToolWindows\CodeReview\TerminalWindowCodeReviewControl.xaml">
78+
<SubType>Designer</SubType>
79+
<Generator>MSBuild:Compile</Generator>
80+
</Page>
7481
<Page Include="$(MSBuildThisFileDirectory)ToolWindows\SolutionContext\TerminalWindowSolutionContextControl.xaml">
7582
<SubType>Designer</SubType>
7683
<Generator>MSBuild:Compile</Generator>

‎VisualChatGPTStudioShared/VisuallChatGPTStudioPackage.cs

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ namespace JeffPires.VisualChatGPTStudio
2323
[ProvideToolWindow(typeof(TerminalWindow))]
2424
[ProvideToolWindow(typeof(TerminalWindowTurbo))]
2525
[ProvideToolWindow(typeof(TerminalWindowSolutionContext))]
26+
[ProvideToolWindow(typeof(TerminalWindowCodeReview))]
2627
public sealed class VisuallChatGPTStudioPackage : ToolkitPackage
2728
{
2829
/// <summary>
@@ -63,6 +64,7 @@ protected override async System.Threading.Tasks.Task InitializeAsync(Cancellatio
6364
await TerminalWindowCommand.InitializeAsync(this);
6465
await TerminalWindowTurboCommand.InitializeAsync(this);
6566
await TerminalWindowSolutionContextCommand.InitializeAsync(this);
67+
await TerminalWindowCodeReviewCommand.InitializeAsync(this);
6668
}
6769
}
6870
}

‎source.extension.vsixmanifest

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
33
<Metadata>
4-
<Identity Id="VisualChatGPTStudio.4854bc98-735d-4622-a0cf-30454b50aa0f" Version="2.6.0" Language="en-US" Publisher="Jefferson Pires" />
4+
<Identity Id="VisualChatGPTStudio.4854bc98-735d-4622-a0cf-30454b50aa0f" Version="2.7.0" Language="en-US" Publisher="Jefferson Pires" />
55
<DisplayName>Visual chatGPT Studio</DisplayName>
66
<Description xml:space="preserve">Add chatGPT functionalities directly on Visual Studio.</Description>
77
<Icon>icons8-chatgpt-512.png</Icon>

0 commit comments

Comments
 (0)
Please sign in to comment.