-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Keyboard shortcuts related to collapsible headings #11615
Keyboard shortcuts related to collapsible headings #11615
Conversation
* actions: - notebook:move-cursor-heading-above-or-collapse; Default shortcut: ArrowLeft - notebook:move-cursor-heading-below-or-expand; Default shortcut: ArrowRight * adding new action callbacks
Thanks for making a pull request to jupyterlab! |
@meeseeksdev tag enhancement |
Thanks for starting this @schmidi314 A comment about GitHub, when referring to an issue, could you set the special word fix or fixes or closes in front of the This PR addresses also partly #11401 (actually to fix that issue the only thing missing are shortcuts Ctrl Shift Left/Right to (un)collapse all headings). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome @schmidi314; I tested it on binder and this works as expected.
I pinged Martha that introduces the heading collapser feat. about avoiding code duplication and having common helper functions (I'm not familiar with that part of the code).
Would you mind adding some test for it?
about the keyboard test with Playwright, you can emulate key event with
page.keyboard
Sure. I was hesitant to do that because the UI tests already take ages. But I'll add some soon.
Then I probably should add them as well. |
The value of those tests is huge. But I know that designing them takes time. One tip on that front is to run only one test file with: jlpm run test tests/jupyterlab/workspace.test.ts Or even a single test with the jlpm run test -g "should reset the workspace"
If you have the time, it would be awesome. |
Yes, sure. :) But what I meant is that the UI test on github runs for about an hour already. At some point, I could imagine, automated tests become very annoying if you have to wait for half a day until completion. Maybe one should think about parallelization...? And for some reason the snapshots on my computer don't agree with the tests on github. Maybe this is related to a non-100% scaling of my monitor. Any experience in this regard? |
The Ctrl+Shift+Left/Right handlers and commands were already there, so that's an easy one. I noticed that the notebook action |
GitHub won't let us reach that state as a CI job must complete in less than 6 hours 😉 (what is ok in comparison with the usual review time).
When introducing the new galata based on Playwright fixture, I had more flaky test with multiple runner (and even sometimes it took longer...). But sure we should definitely try again especially as the number of tests grows.
Which OS are you using? Could you please provide a list of the failing tests? |
Thanks for adding these changes. The PR is targeting v4. So it is fine for me especially because indeed it removes an inconsistency; if you want to highlight that in the documentation, you can add a note in the migration guide. |
Heading below is not also added before leq level heading.
It would probably be easier to provide a list of those that don't fail :) But maybe this helps: I think it is related to fonts (forget my last comment about resolution scaling). Typical cases: In principle I'm on Ubuntu 20.04. But it is a customized OS shipped with a tuxedo laptop. My impression is that raw and code cells are OK. For instance, the notebook-toolbar/cut-cell is fine (one code and one raw cell in the snapshot). |
Yes they do, because we should not block the ability to test the settings defined in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for pushing this through @schmidi314
Benchmark reportThe execution time (in milliseconds) are grouped by test file, test type and browser. The mean relative comparison is computed with 95% confidence. Results table
Changes are computed with expected as reference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that was a refactoring bug. Thanks for noticing! ...so much for the test suite. Nevertheless, since this is a corner case in my view, I wouldn't add tests for that. |
* Jump up (ArrowLeft) jumps to lower-or-equal level headings * Jump down (ArrowRight) jumps to next heading (level doesn't matter): for multiple nested and collapsed levels, repeated ArrowRight is like a "deep dive" * Tests updated accordingly
Thanks @schmidi314
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks amazing, thank you. Two points on the code:
- I spotted a debugging
console.log
- let's remove it - I would personally avoid using
idx
abbreviation in any public API (e.g. I would renamereturnIdx
→returnIndex
), but this is not a blocker; however, at a minimum please expandidx
toindex
in documentation strings
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Sorry, I've been away for a while. Anything left to do for me here? |
Thanks @schmidi314 (especially for the ping), merging it now. |
References
#10785
Fixes #11401
Adding commands and callbacks for features similar to Collapsible Headings in classic notebook:
Code changes
IMHO packages/notebook/src/actions.tsx could use some more structure, at least if it comes to the private functions. For the moment, I have created a new namespace
Private.Headings
that contains all new functions related to headings. I think this one:jupyterlab/packages/notebook/src/actions.tsx
Line 1622 in a6c19ed
should be moved into this namespace as well... or, since
findNearestParentHeader
seems to be buggy (fails if cell is a markdown cell), it should be replaced by the newjupyterlab/packages/notebook/src/actions.tsx
Line 2425 in a6c19ed
...still investigating
User-facing changes