Skip to content

Conversation

@MunishMummadi
Copy link
Contributor

@MunishMummadi MunishMummadi commented Oct 3, 2025

Description

Fixes #39376

Note: I am new to both rust and zed. I would really appreciate some feedback.

Add individual FoldAtLevel1-9 actions so users can find fold commands in the command palette while keeping existing keybindings.

Closes #39376

Changes

  • crates/editor/src/actions.rs - Added FoldAtLevel1-9 action structs
  • crates/editor/src/editor.rs - Implemented fold_at_level_1-9 handler methods
  • crates/editor/src/element.rs - Registered new actions
  • assets/keymaps/*.json - Updated keybindings to use new individual actions

Other Approaches considered

  • Adding #[serde(default)] to existing FoldAtLevel(u32) - wouldn't make it discoverable
  • Creating a single action with enumerated variants - idk about this that well.

Release Notes

Release Notes:

  • Added Fold At Level 1-9 actions to the command palette
@cla-bot
Copy link

cla-bot bot commented Oct 3, 2025

We require contributors to sign our Contributor License Agreement, and we don't have @MunishMummadi on file. You can sign our CLA at https://zed.dev/cla. Once you've signed, post a comment here that says '@cla-bot check'.

@MunishMummadi
Copy link
Contributor Author

@cla-bot check

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label Oct 3, 2025
@cla-bot
Copy link

cla-bot bot commented Oct 3, 2025

The cla-bot has been summoned, and re-checked this pull request!

@MunishMummadi
Copy link
Contributor Author

some context? Tag/Test/Typo?

@zed-industries-bot
Copy link

zed-industries-bot commented Oct 3, 2025

Warnings
⚠️

This PR is missing release notes.

Please add a "Release Notes" section that describes the change:

Release Notes:

- Added/Fixed/Improved ...

If your change is not user-facing, you can use "N/A" for the entry:

Release Notes:

- N/A

Generated by 🚫 dangerJS against 751a9dc

@boj
Copy link

boj commented Oct 3, 2025

It looks like you'll have to add a migration due to the asset changes: https://github.com/zed-industries/zed/blob/main/crates/migrator/src/migrations/m_2025_01_29/keymap.rs#L162

@MunishMummadi
Copy link
Contributor Author

I can think of 2 ways:

  • Add to existing migration
  • Keeping things backward compatible; just adding the new actions along with the old ones(Migration is not needed in this case)
    Which is of these preferred. I think 2nd one will be a less breaking change for existing users?
    lmk if i am missing anything!
@MunishMummadi
Copy link
Contributor Author

care to have a look @boj

@boj
Copy link

boj commented Oct 6, 2025

@MunishMummadi I'm just a curious bystander, but looks good to me 👍

render as `editor: fold at level 3` instead of `editor: fold at level3`
@HactarCE
Copy link
Contributor

HactarCE commented Oct 7, 2025

Thank you! Excellent contribution.

@HactarCE HactarCE enabled auto-merge (squash) October 7, 2025 16:43
@MunishMummadi
Copy link
Contributor Author

Maybe a comment would have helped for the spacing. Thank you!!

@HactarCE HactarCE merged commit 0969308 into zed-industries:main Oct 8, 2025
22 checks passed
@JosephTLyons
Copy link
Collaborator

Hey @MunishMummadi - I wrote the original commands and have been wanting them to be discoverable through the command palette ever since. Thank you!

@MunishMummadi
Copy link
Contributor Author

It is always inspiring to hear from someone I lookup to. Thank you all :)

@MunishMummadi MunishMummadi deleted the feature-39376 branch October 8, 2025 23:29
LivioGama pushed a commit to LivioGama/zed that referenced this pull request Oct 11, 2025
…ries#39422)

## Description
Fixes zed-industries#39376

Add individual FoldAtLevel1-9 actions so users can find fold commands in
the command palette while keeping existing keybindings.

Migrating user keymaps is necessary to have the keybinds show in the command palette.

Closes zed-industries#39376 

### Changes
- `crates/editor/src/actions.rs` - Added FoldAtLevel1-9 action structs
- `crates/editor/src/editor.rs` - Implemented fold_at_level_1-9 handler
methods
- `crates/editor/src/element.rs` - Registered new actions
- `assets/keymaps/*.json` - Updated keybindings to use new individual
actions

### Other Approaches considered
- Adding #[serde(default)] to existing FoldAtLevel(u32) - wouldn't make
it discoverable
- Creating a single action with enumerated variants - idk about this
that well.

### Release Notes
Release Notes:
- Added Fold At Level 1-9 actions to the command palette

---------

Co-authored-by: HactarCE <6060305+HactarCE@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla-signed The user has signed the Contributor License Agreement

5 participants