Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Switching focus to Jupyter (IPython) terminal in Visual Studio Code

I would like to place the focus from an editor buffer into the IPython terminal using only the keyboard.

I see two approaches, but they both do not seem to work.

  1. Shift the focus from the editor to the terminal using workbench.action.terminal.focusNext or something alike using ctrl+backtick. This seems to be a dead end because all it ever does is shift focus to or activate a terminal in the dedicated terminal buffer at the bottom of all panes.
  2. Using ctrl+{1...n} to focus on another pane. This works for other editor buffers: I switch the focus to the pane, and the focus goes into the most recent editor buffer. However, this does not work as expected for the IPython terminal: focus does switch to the pane (or group, as it is called in the left vertical side-bar), but does not go into the terminal itself.

This really is unfortunate as in my workflow, I often go forth and back between the editor and the terminal. Of course an alternative is to make a cell in the editor and execute that using shift+enter, but that is less interactive that what I would prefer.

My impression is that the IPython terminal for VSCode is something in-between an editor and a terminal, or that the action is caught in between VSCode and the Jupyter server.

Version info:

  • Version: 1.32.1 (system setup)
  • Commit: 05f146c7a8f7f78e80261aa3b2a2e642586f9eb3
  • Date: 2019-03-08T00:51:49.278Z
  • Electron: 3.1.3
  • Chrome: 66.0.3359.181
  • Node.js: 10.2.0
  • V8: 6.6.346.32
  • OS: Windows_NT x64 6.1.7601
like image 549
c06n Avatar asked Mar 10 '19 07:03

c06n


People also ask

How do I enable IPython in VS Code?

Type Ipython inside the terminal window. Then select the line or lines you want to run from the editor window and then click on the Terminal menu at the top of VScode window. One option in the Terminal menu is to "Run Selected Text". This will be run in the Ipython terminal window.

How do I run a Jupyter Notebook in VS Code terminal?

If you have an existing Jupyter Notebook, you can open it by right-clicking on the file and opening with VS Code, or through the VS Code File Explorer.

How do I run IPython notebook in terminal?

3.1. To launch Jupyter Notebook App: Click on spotlight, type terminal to open a terminal window. Enter the startup folder by typing cd /some_folder_name . Type jupyter notebook to launch the Jupyter Notebook App The notebook interface will appear in a new browser window or tab.


1 Answers

Assuming your talking about the 'Python Interactive' window, I would recommend adding a feature suggestion/bug to our issues list:

https://github.com/Microsoft/vscode-python/issues

CTRL + 1/2 should switch the focus to the 'Python Interactive' window, but we don't force the input section to have focus at the moment. That's a bug.

like image 134
R Chiodo Avatar answered Oct 31 '22 19:10

R Chiodo