-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Display shortcuts #14053
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
Display shortcuts #14053
Conversation
|
Thanks for making a pull request to jupyterlab! |
krassowski
left a comment
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.
Thank you for picking this up! Some quick feedback.
| /* <DEPRECATED> */ | ||
| if (targ.hasAttribute('data-p-suppress-shortcuts')) { | ||
| return -1; | ||
| } | ||
| /* </DEPRECATED> */ |
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.
Safe to remove, we dropped p- prefixes in Lumino 2.0 the current implementation here does not include it.
| /* <DEPRECATED> */ | |
| if (targ.hasAttribute('data-p-suppress-shortcuts')) { | |
| return -1; | |
| } | |
| /* </DEPRECATED> */ |
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.
It feels to me that we should just change signature of targetDistance in lumino, expose it publically and reuse here. This can be done in a follow up.
| groupedBindings.get(d)!.map(b => ( | ||
| <tr key={b.command}> | ||
| <td | ||
| style={{ |
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.
We should prefer defining styles in CSS files to enable consistent theming and use our CSS variables whenever possible (font size, colour, etc).
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.
@krassowski Thanks for the comments. They should have been taken into account. Concerning the css properties, some of them seem not to be taken into account when defined in the css file like border-style, border-width, font-size for instance.
7292d36 to
cfd40dd
Compare
0e6acbc to
c66351a
Compare
fcollonval
left a comment
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 @HaudinFlorence
Could you add a integration test for this one?
You can add it in galata/test/documentation/general.test.ts around Line 490. The steps would be to open a notebook, trigger the display of the help dialog, check the dialog; something like:
test('Command Palette', async ({ page, tmpPath }) => {
await page.goto(`tree/${tmpPath}`);
await page.notebook.createNew();
await page.keyboard.press('Control+Shift+H');
await expect(page.locator('.jp-Dialog')).toHaveScreenshot('shortcuts_help.png');
});This test will compare screenshots. At the end it is better as we will be able to use the screenshots for documentation purpose.
|
It would indeed be nice to have the shortcuts command available as a menu item and via the command palette. The logic would be similar to the license plugin with
Which are then used here: jupyterlab/packages/help-extension/src/index.tsx Lines 595 to 603 in 3ecf75a
It seems that the shortcuts logic in this PR looks for the The main advantage of having the shortcuts available from the menu and palette would be that the downstream plugin in Notebook 7 could then be removed to use the one from JupyterLab instead. |
@jtpio Thanks for your help. From what I see at first sight (not checked in detail) and as I was suspecting, the contextual help seems to always be the same when opened from the help menu or from the command palette. |
|
bot please update snapshots |
fcollonval
left a comment
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.
@HaudinFlorence here are some suggestions that should fix the CI.
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.
Waiting for localhost:8888 Cell memory leaksFile editor memory leaksCreate a fileMemory change: -77.3 kB Leak detected: NoLeaking objects:
Notebook memory leaksCreate a notebookMemory change: +31.2 kB Leak detected: YesLeaking objects:
2 passing (3m) |
88249e3 to
fc055a0
Compare
Ah ok thanks @HaudinFlorence for looking into this. Then we could just skip adding the command to the main menu and command palette for now. I might check it out later separately to not block this PR. |
|
Kicking the CI |
Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>
…s for paddings. Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com> Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com> Co-authored-by: Andrii Ieroshenko <ieroshenkoa@gmail.com>
Co-authored-by: Michał Krassowski <5832902+krassowski@users.noreply.github.com>
Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>
816caa9 to
218e376
Compare
andrii-i
left a comment
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.
Thank you for the updates @HaudinFlorence. Updated Keyboard Shortcuts table and help menu item look good to me and work well. Good job!
Note #14240 (comment) interaction for when some extension registers a keyboard shortcut with a long description but this can be dealt with as a part of V2.
Please also note that currently there are 2 failing tests:
- Visual Regression. There is screenshot comparasion fail for newly-added Shortcuts tests:
test/documentation/general.test.ts:582:7 › General › Keyboard Shortcuts Help. This comment by @fcollonval and one under it describe how to run and debug visual regression tests locally. - Linux (usage, 3.11. There is something going on with duplicate package and then a failure on trying to clone cookiecutter package. Not exactly sure if this is connected to this PR, maybe other reviewers who understand CI better could advise, CC @krassowski @fcollonval
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/runner/work/jupyterlab/jupyterlab/jupyterlab/upgrade_extension.py", line 201, in <module>
update_extension(args.path, args.branch, args.no_input is False)
File "/home/runner/work/jupyterlab/jupyterlab/jupyterlab/upgrade_extension.py", line 80, in update_extension
cookiecutter(
File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/site-packages/cookiecutter/main.py", line 69, in cookiecutter
repo_dir, cleanup = determine_repo_dir(
^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/site-packages/cookiecutter/repository.py", line 106, in determine_repo_dir
cloned_repo = clone(
^^^^^^
File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/site-packages/cookiecutter/vcs.py", line 95, in clone
subprocess.check_output( # nosec
File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/subprocess.py", line 466, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.2/x64/lib/python3.11/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'clone', 'https://github.com/jupyterlab/extension-cookiecutter-ts']' returned non-zero exit status 128.
|
bot please update documentation snapshots |
|
Documentation snapshots updated. |
3066161 to
1a06c6f
Compare
fcollonval
left a comment
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 @HaudinFlorence
Merging this first version
References
Supersedes PR from #11960
Fixes #4004

FIxes #10284
Code changes
Changes are mainly style changes for the display of the shortcuts, also changes on the level of details/ the choice of informations to be displayed.
User-facing changes
Backwards-incompatible changes