Allow empty splits on panes#40245
Conversation
- adding an enum for SplitBehavior (naming not final) to support bindings like `["pane::SplitLeft", {"behavior": "Empty"}]`
- subsuming SplitAndMoveDirection actions but probably have to keep them (?)
- empty behavior for terminal panes: unclear what this means. Currently split but does not clone.
|
@iff thanks for the PR! are you still working on this? |
|
Yup. Just waiting for feedback. |
|
@iff got it, thanks. i'll ping people internally! |
|
Sorry for the long delay from my side here:
Other than that, sorry again for the long delay in review and thank you for picking this up! |
|
@MrSubidubi no worries at all and completely understandable. Thanks for the feedback - I will work on integrating the feedback and finishing the implementation this week. |
|
@MrSubidubi Maybe it is a good time for a first round of feedback? I could use some guidance with respects to unittests and coverage you expect, and there are still some minor comments in the code that I can resolve after getting feedback. |
|
@iff Sorry for not getting to this thus far! Am only working part-time and could not find the time this week yet. Will try to get to this later this week, next Monday at latest. Sorry! |
|
@MrSubidubi No worries at all! I completely understand.. I am also juggling part‑time work, so I know how quickly things can fill up. Take the time you need - there’s absolutely no rush. Looking forward to hearing from you whenever you’re able to get to it. |
MrSubidubi
left a comment
There was a problem hiding this comment.
Two days delayed. sorry. Some thoughts, please ping me if you feel I am missing something.
crates/workspace/src/pane.rs
Outdated
| // TODO naming | ||
| #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default)] | ||
| #[serde(deny_unknown_fields)] | ||
| pub enum SplitOperation { |
There was a problem hiding this comment.
I see the TODO, but still lack better ideas
- SplitKind is meh IMO but
- SplitOperationKind is a bit long
Do you have a better idea?
There was a problem hiding this comment.
I will spend some time trying to come up with alternatives..
There was a problem hiding this comment.
@MrSubidubi It is hard to escape previous ideas. SplitOperationKind is long, but is not excessively so (e.g., ResourceOperationKind is also used). If we want to be short, the only options I can think of are SplitEffect or SplitMode?
The Clear enum variant is still bothering me. Fundamentally, the issue stems from terminal and editor panes not sharing the same behavior for opening a "new and empty" pane (terminal pane is never empty). I do not have a good idea for a term that captures the behavior for both panes - aside from the very generic New..
There was a problem hiding this comment.
I think SplitMode might also be good, still captures this quite well I think.
We could also do something like
enum SplitMode {
CloneItem,
MoveItem,
EmptyPane // or NewPane
}but then, not sure whether that is actually better. Happy to go with Clear if you think the above is worse, I'll also think a bit more about it
There was a problem hiding this comment.
Sorry I missed this earlier, but I actually prefer your suggested naming. I would make all variants end with Pane (e.g., ClonePane). Or is Item a term you use in connection with panes? EmptyPane still feels a bit odd for a terminal pane, since it’s never truly empty (there’s always a prompt), but it’s probably good enough.
There was a problem hiding this comment.
@MrSubidubi pushed a commit changing the name to SplitMode (and mode in SplitXYZ)
Co-authored-by: Finn Evers <finn.evers@outlook.de>
|
@MrSubidubi Do you want me to resolve the comments I have addressed, or should I keep them open as a reminder to check those changes? |
|
I can resolve them one by one, good idea. One thing before the last review and before I get this in (thank you so much already for being persistent here and doing awesome work): We desperately need the comments for the action structs - we use them throughout the app to provide some sort of context on these actions, so we should definitely not remove them (e.g. you can test this by searching for the pane actions in the keymap editor and hovering on the action name). Sorry for mentioning this only now, could you find a somewhat functioning way to re-add these? |
|
Ah, yeah - that makes sense. I’ll fix it later today and resolve the merge conflicts in |
|
@MrSubidubi I initially missed that the |
MrSubidubi
left a comment
There was a problem hiding this comment.
Very much like the solution you came up with, thank you very much!
One last question that is not necessarily blocking and I think we are good to merge
crates/workspace/src/pane.rs
Outdated
| // TODO naming | ||
| #[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default)] | ||
| #[serde(deny_unknown_fields)] | ||
| pub enum SplitOperation { |
There was a problem hiding this comment.
I think SplitMode might also be good, still captures this quite well I think.
We could also do something like
enum SplitMode {
CloneItem,
MoveItem,
EmptyPane // or NewPane
}but then, not sure whether that is actually better. Happy to go with Clear if you think the above is worse, I'll also think a bit more about it
|
Sigh, sorry for the merge conflict coming in. Could you resolve that? No need for it to be today, but I'll try to get back to you over the weekend/next week at latest |
|
No problem. I’ll try to finish it up by the end of today. |
- user intended to add an empty panel where the current item is and move the item to the other direction - still needs testing and one check in the unit tests is missing
MrSubidubi
left a comment
There was a problem hiding this comment.
Nice. Thank you so much for bearing with me, absolutely awesome job on this. Good improvement, good code and a pleasure to discuss this with you.
Sorry for me being a bit unresponsive at the start and inbetween and thank you for being fine with it. Hope to see you again in another PR perhaps, other than that, happy holidays!
Draft as a base for continuing the discussion in #8008 : adds a `SplitOperation` enum to support bindings like `["pane::SplitLeft", {"operation": "Clear"}]` To be discussed @MrSubidubi and others: - Naming: Generally not happy with names yet and specifically `Empty` is unclear, e.g., what does this mean for terminal panes? Added placeholder code to split without cloning, but unsure what users would expect in this case. - ~~I removed `SplitAndMoveXyz` actions but I guess we should keep them for backwards compatibility?~~ - May have missed details in the move implementation. Will check the code again for opportunities to refactor more code after we agree on the approach. - ~~Tests should go to `crates/collab/src/tests/integration_tests.rs`?~~ Closes #8008 Release Notes: - Add `pane::Split` mode (`{ClonePane,EmptyPane,MovePane}`) to allow creating an empty buffer. --------- Co-authored-by: Finn Evers <finn.evers@outlook.de> Co-authored-by: MrSubidubi <finn@zed.dev>
Draft as a base for continuing the discussion in zed-industries#8008 : adds a `SplitOperation` enum to support bindings like `["pane::SplitLeft", {"operation": "Clear"}]` To be discussed @MrSubidubi and others: - Naming: Generally not happy with names yet and specifically `Empty` is unclear, e.g., what does this mean for terminal panes? Added placeholder code to split without cloning, but unsure what users would expect in this case. - ~~I removed `SplitAndMoveXyz` actions but I guess we should keep them for backwards compatibility?~~ - May have missed details in the move implementation. Will check the code again for opportunities to refactor more code after we agree on the approach. - ~~Tests should go to `crates/collab/src/tests/integration_tests.rs`?~~ Closes zed-industries#8008 Release Notes: - Add `pane::Split` mode (`{ClonePane,EmptyPane,MovePane}`) to allow creating an empty buffer. --------- Co-authored-by: Finn Evers <finn.evers@outlook.de> Co-authored-by: MrSubidubi <finn@zed.dev>
Draft as a base for continuing the discussion in zed-industries#8008 : adds a `SplitOperation` enum to support bindings like `["pane::SplitLeft", {"operation": "Clear"}]` To be discussed @MrSubidubi and others: - Naming: Generally not happy with names yet and specifically `Empty` is unclear, e.g., what does this mean for terminal panes? Added placeholder code to split without cloning, but unsure what users would expect in this case. - ~~I removed `SplitAndMoveXyz` actions but I guess we should keep them for backwards compatibility?~~ - May have missed details in the move implementation. Will check the code again for opportunities to refactor more code after we agree on the approach. - ~~Tests should go to `crates/collab/src/tests/integration_tests.rs`?~~ Closes zed-industries#8008 Release Notes: - Add `pane::Split` mode (`{ClonePane,EmptyPane,MovePane}`) to allow creating an empty buffer. --------- Co-authored-by: Finn Evers <finn.evers@outlook.de> Co-authored-by: MrSubidubi <finn@zed.dev>
Draft as a base for continuing the discussion in zed-industries#8008 : adds a `SplitOperation` enum to support bindings like `["pane::SplitLeft", {"operation": "Clear"}]` To be discussed @MrSubidubi and others: - Naming: Generally not happy with names yet and specifically `Empty` is unclear, e.g., what does this mean for terminal panes? Added placeholder code to split without cloning, but unsure what users would expect in this case. - ~~I removed `SplitAndMoveXyz` actions but I guess we should keep them for backwards compatibility?~~ - May have missed details in the move implementation. Will check the code again for opportunities to refactor more code after we agree on the approach. - ~~Tests should go to `crates/collab/src/tests/integration_tests.rs`?~~ Closes zed-industries#8008 Release Notes: - Add `pane::Split` mode (`{ClonePane,EmptyPane,MovePane}`) to allow creating an empty buffer. --------- Co-authored-by: Finn Evers <finn.evers@outlook.de> Co-authored-by: MrSubidubi <finn@zed.dev>
Draft as a base for continuing the discussion in #8008 : adds a
SplitOperationenum to support bindings like["pane::SplitLeft", {"operation": "Clear"}]To be discussed @MrSubidubi and others:
Emptyis unclear, e.g., what does this mean for terminal panes? Added placeholder code to split without cloning, but unsure what users would expect in this case.I removedSplitAndMoveXyzactions but I guess we should keep them for backwards compatibility?Tests should go tocrates/collab/src/tests/integration_tests.rs?Closes #8008
Release Notes:
pane::Splitmode ({ClonePane,EmptyPane,MovePane}) to allow creating an empty buffer.