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

Commit ffe9738

Browse files
authored
Merge pull request #1174 from github/fixes/1161-open-file-in-solution-non-temp-tab
Don't open file in solution in provisional tab.
2 parents e33336c + e58d9ee commit ffe9738

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/GitHub.VisualStudio/UI/Views/PullRequestDetailView.xaml.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ async Task DoOpenFile(IPullRequestFileNode file, bool workingDirectory)
8787
var fullPath = ViewModel.GetLocalFilePath(file);
8888
var fileName = workingDirectory ? fullPath : await ViewModel.ExtractFile(file, true);
8989

90-
using (new NewDocumentStateScope(__VSNEWDOCUMENTSTATE.NDS_Provisional, VSConstants.NewDocumentStateReason.SolutionExplorer))
90+
using (workingDirectory ? null : OpenInProvisionalTab())
9191
{
9292
var window = Services.Dte.ItemOperations.OpenFile(fileName);
9393
window.Document.ReadOnly = !workingDirectory;
@@ -127,7 +127,7 @@ async Task DoDiffFile(IPullRequestFileNode file, bool workingDirectory)
127127
}
128128

129129
IVsWindowFrame frame;
130-
using (new NewDocumentStateScope(__VSNEWDOCUMENTSTATE.NDS_Provisional, VSConstants.NewDocumentStateReason.SolutionExplorer))
130+
using (OpenInProvisionalTab())
131131
{
132132
var tooltip = $"{leftLabel}\nvs.\n{rightLabel}";
133133

@@ -315,5 +315,12 @@ void OpenHyperlink(object sender, ExecutedRoutedEventArgs e)
315315
VisualStudioBrowser.OpenUrl(uri);
316316
}
317317
}
318+
319+
static IDisposable OpenInProvisionalTab()
320+
{
321+
return new NewDocumentStateScope
322+
(__VSNEWDOCUMENTSTATE.NDS_Provisional,
323+
VSConstants.NewDocumentStateReason.SolutionExplorer);
324+
}
318325
}
319326
}

0 commit comments

Comments
 (0)