Skip to content Skip to sidebar Skip to footer

How Can I Force Shift+enter To Run Selection And Execute It Immediately Running Ipython In Vscode?

I have added the setting below in vscode to launch ipython when i used shift+enter to run selection. 'python.terminal.launchArgs': [ '-c', '\'from IPython import start_ipy

Solution 1:

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","interval":40,"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.

Edit: With interval param it works better. Thanks to: DEVNULLDNE answer

Post a Comment for "How Can I Force Shift+enter To Run Selection And Execute It Immediately Running Ipython In Vscode?"