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

Toggle comment and project search keybindings are malfunctioning #20926

Closed
1 task done
drochag opened this issue Nov 20, 2024 · 42 comments
Closed
1 task done

Toggle comment and project search keybindings are malfunctioning #20926

drochag opened this issue Nov 20, 2024 · 42 comments
Labels
bug [core label] internationalization Feedback for human language support, translations, etc keymap / key binding Feedback for keyboard shortcuts, key mapping, etc

Comments

@drochag
Copy link

drochag commented Nov 20, 2024

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

When auto updated to 0.162.3 keybindings stopped working, cmd+shift+f opens the file to the side OR goes to the start or end of the nearest bracket

Environment

Zed: v0.161.1 / 0.162.3 (Zed)
OS: macOS 15.0.1
Memory: 32 GiB
Architecture: x86_64

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.

No response

@drochag drochag added admin read Pending admin review bug [core label] triage Maintainer needs to classify the issue labels Nov 20, 2024
@LostKobrakai
Copy link

I'm seeing cmd+/ no longer working by pressing cmd + shift + 7 on my german layout keyboard.

@bendiksolheim
Copy link

bendiksolheim commented Nov 20, 2024

I am having problems as well. As an example, I have this in my keybindings, which have suddenly stopped working:

  {
    "context": "Editor || Dock || Terminal",
    "bindings": {
      "' /": "pane::SplitRight",
      "' -": "pane::SplitDown",
      "' k": ["workspace::ActivatePaneInDirection", "Up"],
      "' j": ["workspace::ActivatePaneInDirection", "Down"],
      "' h": ["workspace::ActivatePaneInDirection", "Left"],
      "' l": ["workspace::ActivatePaneInDirection", "Right"],
      "' f": "workspace::ToggleZoom",
      "' d": "pane::CloseAllItems"
    }
  },

Others, such as "space /": ["task::Spawn", { "task_name": "Search project" }], opens up the "search current file" section, which is the same behavior as if I just press / alone. Could it be that key sequences are not working the way they used to?

EDIT: It can’t be a general bug with sequences, as this one works as it should:

"space p f": ["task::Spawn", { "task_name": "Go to file" }]

@thisislvca
Copy link

I'm seeing cmd+/ no longer working by pressing cmd + shift + 7 on my german layout keyboard.

It also doesn't work in my Italian layout. Before last update it worked, tried on another mac as well to be sure.

@alvvaro
Copy link

alvvaro commented Nov 20, 2024

Keybindings are completely broken when using the Spanish ISO layout, ⌘ + X shortcuts do not work or behave incorrectly.

For instance, ⌘F is supposed to bring up the Find/Buffer Search UI. While it is rightly indicated as such in the menu bar, it is missing from the command menu. And pressing the combination splits the editor horizontally:

ScreenRecording2024-11-21at00 13 30-ezgif com-video-to-gif-converter

Other shortcuts, such as ⌘N, ⌘O or ⌘T seem to do nothing at all.

Researching this, I found a weird looking "not found" in this line while reading the changelog info, which might be to blame?

"com.apple.keylayout.Spanish-ISO" => (
"|~`]/:)(<&^>*;#}\"{.\\['@",
"\"><;.º=)¿/&Ç(´·not found¨Ñç'ñ`\"",
),

PS: had to downgrade and disable autoupdates 😭

@kernel-io
Copy link

kernel-io commented Nov 21, 2024

I'm having issues where it will autocomplete with the name of the key.

i.e: in an empty buffer, press shift, then hit tab, and it will write 'shift'.

Is this just me? (on version 0.163.0)

@theproducer
Copy link

I'm having issues where it will autocomplete with the name of the key.

i.e: in an empty buffer, press shift, then hit tab, and it will write 'shift'.

Is this just me? (on version 0.163.0)

I can confirm this exact behavior following these steps, but in a different version.

Zed 0.162.3
macOS 15.1.1

@KhazAkar
Copy link

I have also issues with keybindings. With VIM mode enabled, I no longer can invoke code actions using ctrl + . on linux :/

@SomeoneToIgnore SomeoneToIgnore changed the title New version 0.162.3 making keybindings weird Toggle comment and project search keybindings are malfunctioning Nov 21, 2024
@ArturGalstyan1
Copy link

ArturGalstyan1 commented Nov 21, 2024

I think this issue might be related:

Screen.Recording.2024-11-21.at.12.41.57.mov

Pressing $ to get to the end of the line doesn't work anymore either.

Edit: I should add that I'm on a German keyboard and pressing $ requires pressing shift+4

Edit 2: The version is this: 6ab4b46

@hedefalk
Copy link

I'm seeing cmd+/ no longer working by pressing cmd + shift + 7 on my german layout keyboard.

plus one on Swedish locale.

@gottlike
Copy link

Seems this was intended: #20425

@ConradIrwin
Copy link
Member

ConradIrwin commented Nov 21, 2024

Thanks for this! We definitely intended to change things, but not break them!

There are a few different things going on here.

Expected from #20425

  • For German cmd-/ is now cmd-ß. This is a deliberate breaking change. The goal here is so that every shortcut in Zed can be typed without option on every keyboard (see https://zed.dev/blog/keyboard-localization for the approach we took).
  • For Italian, cmd-/ is now cmd-. Same as above.
  • For Swedish, it is cmd-\`

I know changing shortcuts is disruptive, and sorry for not being loud enough to let you know this was about to happen. For all of these, we could make some changes to the mappings over the next few days if we can find an alternative that works more like how you'd all expect from other apps. For all of these the shortcut should show correctly in the command palette.

Unsure

  • @drochag cmd-shift-f should not have changed at all, unless you require an option key to type f? Can you please let me know which keyboard layout you use, and I'll investigate.
  • @bendiksolheim Vim mode should be working fine, unless you're on nightly?
  • @KhazAkar cmd-. on Linux shouldn't have changed - I am aware of other problems with Linux shortcuts, but I wasn't expecting their behavior to change recently. Will investigate more.

Known bugs

  • @kernel-io The shift behavior will be fixed in the next preview release. This happens when you have a binding to shift shift.
  • @ArturGalstyan1 On latest nightly I broke vim bindings that require shift with no letter (as part of fixing the shift bug). This shouldn't be shipped to preview or stable yet.
  • @alvvaro The Spanish ISO layout is an oversight on my part, thanks for tracking that down, will fix.

@LostKobrakai
Copy link

For German cmd-/ is now cmd-ß. This is a deliberate breaking change.

If that's the case how do I bind it back? Changing defaults is one thing. Preventing the defaults to be changed back is a another one.

@tmjoen
Copy link

tmjoen commented Nov 21, 2024

Expected from #20425

  • For German cmd-/ is now cmd-ß. This is a deliberate breaking change. The goal here is so that every shortcut in Zed can be typed without option on every keyboard (see https://zed.dev/blog/keyboard-localization for the approach we took).
  • For Italian, cmd-/ is now cmd-. Same as above.
  • For Swedish, it is `cmd-``

The way I read the change was that it was to get rid of using alt as a modifier for these, but on norwegian keyboards cmd-/ is cmd+shift+7. There's no alt in the mix. This combo just opens the "help search" menu now

EDIT: "use_layout_keys" fixes the issue for me:

  {
    "context": "Editor",
    "use_layout_keys": true,
    "bindings": {
      "cmd-/": ["editor::ToggleComments", { "advance_downwards": false }]
    }
  }

@KhazAkar
Copy link

KhazAkar commented Nov 21, 2024

In my case, I have Polish Programmer keyboard layout set, which is quite universally used in Poland. And ctrl-. doesn't work. Maybe it's also connected here?

@hedefalk
Copy link

The way I read the change was that it was to get rid of using alt as a modifier for these, but on norwegian keyboards cmd-/ is cmd+shift+7. There's no alt in the mix. This combo just opens the "help search" menu now

Basically same here, but does nothing. But cmd-shift-7 === cmd-/ and does nothing anymore, but used to be ToggleComments. Neither:

"cmd-shift-7": ["editor::ToggleComments", { "advance_downwards": false }]
"cmd-/": ["editor::ToggleComments", { "advance_downwards": false }]

makes any difference. I can open the command pallete and trigger it there:

image

but the shortcut listed is basically a blunt "lie" at this point.

@ConradIrwin
Copy link
Member

@LostKobrakai You can bind this back in your settings with either:

Because shift-7 types / on your layout:

{
  "use_layout_keys": true,
  "bindings": {"cmd-/": "editor::ToggleComments"}
}

Or, because shortcuts bound to & are remapped to / on a German keyboard:

{
  "bindings": {"cmd-&": "editor::ToggleComments"}
}

@drochag
Copy link
Author

drochag commented Nov 21, 2024

@ConradIrwin not sure what specific info you need, but it's set up like tis on macOS

Screenshot 2024-11-21 at 10 20 41 a m

I also have "base_keymap": "SublimeText" and no other specific key maps

here is a video where you can see what cmd-F and cmd-shit-F does on both v0.161.1 and 0.162.3 versions

https://drive.google.com/file/d/1kaME50PIWFSe9sDZozw2HdOOcCd68lMf/view?usp=sharing

@hedefalk
Copy link

I have the setting:

"cmd-/": ["editor::ToggleComments", { "advance_downwards": false }]

but cmd-/ === cmd-shift-7 does nothing. Its also not showing this when opening the command pallete, but the default one instead. That's at least something even though not the one I want. At least I have somewhat of a workaround:

image

@ConradIrwin
Copy link
Member

@drochag Thanks! We had a bug in our Spanish keyboard, fix incoming: #20995

@notpeter
Copy link
Member

Whoops! not found snuck in there.

"com.apple.keylayout.Spanish-ISO" => (
"|~`]/:)(<&^>*;#}\"{.\\['@",
"\"><;.º=)¿/&Ç(´·not found¨Ñç'ñ`\"",
),
"com.apple.keylayout.Portuguese" => (")`/'^\"<];>[:{@}(&*=~", "=<'´&`;~º:çªÇ\"^)/(*>"),

@alvvaro
Copy link

alvvaro commented Nov 21, 2024

@ConradIrwin thank you for your hard work, I cannot begin to imagine how difficult this might be to tackle, since it's basically an exhibition of edge cases.

Bugs aside, I'm fine with any change as long as there's consistency between the menu bar hint, the command palette hint and the editor proper.

Please comment again when there's a nightly or a preview version we can try and give feedback of!

@ConradIrwin
Copy link
Member

👍 Main should be fixed as of a few minutes ago, and I'll ship a preview when it's built in ~45minutes.

Assuming that feels right, I'll release a stable in an hour or two.

@drochag
Copy link
Author

drochag commented Nov 21, 2024

thank you so much @ConradIrwin
as for the v0.163.0-pre tag, seeing the same issues

  • cmd+F opens the file to the side when focusing the editor but opens the search field when focusing the file tree, it should open the search field when focusing the editor as well
  • cmd+shift+F does nothing while focusing the file tree, goes from the beginning and the end of the nearest curly braces (not sure what functionality is this)

@ConradIrwin
Copy link
Member

@drochag can you please try v0.163.1-pre ? released a few minutes ago

@daniele-solutiontech
Copy link

For Italian, cmd-/ is now cmd-. Same as above.

Hi @ConradIrwin,

On an Italian keyboard, neither Cmd-/ nor Cmd-. seem to work as intended. Could someone with an Italian keyboard layout confirm if they are experiencing the same issue?

@drochag
Copy link
Author

drochag commented Nov 21, 2024

That one works great for me, thanks for your hard work @ConradIrwin

@ConradIrwin
Copy link
Member

@daniele-solutiontech hmm, I think I gave you bad advice; actually enabling the keyboard on macOS, I see there are two:

  • Italian. For me typing cmd-shift-7 toggles comments here (should be notated as cmd-/)
  • Italian QZERTY. For me typing cmd-shift-) toggles comments (should be notated as cmd-7)

if neither is working for you, could you please confirm which keyboard layout you're using? If you want to see Zed's view of it, open the key context debug view with cmd-shift-p debug key view and look for keyboard_layout = com.apple.keylayout.XXXX or similar.

Also, if you type toggle comments into the command palette what does it show? (On Italian QZERTY, this is what I see:
Screenshot 2024-11-21 at 11 53 33)

@alvvaro
Copy link

alvvaro commented Nov 21, 2024

@drochag can you please try v0.163.1-pre ? released a few minutes ago

LGTM

@bendiksolheim
Copy link

@bendiksolheim Vim mode should be working fine, unless you're on nightly?

Vim mode itself works fine! There are just some specific keybindings that are not working at all. I am using a Norwegian keyboard layout, so I guess I might have the same problems as a few others in this thread that / is cmd+shift+7?

I just tried adding "use_layout_keys": true to my keybindings, as I have seen others mentioned here, and this makes my keybindings work again. But I definitely have a QWERTY keyboard, so I don’t exactly understand why it helps. As an example, this keybinding only works with "use_layout_keys": true:

"space /": ["task::Spawn", { "task_name": "Search project" }]

Without the use_layout_key setting, pressing space / just opens up the regular "search in file" dialog.

@ConradIrwin
Copy link
Member

@bendiksolheim thanks! I can reproduce this on a Norwegian layout, but I'm not yet sure why, will investigate.

@daniele-solutiontech
Copy link

daniele-solutiontech commented Nov 21, 2024

Thank you for the quick reply, @ConradIrwin!
My keyboard layout is com.apple.keylayout.Italian-Pro, and the correct keybinding is cmd-'

@ConradIrwin
Copy link
Member

@bendiksolheim Sorry my mistake, it is "working as intended" to require the use_layout_keys in this context (Though I'm now regretting making that opt-in instead of opt-out; maybe we should flip that).

Currently the way this works for Latin keyboards that require the option key to type some of the ASCII range is that we perform key-equivalent mapping:

"com.apple.keylayout.Norwegian" => &[
('"', '^'),
('&', '/'),
('(', ')'),
(')', '='),
('*', '('),
('/', '´'),
(':', 'Å'),
(';', 'å'),
('<', ';'),
('=', '`'),
('>', ':'),
('@', '"'),
('[', 'ø'),
('\'', '¨'),
('\\', '@'),
(']', 'æ'),
('^', '&'),
('`', '<'),
('{', 'Ø'),
('|', '*'),
('}', 'Æ'),
('~', '>'),
],
"com.apple.keylayout.NorwegianExtended" => &[('^', 'ˆ'), ('~', '˜')],

This means that every shortcut defined in the ASCII range is moved to a key you can hit without using option, so that we can bind to cmd-@ and cmd-option-@ on a US keyboard, and you can type cmd-" or cmd-option-". (If we used @ on a Norwegian layout, there'd be no way to type cmd-@ without option). This is similar to how macOS handles it: https://zed.dev/blog/keyboard-localization.

@bendiksolheim
Copy link

@bendiksolheim Sorry my mistake, it is "working as intended" to require the use_layout_keys in this context (Though I'm now regretting making that opt-in instead of opt-out; maybe we should flip that).

Hey, I’m happy as long as there is a way for me to get my keybindings to work 😄 I’m not gonna pretend to understand all of this, but I can definitely live with just specifying this property. Thanks for taking the time to help!

@KhazAkar
Copy link

For the record, I've tried use_layout_keys myself and shortcuts like ctrl+. started working again. @ConradIrwin

@notpeter notpeter added 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 26, 2024
@drochag
Copy link
Author

drochag commented Dec 3, 2024

not sure something has changed on 0.164.1, but now having the same issue as @hedefalk , @ConradIrwin 😢
this and this

@drochag
Copy link
Author

drochag commented Dec 3, 2024

also no completions being shown when pressing ctrl-space despite having the default

"ctrl-space": "editor::ShowCompletions",

@ConradIrwin
Copy link
Member

@drochag I am not able to reproduce problems with ctrl-space on either preview or nightly. What are the other problems you're seeing on 0.164.1?

@notpeter notpeter added the internationalization Feedback for human language support, translations, etc label Dec 3, 2024
@schmurfy
Copy link

schmurfy commented Dec 4, 2024

Not sure if that's related but I was using "cmd+shift+/" to toggle comments on a french keyboard and it no longer works :(

@ConradIrwin
Copy link
Member

@schmurfy toggle comments should now be cmd-: on an AZERTY keyboard

@schmurfy
Copy link

schmurfy commented Dec 5, 2024

@schmurfy toggle comments should now be cmd-: on an AZERTY keyboard

That's the default and it works but what I want is command+shift, I tried: cmd-shift-: without any luck :(

@ConradIrwin
Copy link
Member

Another quirk of the Zed keybinding system is that shift- can only be used with ascii lowercase letters.

You can add this to your keybinding file with:

{
  "use_layout_keys": true,
  "bindings": {"cmd-/": "editor::ToggleComments"}
}

After #21662 lands (in v0.166) the "use_layout_keys" will no-longer be needed as it will be the default.

@ConradIrwin
Copy link
Member

I am going to close this now #21662 has landed; but feel free to keep asking for help with bindings.

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

No branches or pull requests