Notebook: Run Selection/Line runs selected code (or the current line) in a notebook cell — like Jupyter: Run Selection/Line in Interactive Window, but for notebooks. Useful when running an entire cell is too coarse and you just want to execute a sub-expression or a few lines.
Usage
Open a Jupyter notebook (.ipynb).
Click into a code cell and select the code you want to run.
Press Shift+Enter (if the keybinding does not work, see below). You need to grant kernel access once.
The selected code is executed in the existing kernel. The output replaces the current output of the active cell.
If nothing is selected and you execute the command using the command palette, the current line is used, but the keybinding Shift+Enter is only active with a selection.
[!IMPORTANT]
The command Notebook: Execute Cell and Select Below may take priority over Shift+Enter. User keybindings have an even higher priority, so add this to the list [...] in your keyboard shortcuts file keybindings.json: