visual-studio-code

Run / execute a section of a notebook in vscode


In vscode notebooks, you can add markdown headers to divide your notebook into sections which can be collapsed / folded. Is there a way to execute all cells within such collapsed section, without unfolding it and running all the cells manually one by one?

There is a feature request in the vscode repo describing precisely this and it's marked as completed, so the functionality should be there. However, using the usual Shift+Enter or Ctrl+Enter on a markdown header does not run anything in vscode 1.68.1. I also cannot see it mentioned in the docs anywhere and the issue is locked, so one cannot ask there.


Solution

  • This is made possible in Visual Studio Code Version 1.88.1 (March 2024) and also referred to in the docs of VS on https://code.visualstudio.com/docs/datascience/jupyter-notebooks#_run-cells-in-section.

    Solved under this git-issue: https://github.com/microsoft/vscode/issues/199992