diff --git a/release/package.json b/release/package.json index 64e9720a..362d0a0d 100644 --- a/release/package.json +++ b/release/package.json @@ -1039,6 +1039,16 @@ "mac": "alt\u002Bshift\u002BEnter", "when": "editorFocus \u0026\u0026 !findWidgetVisible \u0026\u0026 editorLangId == \u0027fsharp\u0027" }, + { + "command": "fsharp.explorer.moveUp", + "key": "alt\u002Bup", + "when": "focusedView == 'ionide.projectExplorerInActivity' \u007C\u007C focusedView == 'ionide.projectExplorer'" + }, + { + "command": "fsharp.explorer.moveDown", + "key": "alt\u002Bdown", + "when": "focusedView == 'ionide.projectExplorerInActivity' \u007C\u007C focusedView == 'ionide.projectExplorer'" + }, { "command": "fsharp.generateDoc", "key": "alt\u002Bshift\u002Bj", diff --git a/src/Components/SolutionExplorer.fs b/src/Components/SolutionExplorer.fs index eaf7c323..50af3f97 100644 --- a/src/Components/SolutionExplorer.fs +++ b/src/Components/SolutionExplorer.fs @@ -935,6 +935,11 @@ module SolutionExplorer = None) |> context.Subscribe + let treeOptions = createEmpty> + treeOptions.treeDataProvider <- provider + let treeView = window.createTreeView (treeViewId, treeOptions) + context.subscriptions.Add(unbox (box treeView)) + commands.registerCommand ("fsharp.NewProject", newProject |> objfy2) |> context.Subscribe @@ -957,25 +962,27 @@ module SolutionExplorer = commands.registerCommand ( "fsharp.explorer.moveUp", - objfy2 (fun m -> - match unbox m with - | File(_, _, name, Some virtPath, proj) -> FsProjEdit.moveFileUpPath proj virtPath - | _ -> undefined - |> ignore - - None) + objfy2 ( + Option.ofObj + >> Option.map unbox + >> Option.orElseWith (fun () -> treeView.selection |> Seq.tryHead) + >> Option.iter (function + | File(_, _, _, Some virtPath, proj) -> FsProjEdit.moveFileUpPath proj virtPath |> ignore + | _ -> ()) + ) ) |> context.Subscribe commands.registerCommand ( "fsharp.explorer.moveDown", - objfy2 (fun m -> - match unbox m with - | File(_, _, name, Some virtPath, proj) -> FsProjEdit.moveFileDownPath proj virtPath - | _ -> undefined - |> ignore - - None) + objfy2 ( + Option.ofObj + >> Option.map unbox + >> Option.orElseWith (fun () -> treeView.selection |> Seq.tryHead) + >> Option.iter (function + | File(_, _, _, Some virtPath, proj) -> FsProjEdit.moveFileDownPath proj virtPath |> ignore + | _ -> ()) + ) ) |> context.Subscribe @@ -1154,11 +1161,6 @@ module SolutionExplorer = ) |> context.Subscribe - let treeOptions = createEmpty> - treeOptions.treeDataProvider <- provider - let treeView = window.createTreeView (treeViewId, treeOptions) - context.subscriptions.Add(unbox (box treeView)) - NodeReveal.activate context rootChanged.event treeView let wsProvider =