@@ -23,6 +23,7 @@ public class OpenFromUrlCommand : VsCommand<string>, IOpenFromUrlCommand
2323 readonly Lazy < GitHubContextService > gitHubContextService ;
2424 readonly Lazy < IRepositoryCloneService > repositoryCloneService ;
2525 readonly Lazy < IPullRequestEditorService > pullRequestEditorService ;
26+ readonly Lazy < ITeamExplorerContext > teamExplorerContext ;
2627 readonly Lazy < IGitHubToolWindowManager > gitHubToolWindowManager ;
2728 readonly Lazy < DTE > dte ;
2829 readonly IServiceProvider serviceProvider ;
@@ -42,12 +43,14 @@ public OpenFromUrlCommand(
4243 Lazy < GitHubContextService > gitHubContextService ,
4344 Lazy < IRepositoryCloneService > repositoryCloneService ,
4445 Lazy < IPullRequestEditorService > pullRequestEditorService ,
46+ Lazy < ITeamExplorerContext > teamExplorerContext ,
4547 [ Import ( typeof ( SVsServiceProvider ) ) ] IServiceProvider serviceProvider ) :
4648 base ( CommandSet , CommandId )
4749 {
4850 this . gitHubContextService = gitHubContextService ;
4951 this . repositoryCloneService = repositoryCloneService ;
5052 this . pullRequestEditorService = pullRequestEditorService ;
53+ this . teamExplorerContext = teamExplorerContext ;
5154 this . serviceProvider = serviceProvider ;
5255 dte = new Lazy < DTE > ( ( ) => ( DTE ) serviceProvider . GetService ( typeof ( DTE ) ) ) ;
5356 gitHubToolWindowManager = new Lazy < IGitHubToolWindowManager > (
@@ -72,6 +75,16 @@ public override async Task Execute(string url)
7275 return ;
7376 }
7477
78+ var activeDir = teamExplorerContext . Value . ActiveRepository ? . LocalPath ;
79+ if ( activeDir != null )
80+ {
81+ // Try opening file in current context
82+ if ( gitHubContextService . Value . TryOpenFile ( activeDir , context ) )
83+ {
84+ return ;
85+ }
86+ }
87+
7588 // Keep repos in unique dir while testing
7689 var defaultSubPath = "GitHubCache" ;
7790
@@ -125,7 +138,7 @@ public override async Task Execute(string url)
125138 }
126139
127140 await TryOpenPullRequest ( context ) ;
128- gitHubContextService . Value . TryOpenFile ( context , repositoryDir ) ;
141+ gitHubContextService . Value . TryOpenFile ( repositoryDir , context ) ;
129142 }
130143
131144 VSConstants . MessageBoxResult ShowInfoMessage ( string message )
0 commit comments