Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Fix scrollbar marker settings (#10530)
Andrew Lyginf3192b6fa6cc
diff --git a/assets/settings/default.json b/assets/settings/default.jsonindex 0fb494a07d0..b425e54ee69 100644--- a/assets/settings/default.json+++ b/assets/settings/default.json@@ -145,10 +145,10 @@"show": "auto",// Whether to show git diff indicators in the scrollbar."git_diff": true,- // Whether to show selections in the scrollbar.- "selections": true,- // Whether to show symbols selections in the scrollbar.- "symbols_selections": true,+ // Whether to show buffer search results in the scrollbar.+ "search_results": true,+ // Whether to show selected symbol occurrences in the scrollbar.+ "selected_symbol": true,// Whether to show diagnostic indicators in the scrollbar."diagnostics": true},diff --git a/crates/editor/src/editor_settings.rs b/crates/editor/src/editor_settings.rsindex 801044083af..20a9ea64e99 100644--- a/crates/editor/src/editor_settings.rs+++ b/crates/editor/src/editor_settings.rs@@ -58,8 +58,8 @@ pub struct Toolbar {pub struct Scrollbar {pub show: ShowScrollbar,pub git_diff: bool,- pub selections: bool,- pub symbols_selections: bool,+ pub selected_symbol: bool,+ pub search_results: bool,pub diagnostics: bool,}@@ -194,14 +194,14 @@ pub struct ScrollbarContent {////// Default: truepub git_diff: Option<bool>,- /// Whether to show buffer search result markers in the scrollbar.+ /// Whether to show buffer search result indicators in the scrollbar.////// Default: true- pub selections: Option<bool>,- /// Whether to show symbols highlighted markers in the scrollbar.+ pub search_results: Option<bool>,+ /// Whether to show selected symbol occurrences in the scrollbar.////// Default: true- pub symbols_selections: Option<bool>,+ pub selected_symbol: Option<bool>,/// Whether to show diagnostic indicators in the scrollbar.////// Default: truediff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rsindex 0c22c9dcefa..b30dd0ed9cd 100644--- a/crates/editor/src/element.rs+++ b/crates/editor/src/element.rs@@ -965,11 +965,11 @@ impl EditorElement {// Git(is_singleton && scrollbar_settings.git_diff && snapshot.buffer_snapshot.has_git_diffs())||- // Selections- (is_singleton && scrollbar_settings.selections && editor.has_background_highlights::<BufferSearchHighlights>())+ // Buffer Search Results+ (is_singleton && scrollbar_settings.search_results && editor.has_background_highlights::<BufferSearchHighlights>())||- // Symbols Selections- (is_singleton && scrollbar_settings.symbols_selections && (editor.has_background_highlights::<DocumentHighlightRead>() || editor.has_background_highlights::<DocumentHighlightWrite>()))+ // Selected Symbol Occurrences+ (is_singleton && scrollbar_settings.selected_symbol && (editor.has_background_highlights::<DocumentHighlightRead>() || editor.has_background_highlights::<DocumentHighlightWrite>()))||// Diagnostics(is_singleton && scrollbar_settings.diagnostics && snapshot.buffer_snapshot.has_diagnostics())@@ -2620,10 +2620,14 @@ impl EditorElement {for (background_highlight_id, (_, background_ranges)) inbackground_highlights.iter(){- if (*background_highlight_id- == TypeId::of::<BufferSearchHighlights>()- && scrollbar_settings.selections)- || scrollbar_settings.symbols_selections+ let is_search_highlights = *background_highlight_id+ == TypeId::of::<BufferSearchHighlights>();+ let is_symbol_occurrences = *background_highlight_id+ == TypeId::of::<DocumentHighlightRead>()+ || *background_highlight_id+ == TypeId::of::<DocumentHighlightWrite>();+ if (is_search_highlights && scrollbar_settings.search_results)+ || (is_symbol_occurrences && scrollbar_settings.selected_symbol){let marker_row_ranges =background_ranges.into_iter().map(|range| {diff --git a/docs/src/configuring_zed.md b/docs/src/configuring_zed.mdindex bbaca79953c..9ef0930280e 100644--- a/docs/src/configuring_zed.md+++ b/docs/src/configuring_zed.md@@ -190,6 +190,102 @@ List of `string` values2. Position the dock to the right of the workspace like a side panel: `right`3. Position the dock full screen over the entire workspace: `expanded`+## Editor Scrollbar++- Description: Whether or not to show the editor scrollbar and various elements in it.+- Setting: `scrollbar`+- Default:++```json+"scrollbar": {+ "show": "auto",+ "git_diff": true,+ "search_results": true,+ "selected_symbol": true,+ "diagnostics": true+},+```++### Show Mode++- Description: When to show the editor scrollbar.+- Setting: `show`+- Default: `auto`++**Options**++1. Show the scrollbar if there's important information or follow the system's configured behavior:++```json+"scrollbar": {+ "show": "auto"+}+```++2. Match the system's configured behavior:++```json+"scrollbar": {+ "show": "system"+}+```++3. Always show the scrollbar:++```json+"scrollbar": {+ "show": "always"+}+```++4. Never show the scrollbar:++```json+"scrollbar": {+ "show": "never"+}+```++### Git Diff Indicators++- Description: Whether to show git diff indicators in the scrollbar.+- Setting: `git_diff`+- Default: `true`++**Options**++`boolean` values++### Search Results Indicators++- Description: Whether to show buffer search results in the scrollbar.+- Setting: `search_results`+- Default: `true`++**Options**++`boolean` values++### Selected Symbols Indicators++- Description: Whether to show selected symbol occurrences in the scrollbar.+- Setting: `selected_symbol`+- Default: `true`++**Options**++`boolean` values++### Diagnostics++- Description: Whether to show diagnostic indicators in the scrollbar.+- Setting: `diagnostics`+- Default: `true`++**Options**++`boolean` values+## Editor Toolbar- Description: Whether or not to show various elements in the editor toolbar.