I was able to make some workaround.
You need to install extension multi-command
.
Add this code in settings.json
"multiCommand.commands": [
{
"command": "multiCommand.executeIPython",
"sequence": [
"python.execSelectionInTerminal",
"workbench.action.terminal.focus",
"workbench.action.terminal.scrollToBottom",
{"command": "workbench.action.terminal.sendSequence",
"args": { "text": "u000D" }},
"workbench.action.focusActiveEditorGroup"
]
},
]
And then you can use this command as shortcut (add to keybindings.json
):
{
"key": "shift+enter",
"command": "multiCommand.executeIPython",
"when": "editorTextFocus && !findInputFocussed && !python.datascience.ownsSelection && !replaceInputFocussed && editorLangId == 'python'"
}
Unfortunately for the first time (when ipython console is not opened) you need to hit enter. But later it works as it should.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…