Skip to content

Commit

Permalink
contribute standard interactive execute keybindings from core (micros…
Browse files Browse the repository at this point in the history
…oft#212305)

contribute shift+execute from core
  • Loading branch information
amunger committed May 9, 2024
1 parent 9eff384 commit 90dfd06
Showing 1 changed file with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -434,15 +434,29 @@ registerAction2(class extends Action2 {
id: 'interactive.execute',
title: localize2('interactive.execute', 'Execute Code'),
category: interactiveWindowCategory,
keybinding: {
keybinding: [{
when: ContextKeyExpr.and(
ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive'),
ContextKeyExpr.equals('config.interactiveWindow.executeWithShiftEnter', true)
),
primary: KeyMod.Shift | KeyCode.Enter,
weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
}, {
when: ContextKeyExpr.and(
ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive'),
ContextKeyExpr.equals('config.interactiveWindow.executeWithShiftEnter', false)
),
primary: KeyCode.Enter,
weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
}, {
// when: NOTEBOOK_CELL_LIST_FOCUSED,
when: ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive'),
primary: KeyMod.WinCtrl | KeyCode.Enter,
win: {
primary: KeyMod.CtrlCmd | KeyCode.Enter
},
weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
},
}],
menu: [
{
id: MenuId.InteractiveInputExecute
Expand Down Expand Up @@ -810,3 +824,16 @@ Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).regis
}
}
});

Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration).registerConfiguration({
id: 'interactiveWindow',
order: 100,
type: 'object',
'properties': {
['executeWithShiftEnter']: {
type: 'boolean',
default: true,
markdownDescription: localize('interactiveWindow.executeWithShiftEnter', "Execute the interactive window (REPL) input box with shift+enter, so that enter can be used to create a newline.")
}
}
});

0 comments on commit 90dfd06

Please sign in to comment.