Skip to content
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

Esc does not work even after updating to 4.0.3 or 4.1.0 #124

Closed
takezo39 opened this issue Oct 18, 2023 · 8 comments
Closed

Esc does not work even after updating to 4.0.3 or 4.1.0 #124

takezo39 opened this issue Oct 18, 2023 · 8 comments
Labels
bug Something isn't working

Comments

@takezo39
Copy link

Description

Esc does not revert to normal mode after using Shift+r to replace multiple characters

Reproduce

  1. Write a word in a cell in insert mode
  2. Hit Esc to go into normal mode
  3. Press Shift+r to go into replace mode
  4. Press Esc

Expected behavior

Should go into normal mode but stays in replace mode. Pressing Ctrl+c or Ctrl+[ does go into normal mode.

Context

  • Python package version:
pip show jupyterlab-vim
Name: jupyterlab-vim
Version: 4.1.0
Summary: Code cell vim bindings
Home-page:
Author: Axel Fahy
Author-email:
License: MIT License

        Copyright (c) 2017 Jacques Kvam

        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:

        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.

        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
Location: /Users/markhashimoto/test/venv/lib/python3.9/site-packages
Requires: jupyterlab
Required-by:
  • Extension version: 4.1.0
jupyter labextension list
JupyterLab v4.0.7
/Users/markhashimoto/test/venv/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled  X (python, jupyterlab_pygments)
        @axlair/jupyterlab_vim v4.1.0 enabled OK (python, jupyterlab_vim)

/usr/local/share/jupyter/labextensions
        @jupyter-widgets/jupyterlab-manager v3.0.0 enabled  X (python, jupyterlab_widgets)


   The following extensions are outdated:
        jupyterlab_pygments
        @jupyter-widgets/jupyterlab-manager

   Consider checking if an update is available for these packages.
jupyter server extension list
Config dir: /Users/markhashimoto/.jupyter

Config dir: /Users/markhashimoto/test/venv/etc/jupyter
    jupyter_lsp enabled
    - Validating jupyter_lsp...
Package jupyter_lsp took 0.0372s to import
A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
      jupyter_lsp 2.2.0 OK
    jupyter_server_terminals enabled
    - Validating jupyter_server_terminals...
Package jupyter_server_terminals took 0.0212s to import
      jupyter_server_terminals 0.4.4 OK
    jupyterlab enabled
    - Validating jupyterlab...
Package jupyterlab took 0.0931s to import
      jupyterlab 4.0.7 OK
    notebook_shim enabled
    - Validating notebook_shim...
Package notebook_shim took 0.0000s to import
A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
      notebook_shim  OK

Config dir: /usr/local/etc/jupyter
  • Operating System and its version: MacOS 11.7.9
  • Browser and its version: Chrome Version 116.0.5845.187 (Official Build) (x86_64)
Command Line Output
jupyter lab
[I 2023-10-18 19:02:25.496 ServerApp] Package jupyterlab took 0.0000s to import
[I 2023-10-18 19:02:25.642 ServerApp] Package jupyter_lsp took 0.1458s to import
[W 2023-10-18 19:02:25.643 ServerApp] A `_jupyter_server_extension_points` function was not found in jupyter_lsp. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-10-18 19:02:25.668 ServerApp] Package jupyter_server_terminals took 0.0246s to import
[I 2023-10-18 19:02:25.668 ServerApp] Package notebook_shim took 0.0000s to import
[W 2023-10-18 19:02:25.668 ServerApp] A `_jupyter_server_extension_points` function was not found in notebook_shim. Instead, a `_jupyter_server_extension_paths` function was found and will be used for now. This function name will be deprecated in future releases of Jupyter Server.
[I 2023-10-18 19:02:25.670 ServerApp] jupyter_lsp | extension was successfully linked.
[I 2023-10-18 19:02:25.675 ServerApp] jupyter_server_terminals | extension was successfully linked.
[I 2023-10-18 19:02:25.682 ServerApp] jupyterlab | extension was successfully linked.
[W 2023-10-18 19:02:26.338 ServerApp] jupyter_nbextensions_configurator | error adding extension (enabled: True): The module 'jupyter_nbextensions_configurator' could not be found (No module named 'jupyter_nbextensions_configurator'). Are you sure the extension is installed?
    Traceback (most recent call last):
      File "/Users/markhashimoto/test/venv/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 319, in add_extension
        extpkg = ExtensionPackage(name=extension_name, enabled=enabled)
      File "/Users/markhashimoto/test/venv/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 183, in __init__
        self._load_metadata()
      File "/Users/markhashimoto/test/venv/lib/python3.9/site-packages/jupyter_server/extension/manager.py", line 198, in _load_metadata
        raise ExtensionModuleNotFound(msg) from None
    jupyter_server.extension.utils.ExtensionModuleNotFound: The module 'jupyter_nbextensions_configurator' could not be found (No module named 'jupyter_nbextensions_configurator'). Are you sure the extension is installed?
[I 2023-10-18 19:02:26.342 ServerApp] notebook_shim | extension was successfully linked.
[I 2023-10-18 19:02:26.436 ServerApp] notebook_shim | extension was successfully loaded.
[I 2023-10-18 19:02:26.439 ServerApp] jupyter_lsp | extension was successfully loaded.
[I 2023-10-18 19:02:26.441 ServerApp] jupyter_server_terminals | extension was successfully loaded.
[I 2023-10-18 19:02:26.447 LabApp] JupyterLab extension loaded from /Users/markhashimoto/test/venv/lib/python3.9/site-packages/jupyterlab
[I 2023-10-18 19:02:26.447 LabApp] JupyterLab application directory is /Users/markhashimoto/test/venv/share/jupyter/lab
[I 2023-10-18 19:02:26.448 LabApp] Extension Manager is 'pypi'.
[I 2023-10-18 19:02:26.452 ServerApp] jupyterlab | extension was successfully loaded.
[I 2023-10-18 19:02:26.454 ServerApp] Serving notebooks from local directory: /Users/markhashimoto/test
[I 2023-10-18 19:02:26.454 ServerApp] Jupyter Server 2.8.0 is running at:
[I 2023-10-18 19:02:26.454 ServerApp] http://localhost:8888/lab?token=180f8b9185f9e914880b271d0f5d5a6b83f3c2630ff2e403
[I 2023-10-18 19:02:26.454 ServerApp]     http://127.0.0.1:8888/lab?token=180f8b9185f9e914880b271d0f5d5a6b83f3c2630ff2e403
[I 2023-10-18 19:02:26.454 ServerApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 2023-10-18 19:02:26.473 ServerApp]
To access the server, open this file in a browser:
    file:///Users/markhashimoto/Library/Jupyter/runtime/jpserver-53538-open.html
Or copy and paste one of these URLs:
    http://localhost:8888/lab?token=180f8b9185f9e914880b271d0f5d5a6b83f3c2630ff2e403
    http://127.0.0.1:8888/lab?token=180f8b9185f9e914880b271d0f5d5a6b83f3c2630ff2e403

[I 2023-10-18 19:02:27.783 ServerApp] Skipped non-installed server(s): bash-language-server, dockerfile-language-server-nodejs, javascript-typescript-langserver, jedi-language-server, julia-language-server, pyright, python-language-server, python-lsp-server, r-languageserver, sql-language-server, texlab, typescript-language-server, unified-language-server, vscode-css-languageserver-bin, vscode-html-languageserver-bin, vscode-json-languageserver-bin, yaml-language-server
[W 2023-10-18 19:02:32.585 LabApp] Could not determine jupyterlab build status without nodejs

Web Browser Output
Paste the output from your browser web console here.
@takezo39 takezo39 added the bug Something isn't working label Oct 18, 2023
@firai
Copy link
Collaborator

firai commented Oct 20, 2023

Hi @takezo39, I wasn't able to reproduce the issue in either my own environment or with a fresh install. To help diagnose the issue, can you please look into the following?

  • Based on your description, I understand that Esc works for going from Insert mode to Normal mode. Can you please confirm? Does Esc work for exiting single-character replace mode (r)? Does Esc escape from Normal mode to Jupyter Command mode?
  • Did you install this environment from scratch or upgrade Jupyter Lab and the extension from previous versions?
  • Can you please list your keyboard shortcut settings (Settings → Settings Editor → JSON Settings Editor → Keyboard Shortcuts)?
  • Can you list the browser plugins that you have installed? Are you using any vim plugins for the browser?
  • Can you please list the web browser console output (open Developer Tools in your web browser, go to the console tab, reload JupyterLab, repeat the reproduction steps in your bug report and copy the entire console output into your response)?

@firai firai added the needs info Further information is requested label Oct 20, 2023
@takezo39
Copy link
Author

Hi @firai, with the help of your questions I managed to track the problem down to ~/.jupyter/lab/user-settings/@jupyterlab/shortcuts-extension/shortcuts.jupyterlab-settings. Although I had a fresh install, these files were not fresh.

Attached you can see a vimdiff of the regenerated version of the file after I removef it from the above location (left) vs. the old version (right). I'm not sure how it ended up like that but possibly from me messing around with key settings at some stage.
Screenshot 2023-10-20 at 15 03 59

Thanks for your help. Should I close this issue?

@firai
Copy link
Collaborator

firai commented Oct 29, 2023

Hi @takezo39, thanks for reporting back. We made those changes in v4.0.3 in #107. There were also additional changes to the keyboard shortcut settings in v4.1.0 from #110.

I think this was caused by the fact that JL pre-populates keyboard shortcut settings when it is first run, so the old defaults stick even if the user hasn't customized any of the keyboard shortcuts. I just filed an issue upstream at jupyterlab/jupyterlab#15326 to propose not pre-populating, but that doesn't help users who are already using JupyterLab. I'm not sure if there's a way to better advertise these changes and the fact that the user may need to reset/check their settings. Maybe an entry in the wiki and some sort of toast message on upgrade when we do it again in the future?

@firai firai removed the needs info Further information is requested label Oct 29, 2023
@takezo39
Copy link
Author

takezo39 commented Nov 9, 2023

Sorry for the late reply. I'm not sure myself what the best solution is. I'm not too familiar with JL.
Maybe if this hasn't been an issue for others it doesn't need a fix? In any case I will close this. Feel free to reopen if this is premature.

@takezo39 takezo39 closed this as completed Nov 9, 2023
@firai firai changed the title Esc does not revert to normal mode after using Shift+r to replace multiple characters Esc does not work even after updating to 4.0.3 or 4.1.0 Nov 10, 2023
@firai firai pinned this issue Nov 10, 2023
@sphyrnidae8
Copy link

sphyrnidae8 commented Dec 15, 2023

Hi @firai, with the help of your questions I managed to track the problem down to ~/.jupyter/lab/user-settings/@jupyterlab/shortcuts-extension/shortcuts.jupyterlab-settings. Although I had a fresh install, these files were not fresh.

Attached you can see a vimdiff of the regenerated version of the file after I removef it from the above location (left) vs. the old version (right). I'm not sure how it ended up like that but possibly from me messing around with key settings at some stage. Screenshot 2023-10-20 at 15 03 59

Thanks for your help. Should I close this issue?

hi @takezo39

I have the same problem, but I don't understand how you solved it. Did you delete the shortcut file?

@firai
Copy link
Collaborator

firai commented Dec 15, 2023

@sphyrnidae8 Currently the only ways to fix the issue that I'm aware of would be to either:

  1. Go to Keyboard Shortcuts settings in the Settings Editor and click Restore to Defaults to reset all user keyboard settings, which will remove the old conflicting settings, or
  2. Manually copy the latest default rules to your local settings using the JSON Settings Editor.

@sphyrnidae8
Copy link

@sphyrnidae8 Currently the only ways to fix the issue that I'm aware of would be to either:

1. Go to `Keyboard Shortcuts` settings in the `Settings Editor` and click `Restore to Defaults` to reset all user keyboard settings, which will remove the old conflicting settings, or

2. Manually copy the latest default rules to your local settings using the `JSON Settings Editor`.

Hm, tried that already several times. Doesnt work here.

@firai
Copy link
Collaborator

firai commented Dec 15, 2023

Then your issue may not be caused by the one listed here. Please file a new issue with information about your environment and steps to reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants