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

malformed keymap.json should trigger error on startup #20531

Open
1 task done
dlants opened this issue Nov 12, 2024 · 4 comments
Open
1 task done

malformed keymap.json should trigger error on startup #20531

dlants opened this issue Nov 12, 2024 · 4 comments
Labels
bug [core label] keymap / key binding Feedback for keyboard shortcuts, key mapping, etc setting Feedback for preferences, configuration, etc

Comments

@dlants
Copy link

dlants commented Nov 12, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

I got stumped for a while since I had this in my keyboard binding keymap.json file:

  {
    "context": "Terminal",
    "bindings": {
      "ctrl-h": ["pane::ActivatePrevItem"],
    }
  }

This caused all bindings to stop working in the terminal. Instead the terminal receives the keys (as seen in the screenshot).

screenshot Screenshot 2024-11-11 at 10 16 10 PM

Changing this to just the string (instead of wrapped in the array braces) fixes the issue. It was just really tough to track down, I really thought something was horribly wrong.

Environment

Zed: v0.160.7 (Zed)
OS: macOS 14.6.1
Memory: 16 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

@dlants dlants added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Nov 12, 2024
@dlants dlants changed the title OSX terminal unexpected malformed bindings in terminal context cause all keybindings to fail Nov 12, 2024
@JosephTLyons JosephTLyons added terminal Feedback for terminal integration, shell commands, etc keymap / key binding Feedback for keyboard shortcuts, key mapping, etc and removed triage Maintainer needs to classify the issue admin read Pending admin review labels Nov 15, 2024
@notpeter
Copy link
Member

notpeter commented Nov 26, 2024

The bug I see here is that if you enter Zed with a busted keymap, it should pop an error message and log an error to the Zed.log -- Zed currently fails silently in this case.


More info:

When you save the broken JSON keymap you should see an error message like this:
Screenshot 2024-11-26 at 7 39 02

If not, can you provide an example invalid JSON keymap.json which does not trigger this error?

If you are editing the keymap and save making it invalid, we should alert and retain your previous-good settings. But if you've reopened Zed and have malformed JSON in your keymap, Zed will not attempt to partially load the broken JSON. This is by-design.

@notpeter notpeter changed the title malformed bindings in terminal context cause all keybindings to fail malformed keymap.json should trigger error on startup Nov 26, 2024
@notpeter notpeter added setting Feedback for preferences, configuration, etc and removed terminal Feedback for terminal integration, shell commands, etc labels Nov 26, 2024
@the-kenny

This comment was marked as off-topic.

@notpeter

This comment was marked as off-topic.

@the-kenny

This comment was marked as off-topic.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] keymap / key binding Feedback for keyboard shortcuts, key mapping, etc setting Feedback for preferences, configuration, etc
Projects
None yet
Development

No branches or pull requests

4 participants