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

Commit

Permalink
Advertise Open File in Solution on Inline Comment view
Browse files Browse the repository at this point in the history
Make the `Open File in Solution` command and keyboard shortcut discoverable by advertising on the inline comment view task bar.
  • Loading branch information
jcansdale committed Jan 15, 2018
1 parent 4ae78f8 commit 9857cdc
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/GitHub.InlineReviews/ViewModels/InlineCommentPeekViewModel.cs
Expand Up @@ -75,6 +75,14 @@ public sealed class InlineCommentPeekViewModel : ReactiveObject, IDisposable
{
FromLine = peekService.GetLineNumber(peekSession, triggerPoint).Item1,
}));

NavigateToEditor = ReactiveCommand.CreateAsyncTask(
Observable.Return(true),
async _ =>
{
// TODO: Execute the `openFileInSolutionCommand`.
await Task.Delay(1000);
});
}

/// <summary>
Expand All @@ -96,6 +104,11 @@ public ICommentThreadViewModel Thread
/// </summary>
public ReactiveCommand<Unit> PreviousComment { get; }

/// <summary>
/// Gets a command which navigates to the position of this comment in the live editor.
/// </summary>
public ReactiveCommand<Unit> NavigateToEditor { get; }

public void Dispose()
{
threadSubscription?.Dispose();
Expand Down
13 changes: 13 additions & 0 deletions src/GitHub.InlineReviews/Views/InlineCommentPeekView.xaml
Expand Up @@ -96,7 +96,20 @@
<Rectangle Canvas.Left="9" Canvas.Top="6" Width="6" Height="1" Fill="{DynamicResource VsBrush.CommandBarOptionsGlyph}" StrokeThickness="1"/>
</Canvas>
</Button>

<Separator Background="{DynamicResource GitHubButtonBorderBrush}" Style="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}" />

<Button Margin="2 0" Padding="2" Command="{Binding NavigateToEditor}"
Style="{StaticResource GitHubToolbarButton}">
<Button.ToolTip>
<TextBlock FontSize="11">Open Solution File at Caret (Enter)</TextBlock>
</Button.ToolTip>

<Canvas Width="16" Height="16">
<!-- TODO: Double check these brushes since they don't seem like the right fill colors -->
<Polygon Points="8 8 8 4 4 4 4 8 1 8 6 14 11 8" Fill="{DynamicResource VsBrush.CommandBarOptionsGlyph}" StrokeThickness="1"/>
</Canvas>
</Button>
</StackPanel>
</Border>

Expand Down

0 comments on commit 9857cdc

Please sign in to comment.