@@ -935,6 +935,11 @@ module SolutionExplorer =
935935 None)
936936 |> context.Subscribe
937937
938+ let treeOptions = createEmpty< TreeViewOptions< Model>>
939+ treeOptions.treeDataProvider <- provider
940+ let treeView = window.createTreeView ( treeViewId, treeOptions)
941+ context.subscriptions.Add( unbox ( box treeView))
942+
938943 commands.registerCommand ( " fsharp.NewProject" , newProject |> objfy2)
939944 |> context.Subscribe
940945
@@ -957,25 +962,27 @@ module SolutionExplorer =
957962
958963 commands.registerCommand (
959964 " fsharp.explorer.moveUp" ,
960- objfy2 ( fun m ->
961- match unbox m with
962- | File(_, _, name, Some virtPath, proj) -> FsProjEdit.moveFileUpPath proj virtPath
963- | _ -> undefined
964- |> ignore
965-
966- None)
965+ objfy2 (
966+ Option.ofObj
967+ >> Option.map unbox
968+ >> Option.orElseWith ( fun () -> treeView.selection |> Seq.tryHead)
969+ >> Option.iter ( function
970+ | File(_, _, _, Some virtPath, proj) -> FsProjEdit.moveFileUpPath proj virtPath |> ignore
971+ | _ -> ())
972+ )
967973 )
968974 |> context.Subscribe
969975
970976 commands.registerCommand (
971977 " fsharp.explorer.moveDown" ,
972- objfy2 ( fun m ->
973- match unbox m with
974- | File(_, _, name, Some virtPath, proj) -> FsProjEdit.moveFileDownPath proj virtPath
975- | _ -> undefined
976- |> ignore
977-
978- None)
978+ objfy2 (
979+ Option.ofObj
980+ >> Option.map unbox
981+ >> Option.orElseWith ( fun () -> treeView.selection |> Seq.tryHead)
982+ >> Option.iter ( function
983+ | File(_, _, _, Some virtPath, proj) -> FsProjEdit.moveFileDownPath proj virtPath |> ignore
984+ | _ -> ())
985+ )
979986 )
980987 |> context.Subscribe
981988
@@ -1154,11 +1161,6 @@ module SolutionExplorer =
11541161 )
11551162 |> context.Subscribe
11561163
1157- let treeOptions = createEmpty< TreeViewOptions< Model>>
1158- treeOptions.treeDataProvider <- provider
1159- let treeView = window.createTreeView ( treeViewId, treeOptions)
1160- context.subscriptions.Add( unbox ( box treeView))
1161-
11621164 NodeReveal.activate context rootChanged.event treeView
11631165
11641166 let wsProvider =
0 commit comments