-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cell info when collapsed #6512
Comments
This would be immensely helpful if this were implemented. Please and Thank You. |
I used to use the "toggle code" extension to benefit from such a behavior. The current "toggle code" implementation does not recognize (sadly) the first comment of the cell as a "toggle cell" point... Not sure if it could be something actionable from that parameter of the cell editor. |
Before it was collapsible headings and code folding that was missing, now, this is the only remaining feature that keeps me from completely switching from jupyter notebook. |
It seems there are two separate functionalities here - collapsing cells - which leaves only "..." displayed - and code folding, which allows blocks of code to be folded into a single line. Both collapsing cells and code folding are implemented in jupyterlab, but the code folding implementation is less capable than the one that was present in the old nbextensions version of code folding. As @sergiocaccamo points out, it would be great if the jupyterlab version of code folding did the same thing as the jupyter notebooks one by checking for a comment in the first line of a cell which can be used as an anchor point for folding the rest of the cell. Possibly this should be a new github issue since this one is about collapsing cells rather than code folding. Alternatively @dbuendiab perhaps you could alter the title of this issue to something like "code folding - fold entire cell if first line is a comment" if what I'm describing matches what you'd like to see here? Edit: worth pointing out that the code that does first line comment folding in the original extension is just 14 lines long. Hopefully for someone with a better understanding of Codemirror than me this would actually be a very straightforward change! |
@afshin (not sure who to ping around Codemirror changes these days… sorry if this is the wrong ping!) Just wanted to give a plus one on @pintail-xyz's analysis… this does indicate a regression from classic notebook (one that I specifically ran into in trying again to use jupyter lab just today). Not knowing at all what a cell holds when running it is far too dangerous for me to feel comfortable using to condense longer notebooks (even for code that I've written), so the current cell-collapsing functionality is entirely a non-starter for me. However, it is helpful to be able to have a single commented line that could fold an entire cell (in a way that was persisted across saves). It is was able to stand-in as a description for the entire collection of code that was folded away and gives a sense of place and assurance around what is being run. I also agree that the title of this issue could be improved by distinguishing between cold-folding and cell collapsing; but I think (as @pintail-xyz suggests) it's fine to keep the cell-collapsing behaviour as it is… but for parity it is crucial to bring back the code-folding feature where an entire cell can be represented by an initial line comment. |
@mpacer, thanks for the ping! This is something we should validate in JL4 and NB7 as a feature parity issue, cc: @JohanMabille @fcollonval @jtpio might have some insight. |
Likely this could be implemented in JupyterLab 4, and Notebook 7 would inherit it directly. |
I've been user of iPython Notebooks and Jupyter Notebooks for a long time, and now I'm trying the JupyterLab environment, and I feel it's really cool.
The collapse of a cell is a very good feature, specially if you write a lot of cells in the same Notebook, as I often do.
My suggestion is to keep the first line of the cell visible somehow, all the time or just when you hover over the three big dots of the collapsed cell.
This would permit to keep a info line, just a comment or so, like the name of the class or function (
class Dot:
ordef quadratic(x, y):
), or just a comment on the content of the hidden cell (## Heavy geo calc here
), so the hidden cell content will be known without the need of open it.Thank you in advance,
The text was updated successfully, but these errors were encountered: