Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(keybindings): add binding for opening config #3352

Merged
merged 5 commits into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES_CURRENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
14 changes: 14 additions & 0 deletions src/Feature/Configuration/Feature_Configuration.re
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,22 @@ module Commands = {
);
};

module Keybindings = {
open Feature_Input.Schema;

let command = Commands.openConfigurationFile.id;

let openConfigOnMac =
bind(~key="<D-,>", ~condition="isMac" |> WhenExpr.parse, ~command);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the condition is case-sensitive (which may be a bug itself) - flipped from IsMac -> isMac.


let openConfigOnOther =
bind(~key="<C-,>", ~condition="!isMac" |> WhenExpr.parse, ~command);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was worried this might conflict with a default Vim keybinding, but doesn't appear that it does 👍

};

// CONTRIBUTIONS

module Contributions = {
let commands = Commands.[openConfigurationFile, reload];

let keybindings = Keybindings.[openConfigOnMac, openConfigOnOther];
};
5 changes: 4 additions & 1 deletion src/Feature/Configuration/Feature_Configuration.rei
Original file line number Diff line number Diff line change
Expand Up @@ -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;};
1 change: 1 addition & 0 deletions src/Model/State.re
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ let defaultKeyBindings =
]
@ Feature_SideBar.Contributions.keybindings
@ Feature_Clipboard.Contributions.keybindings
@ Feature_Configuration.Contributions.keybindings
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for wiring this up!

@ Feature_Input.Schema.[
bind(
~key="<C-TAB>",
Expand Down