Skip to content

Commit 45a07fe

Browse files
committed
Open signature file after generation.
1 parent 132b25c commit 45a07fe

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

ReSharper.FSharp/src/FSharp.Psi.Intentions/src/Intentions/GenerateSignatureFileAction.fs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
namespace JetBrains.ReSharper.Plugins.FSharp.Psi.Features.ContextActions
22

33
open System.IO
4+
open JetBrains.Application.UI.PopupLayout
5+
open JetBrains.ReSharper.Feature.Services.Navigation
46
open JetBrains.ReSharper.Psi.Tree
57
open JetBrains.DocumentManagers.Transactions.ProjectHostActions.Ordering
68
open JetBrains.ProjectModel.ProjectsHost
@@ -13,6 +15,7 @@ open JetBrains.ReSharper.Plugins.FSharp.Psi.Impl.Tree
1315
open JetBrains.ReSharper.Plugins.FSharp.Psi.Tree
1416
open JetBrains.ReSharper.Psi
1517
open JetBrains.ReSharper.Psi.ExtensionsAPI.Tree
18+
open JetBrains.ReSharper.Resources.Shell
1619

1720
// extract value -> ctrl alt v
1821
// undo that -> ctrl alt n
@@ -92,10 +95,19 @@ type GenerateSignatureFileAction(dataProvider: FSharpContextActionDataProvider)
9295
solution.InvokeUnderTransaction(fun transactionCookie ->
9396
let virtualPath = FileSystemPath.TryParse(fsiFile).ToVirtualFileSystemPath()
9497
let relativeTo = RelativeTo(projectFile, RelativeToType.Before)
95-
transactionCookie.AddFile(projectFile.ParentFolder, virtualPath, context = OrderingContext(relativeTo))
96-
|> ignore)
98+
let projectFile = transactionCookie.AddFile(projectFile.ParentFolder, virtualPath, context = OrderingContext(relativeTo))
99+
100+
if (not Shell.Instance.IsTestShell) then
101+
let navigationOptions = NavigationOptions.FromWindowContext(Shell.Instance.GetComponent<IMainWindowPopupWindowContext>().Source, "")
102+
NavigationManager
103+
.GetInstance(solution)
104+
.Navigate(
105+
ProjectFileNavigationPoint(projectFile),
106+
navigationOptions
107+
)
108+
|> ignore
109+
)
97110

98-
// TODO: it would be nice if we opened the signature file that was just created. Maybe split?
99111
null
100112

101113
// First test name would be: ``ModuleStructure 01`` , ``NamespaceStructure 01``

0 commit comments

Comments
 (0)