Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
da0d120
Add placeholder for comments margin icon
jcansdale Mar 27, 2018
46a8ee4
Add a placeholder view-model
jcansdale Mar 27, 2018
4a4ba04
Add placeholder enable in-line comments command
jcansdale Mar 27, 2018
93c6738
Show how many comments there are on current document
jcansdale Mar 27, 2018
acb8a94
Prototype toggle margin using GlyphMargin
jcansdale Apr 11, 2018
21ab556
Add InlineCommentMarginEnabled editor option
jcansdale Apr 11, 2018
420e5d1
Use ITextViewMargin.Enabled for margin visibility
jcansdale Apr 11, 2018
8d05df8
Refactor InlineCommentMarginProvider into InlineCommentMarginFactory
jcansdale Apr 11, 2018
9d32f08
Refactor InlineCommentMargin as proxy for GlyphMargin
jcansdale Apr 11, 2018
1c32373
Make InlineCommentMargin implement IWpfTextViewMargin
jcansdale Apr 12, 2018
604446c
Specify Width on GlyphMarginGrid
jcansdale Apr 12, 2018
2eb9ab8
Always handle zoom
jcansdale Apr 12, 2018
51fee72
Pass IWpfTextView into GlyphMargin
jcansdale Apr 12, 2018
22655a9
Store IWpfTextView not IWpfTextViewHost
jcansdale Apr 12, 2018
0eb5f1e
Allow margin to be toggled when dissabled by default
jcansdale Apr 12, 2018
a491ca1
Bind CheckBox to InlineCommentMarginEnabled option
jcansdale Apr 12, 2018
d09d9ac
Don't show toggle margin on diff views
jcansdale Apr 12, 2018
7ca8668
Only enable toggle margin when changes in PR file
jcansdale Apr 12, 2018
b969949
Update CommentsMargin when PR branch changes
jcansdale Apr 12, 2018
389fcc0
Add navigation to next inline comment
jcansdale Apr 13, 2018
96e9570
Make the PR file name and comment icon clickable
jcansdale Apr 13, 2018
37963f6
Position margin to right of ZoomControl
jcansdale Apr 13, 2018
646a953
Manage comment visibility from outside GlyphMargin
jcansdale Apr 16, 2018
16d4e4f
Add/remove tagger according to margin visibility
jcansdale Apr 16, 2018
55772e2
Un/subscribe to live file depening on margin enabled
jcansdale Apr 17, 2018
c180861
Subscribe to live file depending on margin visibility
jcansdale Apr 18, 2018
e325be2
Tidy up initialization and disposal for GlyphMargin
jcansdale Apr 18, 2018
e525bc9
Merge branch 'master' into fixes/1565-comments-margin-toggle
jcansdale Apr 18, 2018
440b0ca
Remove CommentsMargin boilerplate
jcansdale Apr 19, 2018
44c4c22
Add navigation back to diff view comments
jcansdale Apr 19, 2018
0942736
Create a combined command for OpenFileInSolution/ViewChanges
jcansdale Apr 20, 2018
45028e2
Enable navigation to equivalent position in PR diff
jcansdale Apr 20, 2018
59020c1
Prompt user to add or view comments
jcansdale Apr 20, 2018
6b3b194
ViewChangesId is obsolete
jcansdale Apr 20, 2018
6850752
Make OpenDiff return IDifferenceViewer
jcansdale Apr 21, 2018
7de571f
Make OpenFile return ITextView
jcansdale Apr 21, 2018
4b16a0e
Use views returned from OpenFile/OpenDiff
jcansdale Apr 21, 2018
349483e
Use VsShellUtilities.OpenDocument not Dte.ItemOperations.OpenFile
jcansdale Apr 22, 2018
84a5e93
Add scrollToFirstDiff option to OpenDiff
jcansdale Apr 22, 2018
f016a24
Allow tags to initialize before NextInlineComment
jcansdale May 1, 2018
b0f1b42
Rename command to "Go To Solution/PR File"
jcansdale May 1, 2018
44594ad
Dynamically update command Visibility/ButtonText
jcansdale May 1, 2018
40f7d34
Hide comment margin toggle behind a feature flag
jcansdale May 1, 2018
6296cad
Move margin code into its own namespace
jcansdale May 1, 2018
1998286
Warn when navigating to PR file with no changes
jcansdale May 1, 2018
28c01a0
Change `add comments` to `view changes`
jcansdale May 1, 2018
5560be5
Keep CA happy
jcansdale May 1, 2018
9ef8675
Keep CA happy - take 2
jcansdale May 1, 2018
92e08f9
Keep CA happy - take 3
jcansdale May 1, 2018
4eed05d
Don't expect tags when margin invisible
jcansdale May 1, 2018
e5bd24d
Wait for tags to initialize before navigating
jcansdale May 2, 2018
c0364af
Merge branch 'master' into fixes/1565-comments-margin-toggle
jcansdale May 9, 2018
e4afad9
Show RightViewOnly when no changes in PR file diff
jcansdale May 10, 2018
1b91bd5
Rename to GoToSolutionOrPullRequestFileCommand
jcansdale May 10, 2018
4fcb105
Rename to ToggleInlineCommentMarginCommand
jcansdale May 10, 2018
99b98e8
Rename CommentsMargin to PullRequestFileMargin
jcansdale May 10, 2018
be891e1
Add named command GitHub.ToggleInlineCommentMargin
jcansdale May 11, 2018
3c50ec3
Add NumberOfNavigateToPullRequestFileDiff metrics
jcansdale May 11, 2018
b601462
Clean up usings
jcansdale May 11, 2018
477407e
Add ExecuteToggleInlineCommentMarginCommand metric
jcansdale May 11, 2018
9418131
Rename CommentsMargin V/M to PullRequestFileMargin
jcansdale May 11, 2018
f5687c0
Make UsageTrackingCommand lazy load IUsageTracker
jcansdale May 11, 2018
7b4c565
Factor out UsageTrackingCommand
jcansdale May 11, 2018
871bba1
Add metrics to PullRequestFileMargin
jcansdale May 11, 2018
d0dd283
Allow navigation from editable diff to code view
jcansdale May 12, 2018
d5ed33d
Merge branch 'master' into fixes/1565-comments-margin-toggle
jcansdale May 12, 2018
2d70d9a
Add NumberOfNavigateToCodeView metric
jcansdale May 14, 2018
44b048d
ExecuteGoToSolutionOrPullRequestFileCommand metric
jcansdale May 14, 2018
ebc07b5
NumberOfPRDetailsNavigateToEditor next to related
jcansdale May 14, 2018
d8256bd
Use InlineCommentMarginEnabled.Key not OptionName
jcansdale May 15, 2018
78a2518
Import Lazy<IPullRequestSessionManager> directly
jcansdale May 15, 2018
41ba0bf
Add export for InlineCommentMarginEnabled
jcansdale May 15, 2018
3d7d1c5
Store keys in InlineCommentTextViewOptions
jcansdale May 15, 2018
fb919dc
Save SpellCheck.IsEnabled="True" for another PR
jcansdale May 15, 2018
12376fa
Add xmldoc comment for GoToSolutionOrPRFileCommand
jcansdale May 15, 2018
694832e
Merge branch 'master' into fixes/1565-comments-margin-toggle
jcansdale May 16, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/GitHub.App/Commands/UsageTrackingCommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System;
using System.Windows.Input;
using System.Linq.Expressions;
using GitHub.Models;
using GitHub.Services;
using GitHub.Extensions;

namespace github.202132.xyzmands
{
/// <summary>
/// A proxy <see cref="ICommand"/> that increments a usage counter after executing the command.
/// </summary>
public class UsageTrackingCommand : ICommand
{
readonly ICommand command;
readonly Lazy<IUsageTracker> usageTracker;
readonly Expression<Func<UsageModel.MeasuresModel, int>> counter;

/// <summary>
/// The usage tracker and counter to increment after the target command is executed.
/// </summary>
/// <param name="usageTracker">The usage tracker.</param>
/// <param name="counter">The counter to increment.</param>
/// <param name="command">The target command.</param>
public UsageTrackingCommand(
Lazy<IUsageTracker> usageTracker, Expression<Func<UsageModel.MeasuresModel, int>> counter,
ICommand command)
{
this.command = command;
this.usageTracker = usageTracker;
this.counter = counter;
}

public event EventHandler CanExecuteChanged
{
add { command.CanExecuteChanged += value; }
remove { command.CanExecuteChanged -= value; }
}

public bool CanExecute(object parameter)
{
return command.CanExecute(parameter);
}

public void Execute(object parameter)
{
command.Execute(parameter);
usageTracker.Value.IncrementCounter(counter).Forget();
}
}
}
3 changes: 2 additions & 1 deletion src/GitHub.App/GitHub.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Commands\UsageTrackingCommand.cs" />
<Compile Include="Factories\ViewViewModelFactory.cs" />
<Compile Include="Factories\ModelServiceFactory.cs" />
<Compile Include="Models\IssueCommentModel.cs" />
Expand Down Expand Up @@ -401,7 +402,7 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
Expand Down
136 changes: 68 additions & 68 deletions src/GitHub.App/Resources.Designer.cs

Large diffs are not rendered by default.

Loading