jupyterlab-contrib / jupyterlab-vim

Vim notebook cell bindings for JupyterLab
https://jupyterlab-contrib.github.io/jupyterlab-vim.html
MIT License
660 stars 43 forks source link

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

Closed takezo39 closed 7 months ago

takezo39 commented 8 months ago

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

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
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.
firai commented 8 months ago

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?

takezo39 commented 8 months ago

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 commented 8 months ago

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 https://github.com/jupyterlab/jupyterlab/issues/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?

takezo39 commented 7 months ago

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.

sphyrnidae8 commented 6 months ago

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 commented 6 months ago

@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 commented 6 months ago

@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 commented 6 months ago

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.