workspace: Only suppress auto-save on focus transfer for the Vim/Helix command palette#51949
Merged
maxdeviant merged 1 commit intomainfrom Mar 19, 2026
Merged
workspace: Only suppress auto-save on focus transfer for the Vim/Helix command palette#51949maxdeviant merged 1 commit intomainfrom
maxdeviant merged 1 commit intomainfrom
Conversation
command palette Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This was referenced Mar 19, 2026
AmaanBilwar
pushed a commit
to AmaanBilwar/zed
that referenced
this pull request
Mar 20, 2026
…x command palette (zed-industries#51949) This PR adjusts the logic that was added in zed-industries#45166 to just apply to the specific case of interacting with the command palette in Vim and Helix modes (hereafter referred to collectively as "Vim mode"). In that PR, we would suppress the auto-save on focus change for _any_ modal in the workspace, regardless of whether we were actually in Vim mode or not. This would cause issues where moving between files some other way—such as the tab switcher or the file finder—would cause the buffers to never be saved. We now only suppress the auto-save on focus loss behavior when in Vim mode and the active modal is the command palette. In all other cases, we save the file. Closes zed-industries#47968. Supersedes zed-industries#51801 and zed-industries#51802. Note: the way we are identifying the active modal as the command palette isn't the best, but @bennetbo and I didn't have any other cleaner solutions. It's a bit tricky, as the logic lives in the `workspace`, which isn't able to know about the `CommandPalette` due to `command_palette` depending on `workspace`. There may be some other way we could achieve this with more indirection, but it's unclear whether it would be worth it at this time. Release Notes: - Changed `{ "autosave": "on_focus_change" }` to now always save on focus loss, except for when activating the command palette when in Vim/Helix mode. Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
toshmukhamedov
pushed a commit
to toshmukhamedov/zed
that referenced
this pull request
Mar 20, 2026
…x command palette (zed-industries#51949) This PR adjusts the logic that was added in zed-industries#45166 to just apply to the specific case of interacting with the command palette in Vim and Helix modes (hereafter referred to collectively as "Vim mode"). In that PR, we would suppress the auto-save on focus change for _any_ modal in the workspace, regardless of whether we were actually in Vim mode or not. This would cause issues where moving between files some other way—such as the tab switcher or the file finder—would cause the buffers to never be saved. We now only suppress the auto-save on focus loss behavior when in Vim mode and the active modal is the command palette. In all other cases, we save the file. Closes zed-industries#47968. Supersedes zed-industries#51801 and zed-industries#51802. Note: the way we are identifying the active modal as the command palette isn't the best, but @bennetbo and I didn't have any other cleaner solutions. It's a bit tricky, as the logic lives in the `workspace`, which isn't able to know about the `CommandPalette` due to `command_palette` depending on `workspace`. There may be some other way we could achieve this with more indirection, but it's unclear whether it would be worth it at this time. Release Notes: - Changed `{ "autosave": "on_focus_change" }` to now always save on focus loss, except for when activating the command palette when in Vim/Helix mode. Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
AmaanBilwar
pushed a commit
to AmaanBilwar/zed
that referenced
this pull request
Mar 23, 2026
…x command palette (zed-industries#51949) This PR adjusts the logic that was added in zed-industries#45166 to just apply to the specific case of interacting with the command palette in Vim and Helix modes (hereafter referred to collectively as "Vim mode"). In that PR, we would suppress the auto-save on focus change for _any_ modal in the workspace, regardless of whether we were actually in Vim mode or not. This would cause issues where moving between files some other way—such as the tab switcher or the file finder—would cause the buffers to never be saved. We now only suppress the auto-save on focus loss behavior when in Vim mode and the active modal is the command palette. In all other cases, we save the file. Closes zed-industries#47968. Supersedes zed-industries#51801 and zed-industries#51802. Note: the way we are identifying the active modal as the command palette isn't the best, but @bennetbo and I didn't have any other cleaner solutions. It's a bit tricky, as the logic lives in the `workspace`, which isn't able to know about the `CommandPalette` due to `command_palette` depending on `workspace`. There may be some other way we could achieve this with more indirection, but it's unclear whether it would be worth it at this time. Release Notes: - Changed `{ "autosave": "on_focus_change" }` to now always save on focus loss, except for when activating the command palette when in Vim/Helix mode. Co-authored-by: Bennet Bo Fenner <bennetbo@gmx.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adjusts the logic that was added in #45166 to just apply to the specific case of interacting with the command palette in Vim and Helix modes (hereafter referred to collectively as "Vim mode").
In that PR, we would suppress the auto-save on focus change for any modal in the workspace, regardless of whether we were actually in Vim mode or not. This would cause issues where moving between files some other way—such as the tab switcher or the file finder—would cause the buffers to never be saved.
We now only suppress the auto-save on focus loss behavior when in Vim mode and the active modal is the command palette. In all other cases, we save the file.
Closes #47968.
Supersedes #51801 and #51802.
Note: the way we are identifying the active modal as the command palette isn't the best, but @bennetbo and I didn't have any other cleaner solutions. It's a bit tricky, as the logic lives in the
workspace, which isn't able to know about theCommandPalettedue tocommand_palettedepending onworkspace. There may be some other way we could achieve this with more indirection, but it's unclear whether it would be worth it at this time.Release Notes:
{ "autosave": "on_focus_change" }to now always save on focus loss, except for when activating the command palette when in Vim/Helix mode.