Search code examples
pythonipythonvisual-studio-code

VS Code execute selection to IPython shell in terminal (no notebook)


I wanted to use IPython interactive in VSC (not using a notebook). By using a keybiding for workbench.action.terminal.runSelectedText, I can successfully execute a selection to a python interactive shell, but with iPython it fails to run the cell and I have to change selection to the terminal and press enter.

enter image description here

Here's my keybidings.json file:

[
    {
        "key": "ctrl+enter",
        "command": "workbench.action.terminal.runSelectedText"
    }
]

Any help to solve this is much appreciated! Ideally, a keybinding configuration that includes an extra enter.


Solution

  • I have this problem when I upgraded IPython to version 7.30.1 The solution I found is that add "--simple-prompt", this is not perfect (just no color theme or auto completion), but at very least, you don't need to press enter when sending codes to run.