Skip to content

Add setting for minimap on active editor only #31390

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

Merged

Conversation

AlvaroParker
Copy link
Contributor

@AlvaroParker AlvaroParker commented May 25, 2025

Release Notes:

  • Add a setting to show the minimap only on the current active editor (file)
  • This can be configured on settings.json:
{
  "minimap": {
    "display_in": "active_editor", //  defaults to "all_editors"
  }
}
  • The minimap won't hide if you go from an editor pane to the terminal, the project panel, the search bar, etc. It will only hide if you go from one editor pane to another.

Preview:

image

Only the active editor (left) displays the minimap.

@cla-bot cla-bot bot added the cla-signed The user has signed the Contributor License Agreement label May 25, 2025
@AlvaroParker AlvaroParker marked this pull request as ready for review May 25, 2025 18:16
Copy link
Contributor

@MrSubidubi MrSubidubi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I am not sure whether this should be part of the visibility enum or rather a separate setting.
I do not really see why OnActiveBuffer and Auto should exclude one another, since there might be cases where one would also want the minimap to hide on the currently active editor after the given Auto delay. Feels like we are mixing the question of "When to show the minimap" with "Where to show the minimap" to me and I am not sure this scales well if we add this configuration to the ShowMinimap enum

@AlvaroParker
Copy link
Contributor Author

@MrSubidubi Good points! I see three possible alternatives:

  1. Implement OnActiveBuffer within the ShowMinimap config.
  2. Move OnActiveBuffer to its own config name.
  3. Merge it into ShowMinimap::Auto so that it automatically hides when the focus is not on the buffer (I don't think this is a good idea, but it can be done).

Or, of course, we could leave it as is and not allow the user to choose where to show the minimap.

@MrSubidubi
Copy link
Contributor

MrSubidubi commented May 25, 2025

Putting it within the minimap config seems most reasonable to me currently, although I lack a good idea for a config name.

Personally, I would also like something likeOnActivePane slightlly more as a behavior than what is currently proposed here - the current implementation would also hide the minimap if I change focus to e.g. the terminal, the project panel or even the search bar. To me, this feels overly flickery (and the latter might even be more of a bug).
For the active_pane_modifiers.magnification, we continue to magnify the most recently selected pane. Personally, I feel this behaviour would be more reasonable for the issue faced here (so we continue to show the minimap in the most recently used editor even if it no longer has focus). Theoretically, we could implement both approaches (with the mentioned bug fixed), although I would like to know where you see advantages in OnActiveBuffer to the OnActivePane idea.

I also think allowing users to select where to show the minimap overall sounds reasonable - it does take up some screen space and showing the minimap only in the currently active editor could reduce visual clutter for users that want a less busy UI.

@AlvaroParker
Copy link
Contributor Author

AlvaroParker commented May 25, 2025

I was actually thinking on something like this:

/// Where to show the minimap in the editor.
///
/// Default: all
#[derive(Copy, Clone, Debug, Default, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum MinimapDisplayScope {
    /// Show on all open panes.
    #[default]
    AllPanes,
    /// Show the minimap on the focused pane only.
    FocusedPane,
}

And put the config on minimap.display_scope

@AlvaroParker
Copy link
Contributor Author

I'm noticing a flickering when splitting panes. I'll see what I can do about it

2025-05-27.16-58-48.mov

Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea, and thank you for spotting the flickering: let's straighten out the rendering conditions and see if the flickering situation improves.

@AlvaroParker AlvaroParker force-pushed the feat/minimap-on-active-buffer branch 2 times, most recently from d853c2e to ed00696 Compare June 15, 2025 02:14
@AlvaroParker AlvaroParker force-pushed the feat/minimap-on-active-buffer branch from ed00696 to da06db8 Compare June 15, 2025 04:46
@AlvaroParker AlvaroParker changed the title Add setting for minimap on active buffer only Add setting for minimap on active editor only Jun 15, 2025
Copy link
Contributor

@SomeoneToIgnore SomeoneToIgnore left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turned out to be much simpler code in the end, nice.

Thank you!

@SomeoneToIgnore SomeoneToIgnore merged commit 4bbb7b5 into zed-industries:main Jun 17, 2025
24 checks passed
@SomeoneToIgnore
Copy link
Contributor

I went on and flipped the default, given that there were some reports about current minimap's performance: #32878

SomeoneToIgnore added a commit that referenced this pull request Jun 17, 2025
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants