From f33922552669973fe85e80c65c12626bb3cf0427 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Wed, 23 Dec 2020 14:16:11 -0800 Subject: [PATCH 1/4] Wire up config across vimlist / vimtrees --- .../Accordion/Component_Accordion.re | 4 +++ src/Components/Output/Component_Output.re | 2 ++ src/Components/Output/Component_Output.rei | 1 + src/Components/VimList/Component_VimList.re | 9 ++++-- src/Components/VimList/dune | 1 + src/Components/VimTree/Component_VimTree.re | 2 ++ src/Components/VimTree/Component_VimTree.rei | 1 + .../Configuration/GlobalConfiguration.re | 10 +++++++ src/Feature/Editor/Feature_Editor.re | 28 ++++++++++--------- src/Feature/Pane/DiagnosticsPaneView.re | 2 ++ src/Feature/Pane/Feature_Pane.re | 6 ++++ src/Feature/Pane/LocationsPaneView.re | 2 ++ src/Feature/Pane/NotificationsPaneView.re | 2 ++ src/Feature/Search/Feature_Search.re | 2 ++ src/Feature/Search/Feature_Search.rei | 1 + src/Store/Features.re | 15 ++++++---- 16 files changed, 66 insertions(+), 22 deletions(-) diff --git a/src/Components/Accordion/Component_Accordion.re b/src/Components/Accordion/Component_Accordion.re index 73817334b5..c74d133ab8 100644 --- a/src/Components/Accordion/Component_Accordion.re +++ b/src/Components/Accordion/Component_Accordion.re @@ -135,6 +135,7 @@ module Common = { module VimList = { let make = ( + ~config, ~showCount=true, ~title, ~expanded, @@ -150,6 +151,7 @@ module VimList = { let count = Component_VimList.count(model); let contents = 0 ? _ = - (~isActive, ~font, ~focusedIndex, ~theme, ~model, ~dispatch, ~render, ()) => { + (~config, ~isActive, ~font, ~focusedIndex, ~theme, ~model, ~dispatch, ~render, ()) => { component(hooks => { let {rowHeight, viewportWidth, viewportHeight, _} = model; @@ -858,8 +858,11 @@ module View = { hooks, ); let scroll = (wheelEvent: NodeEvents.mouseWheelEventParams) => { + + let mouseWheelPixels = + Feature_Configuration.GlobalConfiguration.Editor.mouseWheelScrollPixels.get(config); let delta = - wheelEvent.deltaY *. float(- Constants.scrollWheelMultiplier); + wheelEvent.deltaY *. -1. *. mouseWheelPixels; dispatch(MouseWheelScrolled({delta: delta})); }; diff --git a/src/Components/VimList/dune b/src/Components/VimList/dune index a1ed07148b..3ed7ca4e4a 100644 --- a/src/Components/VimList/dune +++ b/src/Components/VimList/dune @@ -3,6 +3,7 @@ (public_name Oni2.component.vimList) (inline_tests) (libraries Oni2.core Oni2.component.inputText Oni2.components Revery + Oni2.feature.configuration isolinear Oni2.feature.commands Oni2.feature.sneak) (preprocess (pps ppx_inline_test ppx_let ppx_deriving.show brisk-reconciler.ppx))) diff --git a/src/Components/VimTree/Component_VimTree.re b/src/Components/VimTree/Component_VimTree.re index f27f8b1691..bfc095bb05 100644 --- a/src/Components/VimTree/Component_VimTree.re +++ b/src/Components/VimTree/Component_VimTree.re @@ -452,6 +452,7 @@ module View = { ; let make = ( + ~config, ~isActive, ~font, ~focusedIndex, @@ -479,6 +480,7 @@ module View = { }; { +let update = (~config, editor, msg) => { + let mouseWheelScroll = + Feature_Configuration.GlobalConfiguration.Editor.mouseWheelScrollPixels.get(config); switch (msg) { | VerticalScrollbarAfterTrackClicked({newPixelScrollY}) | VerticalScrollbarBeforeTrackClicked({newPixelScrollY}) @@ -49,8 +51,8 @@ let update = (editor, msg) => { ) | MinimapMouseWheel({deltaWheel}) => ( Editor.scrollDeltaPixelY( - ~animated=false, - ~pixelY=deltaWheel *. Constants.minimapWheelMultiplier, + ~animated=true, + ~pixelY=deltaWheel *. mouseWheelScroll *. Constants.minimapWheelMultiplier, editor, ), Nothing, @@ -65,18 +67,18 @@ let update = (editor, msg) => { ) | EditorMouseWheel({deltaX, deltaY, shiftKey}) => ( Editor.scrollDeltaPixelXY( - ~animated=false, + ~animated=true, ~pixelX= - (shiftKey ? deltaY : deltaX) *. Constants.editorWheelMultiplier, - ~pixelY=(shiftKey ? 0. : deltaY) *. Constants.editorWheelMultiplier, + (shiftKey ? deltaY : deltaX) *. mouseWheelScroll *. Constants.editorWheelMultiplier, + ~pixelY=(shiftKey ? 0. : deltaY) *. mouseWheelScroll *. Constants.editorWheelMultiplier, editor, ), Nothing, ) | VerticalScrollbarMouseWheel({deltaWheel}) => ( Editor.scrollDeltaPixelY( - ~animated=false, - ~pixelY=deltaWheel *. Constants.scrollbarWheelMultiplier, + ~animated=true, + ~pixelY=deltaWheel *. mouseWheelScroll *. Constants.scrollbarWheelMultiplier, editor, ), Nothing, @@ -89,8 +91,8 @@ let update = (editor, msg) => { ) | HorizontalScrollbarMouseWheel({deltaWheel}) => ( Editor.scrollDeltaPixelX( - ~animated=false, - ~pixelX=deltaWheel *. Constants.scrollbarWheelMultiplier, + ~animated=true, + ~pixelX=deltaWheel *. mouseWheelScroll *. Constants.scrollbarWheelMultiplier, editor, ), Nothing, diff --git a/src/Feature/Pane/DiagnosticsPaneView.re b/src/Feature/Pane/DiagnosticsPaneView.re index 3f841187dd..e2b2f46b21 100644 --- a/src/Feature/Pane/DiagnosticsPaneView.re +++ b/src/Feature/Pane/DiagnosticsPaneView.re @@ -32,6 +32,7 @@ module Styles = { let make = ( + ~config, ~isFocused: bool, ~diagnosticsList: Component_VimTree.model(string, LocationListItem.t), ~theme, @@ -54,6 +55,7 @@ let make = ; } else { | Notifications => Option.map(model => { ; } else { ; } else { Isolinear.Effect.map(msg => Actions.Workspace(msg)); - let updateEditor = (~editorId, ~msg, layout) => { + let updateEditor = (~config, ~editorId, ~msg, layout) => { switch (Feature_Layout.editorById(editorId, layout)) { | Some(editor) => open Feature_Editor; - let (updatedEditor, outmsg) = update(editor, msg); + let (updatedEditor, outmsg) = update(~config, editor, msg); let layout = Feature_Layout.map( editor => Editor.getId(editor) == editorId ? updatedEditor : editor, @@ -115,6 +115,7 @@ module Internal = { let updateEditors = ( + ~config: Config.resolver, ~scope: EditorScope.t, ~msg: Feature_Editor.msg, layout: Feature_Layout.model, @@ -126,14 +127,14 @@ module Internal = { (prev, editor) => { let (layout, effects) = prev; let editorId = Feature_Editor.Editor.getId(editor); - let (layout', effect') = updateEditor(~editorId, ~msg, layout); + let (layout', effect') = updateEditor(~config, ~editorId, ~msg, layout); (layout', [effect', ...effects]); }, (layout, []), layout, ); (layout', Isolinear.Effect.batch(effects)); - | Editor(editorId) => updateEditor(~editorId, ~msg, layout) + | Editor(editorId) => updateEditor(~config, ~editorId, ~msg, layout) }; }; @@ -207,7 +208,8 @@ module Internal = { let msg: Feature_Editor.msg = ModeChanged({allowAnimation, mode, effects}); let scope = EditorScope.Editor(activeEditorId); - let (layout, editorEffect) = updateEditors(~scope, ~msg, state.layout); + let config = Selectors.configResolver(state); + let (layout, editorEffect) = updateEditors(~config, ~scope, ~msg, state.layout); let isInInsertMode = Vim.Mode.isInsert( @@ -1399,8 +1401,9 @@ let update = (state, eff); | Editor({scope, msg}) => + let config = Selectors.configResolver(state); let (layout, effect) = - Internal.updateEditors(~scope, ~msg, state.layout); + Internal.updateEditors(~config, ~scope, ~msg, state.layout); let state = {...state, layout}; (state, effect); From 776cad9d5d2123e7ef19f4ec1ad00c5d091b72a5 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Fri, 28 May 2021 14:46:14 -0700 Subject: [PATCH 2/4] Initial merge --- src/Feature/SCM/Feature_SCM.re | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Feature/SCM/Feature_SCM.re b/src/Feature/SCM/Feature_SCM.re index a725b02114..1685aedac7 100644 --- a/src/Feature/SCM/Feature_SCM.re +++ b/src/Feature/SCM/Feature_SCM.re @@ -1037,6 +1037,7 @@ module Pane = { let groupView = ( + ~config, ~provider, ~group: ResourceGroup.t, ~iconTheme, @@ -1070,6 +1071,7 @@ module Pane = { />; }; Option.value(~default=true); Date: Tue, 1 Jun 2021 12:42:05 -0700 Subject: [PATCH 3/4] More merging --- src/Feature/Notification/Pane.re | 3 +- src/Feature/Pane/Feature_Pane.re | 124 ------------------------------- src/Feature/SCM/Feature_SCM.rei | 1 + 3 files changed, 3 insertions(+), 125 deletions(-) diff --git a/src/Feature/Notification/Pane.re b/src/Feature/Notification/Pane.re index 3f4fb34465..145343603d 100644 --- a/src/Feature/Notification/Pane.re +++ b/src/Feature/Notification/Pane.re @@ -162,7 +162,7 @@ module View = { ]; }; let make = - (~isFocused: bool, ~model: t, ~theme, ~uiFont: UiFont.t, ~dispatch, ()) => { + (~config, ~isFocused: bool, ~model: t, ~theme, ~uiFont: UiFont.t, ~dispatch, ()) => { let innerElement = if (Component_VimList.count(model.notificationsView) == 0) { @@ -175,6 +175,7 @@ module View = { ; } else { - switch (selected) { - | Locations => - - - | Diagnostics => - - | Notifications => - - dispatch(DismissNotificationClicked(notification)) - } - /> - | Output => - outputPane - |> Option.map(model => { - - }) - |> Option.value(~default=React.empty) -======= ) => { switch (activePane) { | None => React.empty @@ -430,7 +375,6 @@ module View = { ); } ) ->>>>>>> master }; }; @@ -518,73 +462,6 @@ module View = { : Feature_Configuration.GlobalConfiguration.inactiveWindowOpacity.get( config, ); -<<<<<<< HEAD - - - - dispatch(Msg.resizeHandleDragged(int_of_float(delta))) - } - onDragComplete={() => dispatch(Msg.resizeCommitted)} - /> - - - - - - - - - - - - dispatch(DiagnosticsList(msg))} - locationsDispatch={msg => dispatch(LocationsList(msg))} - notificationsDispatch={msg => dispatch(NotificationsList(msg))} - outputDispatch={msg => dispatch(OutputPane(msg))} - workingDirectory - /> - - ; -======= height == 0 ? React.empty : ; ->>>>>>> master }; }; diff --git a/src/Feature/SCM/Feature_SCM.rei b/src/Feature/SCM/Feature_SCM.rei index 82762f2eb6..98b752e6f8 100644 --- a/src/Feature/SCM/Feature_SCM.rei +++ b/src/Feature/SCM/Feature_SCM.rei @@ -100,6 +100,7 @@ module Pane: { let make: ( ~key: Brisk_reconciler.Key.t=?, + ~config: Oni_Core.Config.resolver, ~model: model, ~workingDirectory: string, ~isFocused: bool, From 45c5424e64d4f07f0b56c4969534bf3d970d322f Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Tue, 1 Jun 2021 13:59:16 -0700 Subject: [PATCH 4/4] Finish merge, clean-up --- src/Components/VimList/Component_VimList.re | 21 ++++++++++++---- .../Configuration/GlobalConfiguration.re | 6 +---- src/Feature/Editor/Feature_Editor.re | 24 +++++++++++++------ src/Feature/Extensions/Feature_Extensions.rei | 1 + src/Feature/Extensions/ListView.re | 4 ++++ .../Notification/Feature_Notification.re | 3 ++- src/Feature/Notification/Pane.re | 10 +++++++- src/Feature/Output/Pane.re | 16 +++++++++++-- src/Feature/SCM/Feature_SCM.re | 2 +- src/Store/Features.re | 6 ++--- src/UI/SideBarView.re | 2 ++ 11 files changed, 70 insertions(+), 25 deletions(-) diff --git a/src/Components/VimList/Component_VimList.re b/src/Components/VimList/Component_VimList.re index 451491467b..5fcaa54cf3 100644 --- a/src/Components/VimList/Component_VimList.re +++ b/src/Components/VimList/Component_VimList.re @@ -986,7 +986,17 @@ module View = { unit ) => _ = - (~config, ~isActive, ~font, ~focusedIndex, ~theme, ~model, ~dispatch, ~render, ()) => { + ( + ~config, + ~isActive, + ~font, + ~focusedIndex, + ~theme, + ~model, + ~dispatch, + ~render, + (), + ) => { component(hooks => { let {rowHeight, viewportWidth, viewportHeight, _} = model; @@ -1005,11 +1015,12 @@ module View = { hooks, ); let scroll = (wheelEvent: NodeEvents.mouseWheelEventParams) => { - let mouseWheelPixels = - Feature_Configuration.GlobalConfiguration.Editor.mouseWheelScrollPixels.get(config); - let delta = - wheelEvent.deltaY *. -1. *. mouseWheelPixels; + Feature_Configuration.GlobalConfiguration.Editor.mouseWheelScrollPixels. + get( + config, + ); + let delta = wheelEvent.deltaY *. (-1.) *. mouseWheelPixels; dispatch(MouseWheelScrolled({delta: delta})); }; diff --git a/src/Feature/Configuration/GlobalConfiguration.re b/src/Feature/Configuration/GlobalConfiguration.re index 912f7828ba..54b8dd3fa3 100644 --- a/src/Feature/Configuration/GlobalConfiguration.re +++ b/src/Feature/Configuration/GlobalConfiguration.re @@ -226,11 +226,7 @@ module Editor = { ); let mouseWheelScrollPixels = - setting( - "editor.mouseWheelScrollPixels", - float, - ~default=50. - ) + setting("editor.mouseWheelScrollPixels", float, ~default=50.); let lineHeight = setting( ~vim=VimSettings.lineSpace, diff --git a/src/Feature/Editor/Feature_Editor.re b/src/Feature/Editor/Feature_Editor.re index f5690b2f1a..bb677521cb 100644 --- a/src/Feature/Editor/Feature_Editor.re +++ b/src/Feature/Editor/Feature_Editor.re @@ -41,8 +41,10 @@ module Constants = { }; let update = (~config, editor, msg) => { - let mouseWheelScroll = - Feature_Configuration.GlobalConfiguration.Editor.mouseWheelScrollPixels.get(config); + let mouseWheelScroll = + Feature_Configuration.GlobalConfiguration.Editor.mouseWheelScrollPixels.get( + config, + ); switch (msg) { | VerticalScrollbarAfterTrackClicked({newPixelScrollY}) | VerticalScrollbarBeforeTrackClicked({newPixelScrollY}) @@ -53,7 +55,8 @@ let update = (~config, editor, msg) => { | MinimapMouseWheel({deltaWheel}) => ( Editor.scrollDeltaPixelY( ~animated=true, - ~pixelY=deltaWheel *. mouseWheelScroll *. Constants.minimapWheelMultiplier, + ~pixelY= + deltaWheel *. mouseWheelScroll *. Constants.minimapWheelMultiplier, editor, ), Nothing, @@ -70,8 +73,13 @@ let update = (~config, editor, msg) => { Editor.scrollDeltaPixelXY( ~animated=true, ~pixelX= - (shiftKey ? deltaY : deltaX) *. mouseWheelScroll *. Constants.editorWheelMultiplier, - ~pixelY=(shiftKey ? 0. : deltaY) *. mouseWheelScroll *. Constants.editorWheelMultiplier, + (shiftKey ? deltaY : deltaX) + *. mouseWheelScroll + *. Constants.editorWheelMultiplier, + ~pixelY= + (shiftKey ? 0. : deltaY) + *. mouseWheelScroll + *. Constants.editorWheelMultiplier, editor, ), Nothing, @@ -79,7 +87,8 @@ let update = (~config, editor, msg) => { | VerticalScrollbarMouseWheel({deltaWheel}) => ( Editor.scrollDeltaPixelY( ~animated=true, - ~pixelY=deltaWheel *. mouseWheelScroll *. Constants.scrollbarWheelMultiplier, + ~pixelY= + deltaWheel *. mouseWheelScroll *. Constants.scrollbarWheelMultiplier, editor, ), Nothing, @@ -93,7 +102,8 @@ let update = (~config, editor, msg) => { | HorizontalScrollbarMouseWheel({deltaWheel}) => ( Editor.scrollDeltaPixelX( ~animated=true, - ~pixelX=deltaWheel *. mouseWheelScroll *. Constants.scrollbarWheelMultiplier, + ~pixelX= + deltaWheel *. mouseWheelScroll *. Constants.scrollbarWheelMultiplier, editor, ), Nothing, diff --git a/src/Feature/Extensions/Feature_Extensions.rei b/src/Feature/Extensions/Feature_Extensions.rei index e2e0bf200e..aa478c0901 100644 --- a/src/Feature/Extensions/Feature_Extensions.rei +++ b/src/Feature/Extensions/Feature_Extensions.rei @@ -99,6 +99,7 @@ module ListView: { let make: ( ~key: Brisk_reconciler.Key.t=?, + ~config: Config.resolver, ~model: model, ~proxy: Service_Net.Proxy.t, ~theme: ColorTheme.Colors.t, diff --git a/src/Feature/Extensions/ListView.re b/src/Feature/Extensions/ListView.re index bd1bc9aae6..e4a0cde510 100644 --- a/src/Feature/Extensions/ListView.re +++ b/src/Feature/Extensions/ListView.re @@ -123,6 +123,7 @@ let versionToString: option(Semver.t) => string = let%component make = ( + ~config, ~model, ~proxy, ~theme, @@ -220,6 +221,7 @@ let%component make = [ , Isolinear.Sub.none, ~view= ( - ~config as _, + ~config, ~editorFont as _, ~font, ~isFocused, @@ -495,6 +495,7 @@ module Contributions = { ~model, ) => { + ( + ~config, + ~isFocused: bool, + ~model: t, + ~theme, + ~uiFont: UiFont.t, + ~dispatch, + (), + ) => { let innerElement = if (Component_VimList.count(model.notificationsView) == 0) { diff --git a/src/Feature/Output/Pane.re b/src/Feature/Output/Pane.re index 533c4ae8f6..49cf15a5cf 100644 --- a/src/Feature/Output/Pane.re +++ b/src/Feature/Output/Pane.re @@ -55,10 +55,21 @@ let update = (msg, model) => { module View = { open Revery.UI; - let make = (~model, ~isActive, ~editorFont, ~uiFont, ~theme, ~dispatch, ()) => { + let make = + ( + ~config, + ~model, + ~isActive, + ~editorFont, + ~uiFont, + ~theme, + ~dispatch, + (), + ) => { model.output |> Option.map(model => { Isolinear.Sub.none, ~view= ( - ~config as _, + ~config, ~editorFont, ~font, ~isFocused, @@ -96,6 +107,7 @@ let pane = { ~model, ) => Option.value(~default=true); updateEditor(~config, ~client, ~editorId, ~msg, layout) + | Editor(editorId) => + updateEditor(~config, ~client, ~editorId, ~msg, layout) }; }; @@ -285,7 +286,6 @@ module Internal = { |> Feature_Layout.activeEditor |> Feature_Editor.Editor.getPrimaryCursor; - let config = Selectors.configResolver(state); let editor = Feature_Layout.activeEditor(state.layout); let maybeBuffer = Selectors.getActiveBuffer(state); @@ -301,7 +301,7 @@ module Internal = { let msg: Feature_Editor.msg = ModeChanged({allowAnimation, mode, effects}); let scope = EditorScope.Editor(activeEditorId); - let config = Selectors.configResolver(state); + let config = Selectors.configResolver(state); let (layout, editorEffect) = updateEditors(~config, ~client, ~scope, ~msg, state.layout); diff --git a/src/UI/SideBarView.re b/src/UI/SideBarView.re index ae0ebd1084..894944b0d5 100644 --- a/src/UI/SideBarView.re +++ b/src/UI/SideBarView.re @@ -101,6 +101,7 @@ let make = (~key=?, ~config, ~theme, ~state: State.t, ~dispatch, ()) => { | SCM => { | Extensions => let extensionDispatch = msg => dispatch(Actions.Extensions(msg)); Feature_Proxy.proxy} theme