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

Commit 5560be5

Browse files
committed
Keep CA happy
1 parent 28c01a0 commit 5560be5

File tree

2 files changed

+14
-11
lines changed

2 files changed

+14
-11
lines changed

src/GitHub.App/Services/PullRequestEditorService.cs

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,7 @@ public async Task<ITextView> OpenFile(
109109
if (!workingDirectory)
110110
{
111111
AddBufferTag(wpfTextView.TextBuffer, session, fullPath, commitSha, null);
112-
113-
var file = await session.GetFile(relativePath);
114-
EnableNavigateToEditor(textView, session, file);
112+
EnableNavigateToEditor(textView, session);
115113
}
116114
}
117115

@@ -201,9 +199,9 @@ await pullRequestService.ExtractToTempFile(
201199
if (!workingDirectory)
202200
{
203201
AddBufferTag(diffViewer.RightView.TextBuffer, session, rightPath, file.CommitSha, DiffSide.Right);
204-
EnableNavigateToEditor(diffViewer.LeftView, session, file);
205-
EnableNavigateToEditor(diffViewer.RightView, session, file);
206-
EnableNavigateToEditor(diffViewer.InlineView, session, file);
202+
EnableNavigateToEditor(diffViewer.LeftView, session);
203+
EnableNavigateToEditor(diffViewer.RightView, session);
204+
EnableNavigateToEditor(diffViewer.InlineView, session);
207205
}
208206

209207
if (workingDirectory)
@@ -492,17 +490,17 @@ void AddBufferTag(
492490
}
493491
}
494492

495-
void EnableNavigateToEditor(ITextView textView, IPullRequestSession session, IPullRequestSessionFile file)
493+
void EnableNavigateToEditor(ITextView textView, IPullRequestSession session)
496494
{
497495
var vsTextView = vsEditorAdaptersFactory.GetViewAdapter(textView);
498-
EnableNavigateToEditor(vsTextView, session, file);
496+
EnableNavigateToEditor(vsTextView, session);
499497
}
500498

501-
void EnableNavigateToEditor(IVsTextView vsTextView, IPullRequestSession session, IPullRequestSessionFile file)
499+
void EnableNavigateToEditor(IVsTextView vsTextView, IPullRequestSession session)
502500
{
503501
var commandGroup = VSConstants.CMDSETID.StandardCommandSet2K_guid;
504502
var commandId = (int)VSConstants.VSStd2KCmdID.RETURN;
505-
new TextViewCommandDispatcher(vsTextView, commandGroup, commandId, openFileInSolutionCommand);
503+
TextViewCommandDispatcher.AddCommandFilter(vsTextView, commandGroup, commandId, openFileInSolutionCommand);
506504

507505
EnableNavigateStatusBarMessage(vsTextView, session);
508506
}

src/GitHub.App/Services/TextViewCommandDispatcher.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,19 @@ class TextViewCommandDispatcher : IOleCommandTarget, IDisposable
2121
readonly IOleCommandTarget next;
2222
readonly ICommand targetCommand;
2323

24+
public static IDisposable AddCommandFilter(IVsTextView textView, Guid commandGroup, int commandId, ICommand targetCommand)
25+
{
26+
return new TextViewCommandDispatcher(textView, commandGroup, commandId, targetCommand);
27+
}
28+
2429
/// <summary>
2530
/// Add a command filter to <see cref="IVsTextView"/>.
2631
/// </summary>
2732
/// <param name="textView">The text view to filter commands from.</param>
2833
/// <param name="commandGroup">The group of the command to listen for.</param>
2934
/// <param name="commandId">The ID of the command to listen for.</param>
3035
/// <param name="targetCommand">The command to dispatch to.</param>
31-
public TextViewCommandDispatcher(IVsTextView textView, Guid commandGroup, int commandId, ICommand targetCommand)
36+
TextViewCommandDispatcher(IVsTextView textView, Guid commandGroup, int commandId, ICommand targetCommand)
3237
{
3338
this.textView = textView;
3439
this.commandGroup = commandGroup;

0 commit comments

Comments
 (0)