Make cells (# %%) collapsible python files
See original GitHub issueEnvironment data
- VS Code version: 1.33
- Extension version (available under the Extensions sidebar): Current
- OS and version: Win10 1703
- Python version (& distribution if applicable, e.g. Anaconda): Anaconda 3.7
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): Conda
- Relevant/affected Python packages and their versions: n/a
Expected behaviour
In a document with multiple cells, collapsing some of them improves usability.
Actual behaviour
It is not possible to collapse cells.
Some Details
I think defining #%%
as (collapsible region start) shouldn’t be very hard (I can try to submit a PR in 1-2 weekends if you agree with the idea).
Some implementation details should be evaluated though:
- Behavior of Shift+Enter in the cell above
- What to display if a region is collapsed (
#%% Comment ...
would be the default I think) - Behavior of collapsed regions affected by
Run below|above
- Visibility of
Run Cell | Run Above | Run Below
Issue Analytics
- State:
- Created 4 years ago
- Reactions:96
- Comments:26 (9 by maintainers)
Top Results From Across the Web
How to organize Python code into collapsable / expandable ...
Turns out that the answer is very simple: Select the code, right click, do custom folding. enter image description here.
Read more >Example: Collapsed Outline and Grouping - XlsxWriter
Example of how to use Python and XlsxWriter to generate Excel outlines and # grouping. # # These examples focus mainly on collapsed...
Read more >Collapse or folding code cell in Jupyter notebook
Yes, you can fold/unfold regions of your code in Jupyter cells the same way as it works in .py files. If you're talking...
Read more >Collapsible Pane in Tkinter | Python - GeeksforGeeks
A collapsible pane, as the name suggests, is a pane which can be collapsed. User can expand pane so that they can perform...
Read more >How To Collapse Cells In A Jupyter Notebook
When you create a new notebook, ideally you should see small triangles next to your code indicating that you can now collapse them...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Sorry but this isn’t on our radar at the moment. It’s waiting for more people to up vote it.
Is there anything new ? This should be set to important because I believe most of data science and ml guys write long jupyter notebook. And we are used to collapse those cells in Colab.