Is it possible to comment-out an entire notebook cell / group-of-cells in VSCode?
Without having to enter and select all the text, just selecting the cell/cells.
I want the action to affect the cell/cells that are selected.
Note: This is for working on a Notebook FROM vscode, not from Jupyter/Jupyterlab.
Is it possible to comment-out an entire notebook cell / group-of-cells in VSCode?
Without having to enter and select all the text, just selecting the cell/cells.
I want the action to affect the cell/cells that are selected.
Note: This is for working on a Notebook FROM vscode, not from Jupyter/Jupyterlab.
Share Improve this question edited Mar 21 at 11:29 Rub asked Mar 19 at 19:18 RubRub 2,78832 silver badges49 bronze badges1 Answer
Reset to default 0Yes, in Visual Studio Code (VS Code), you can comment out entire Jupyter notebook cells without manually selecting all the text within each cell. This functionality allows you to quickly disable or enable code across multiple cells. Here's how you can do it:
Select Multiple Cells: Hold down the Ctrl key (or Cmd on macOS) and click on the cells you wish to comment out. Alternatively, click on the first cell, then hold down the Shift key and click on the last cell to select a range of cells.
Toggle Comments: With the desired cells selected, press Ctrl + / (or Cmd + / on macOS). This keyboard shortcut toggles comments for the selected cells, commenting out all lines within them if they are not already commented, or uncommenting them if they are.