From 381ac17eeac81f93ce15c0d1c6b4293f9112f5dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hilmar=20G=C3=BAstafsson?= Date: Sat, 3 Apr 2021 01:21:20 +0200 Subject: [PATCH] feat(keybindings): add binding for opening config (#3352) * feat(keybindings): add binding for opening config * Fix condition: IsMac -> isMac * Add CHANGES entry Co-authored-by: Bryan Phelps --- CHANGES_CURRENT.md | 1 + src/Feature/Configuration/Feature_Configuration.re | 14 ++++++++++++++ .../Configuration/Feature_Configuration.rei | 5 ++++- src/Model/State.re | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/CHANGES_CURRENT.md b/CHANGES_CURRENT.md index 4ea7064e6c..36ade5ca01 100644 --- a/CHANGES_CURRENT.md +++ b/CHANGES_CURRENT.md @@ -3,6 +3,7 @@ - #3284 - Definition: Add 'editor.action.revealDefinitionAside' command (fixes #3261) - #2881 - Extensions: Initial rename support - #3348 - Code Actions: Implement extension host protocol for quick fix / code actions +- #3352 - Keybindings: Add default keybinding for open configuration (related #1423, thanks @LiHRaM !) ### Bug Fixes diff --git a/src/Feature/Configuration/Feature_Configuration.re b/src/Feature/Configuration/Feature_Configuration.re index 87ba2880a2..8a1ba7aa6c 100644 --- a/src/Feature/Configuration/Feature_Configuration.re +++ b/src/Feature/Configuration/Feature_Configuration.re @@ -333,8 +333,22 @@ module Commands = { ); }; +module Keybindings = { + open Feature_Input.Schema; + + let command = Commands.openConfigurationFile.id; + + let openConfigOnMac = + bind(~key="", ~condition="isMac" |> WhenExpr.parse, ~command); + + let openConfigOnOther = + bind(~key="", ~condition="!isMac" |> WhenExpr.parse, ~command); +}; + // CONTRIBUTIONS module Contributions = { let commands = Commands.[openConfigurationFile, reload]; + + let keybindings = Keybindings.[openConfigOnMac, openConfigOnOther]; }; diff --git a/src/Feature/Configuration/Feature_Configuration.rei b/src/Feature/Configuration/Feature_Configuration.rei index 5cab83eb8e..b41f490164 100644 --- a/src/Feature/Configuration/Feature_Configuration.rei +++ b/src/Feature/Configuration/Feature_Configuration.rei @@ -74,6 +74,9 @@ module GlobalConfiguration = GlobalConfiguration; // CONTRIBUTIONS -module Contributions: {let commands: list(Oni_Core.Command.t(msg));}; +module Contributions: { + let commands: list(Oni_Core.Command.t(msg)); + let keybindings: list(Feature_Input.Schema.keybinding); +}; module Testing: {let transform: ConfigurationTransformer.t => msg;}; diff --git a/src/Model/State.re b/src/Model/State.re index 621e341f91..276809ae52 100644 --- a/src/Model/State.re +++ b/src/Model/State.re @@ -32,6 +32,7 @@ let defaultKeyBindings = ] @ Feature_SideBar.Contributions.keybindings @ Feature_Clipboard.Contributions.keybindings + @ Feature_Configuration.Contributions.keybindings @ Feature_Input.Schema.[ bind( ~key="",