Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 6155644

Browse files
committed
Advertise pen File in Solution on Inline Comment view
Make the `Open File in Solution` command and keyboard shortcut discoverable by advertising on the inline comment view task bar.
1 parent 4ae78f8 commit 6155644

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/GitHub.InlineReviews/ViewModels/InlineCommentPeekViewModel.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ public InlineCommentPeekViewModel(
7575
{
7676
FromLine = peekService.GetLineNumber(peekSession, triggerPoint).Item1,
7777
}));
78+
79+
NavigateToEditor = ReactiveCommand.CreateAsyncTask(
80+
Observable.Return(true),
81+
async _ =>
82+
{
83+
// TODO: Execute the `openFileInSolutionCommand`.
84+
await Task.Delay(1000);
85+
});
7886
}
7987

8088
/// <summary>
@@ -96,6 +104,11 @@ public ICommentThreadViewModel Thread
96104
/// </summary>
97105
public ReactiveCommand<Unit> PreviousComment { get; }
98106

107+
/// <summary>
108+
/// Gets a command which navigates to the position of this comment in the live editor.
109+
/// </summary>
110+
public ReactiveCommand<Unit> NavigateToEditor { get; }
111+
99112
public void Dispose()
100113
{
101114
threadSubscription?.Dispose();

src/GitHub.InlineReviews/Views/InlineCommentPeekView.xaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,20 @@
9696
<Rectangle Canvas.Left="9" Canvas.Top="6" Width="6" Height="1" Fill="{DynamicResource VsBrush.CommandBarOptionsGlyph}" StrokeThickness="1"/>
9797
</Canvas>
9898
</Button>
99+
99100
<Separator Background="{DynamicResource GitHubButtonBorderBrush}" Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />
101+
102+
<Button Margin="2 0" Padding="2" Command="{Binding NavigateToEditor}"
103+
Style="{StaticResource GitHubToolbarButton}">
104+
<Button.ToolTip>
105+
<TextBlock FontSize="11">Open Solution File at Caret (Enter)</TextBlock>
106+
</Button.ToolTip>
107+
108+
<Canvas Width="16" Height="16">
109+
<!-- TODO: Double check these brushes since they don't seem like the right fill colors -->
110+
<Polygon Points="8 8 8 4 4 4 4 8 1 8 6 14 11 8" Fill="{DynamicResource VsBrush.CommandBarOptionsGlyph}" StrokeThickness="1"/>
111+
</Canvas>
112+
</Button>
100113
</StackPanel>
101114
</Border>
102115

0 commit comments

Comments
 (0)