Udeshya and Kirill Bulatov
aac4829c4d
Add action parameter comment_empty_lines for editor::ToggleComments ( #63961 )
...
# Objective
- Fixes: https://github.com/zed-industries/zed/issues/60738
- Re-iteration of https://github.com/zed-industries/zed/pull/63918 with
suggested changes
## Solution
- Added the parameter `comment_empty_lines` to `editor::ToggleComments`
set to `false` by default.
## Testing
- Tested manually. See showcase below.
- Added two automated tests for the added feature.
- Tested on MacOS.
## Self-Review Checklist:
- [X] I've reviewed my own diff for quality, security, and reliability
- [X] Unsafe blocks (if any) have justifying comments
- [X] The content adheres to Zed's UI standards
([UX/UI](https://github.com/zed-industries/zed/blob/main/CONTRIBUTING.md#uiux-checklist )
and
[icon](https://github.com/zed-industries/zed/blob/main/crates/icons/README.md )
guidelines)
- [X] Tests cover the new/changed behavior
- [X] Performance impact has been considered and is acceptable
## References
The action's behavior was observed across Emacs, VSCode, and Intellij,
and the corresponding keymaps were set accordingly.
https://github.com/user-attachments/assets/36c1a27a-357c-468a-b56b-59ef31265329
https://github.com/user-attachments/assets/de755753-9de1-4771-980f-177810fb85ef
https://github.com/user-attachments/assets/c8ecd261-2bba-4345-89f4-c1d708d8b6d2
## Showcase
Below is the screen recording of these three tests:
1. Behavior of toggling comments when `comment_empty_lines` is `true`.
2. Switching the parameter value to true after commenting a block and
un-commenting the same block does not re-comment the block due to an
empty line in between.
3. Menu bar item is still present, albeit it's behavior is mapped to the
default value of the parameters of the bound action, instead of what is
inside the keybindings file. This (bug?) was present even before. See
the attached clip below.
1.
https://github.com/user-attachments/assets/a9cd2a2c-437b-41a3-bd8e-c4c3a1f350cd
2.
https://github.com/user-attachments/assets/4bbfb77c-9019-410e-9d0a-952d4438d2a7
3.
https://github.com/user-attachments/assets/ca300e2d-2106-4bb7-865b-5d2ab89cd0f2
https://github.com/user-attachments/assets/ec1e47b6-ff99-461e-93af-af925be4d914
---
Release Notes:
- Added `comment_empty_lines` parameter to `editor::ToggleComments` for
multiline selections.
Use `["editor::ToggleComments", {"comment_empty_lines": true}]` to
comment blank lines too (default for Zed keymap now), or
`["editor::ToggleComments", {"comment_empty_lines": false}]` to skip
them (default for VSCode keymap).
---------
Co-authored-by: Kirill Bulatov <kirill@zed.dev >
2026-09-10 13:39:44 +00:00
Kirill Bulatov
f18ea2c94c
Split VSCode and Zed keymap files ( #61532 )
...
Currently, Zed's "VSCode" keymap has certain discrepancies that are not
changed for compatibility reasons, e.g. opening inline assistant is
different in each editor.
To simplify the transition, extract VSCode bindings its own keymap so in
the future it's simpler to accept changes to each keymap separately.
Caveat: people who had ever changed the keymap, will have VSCode keymap
in their settings which will change their bindings slightly after this
commit is released.
I had to introduce more logic to `null` handling as had to somehow
disable `ctrl-enter` on mac from spawning the inline assistant block for
VSCode keymap (it's cmd-i there).
Release Notes:
- Split VSCode and Zed keymap files
2026-07-24 07:54:03 +00:00