Detailed changes
@@ -231,6 +231,8 @@
"line_numbers": true,
// Whether to show code action buttons in the gutter.
"code_actions": true,
+ // Whether to show runnables buttons in the gutter.
+ "runnables": true,
// Whether to show fold buttons in the gutter.
"folds": true
},
@@ -8247,6 +8247,10 @@ impl Editor {
}
fn refresh_runnables(&mut self, cx: &mut ViewContext<Self>) -> Task<()> {
+ if !EditorSettings::get_global(cx).gutter.runnables {
+ self.clear_tasks();
+ return Task::ready(());
+ }
let project = self.project.clone();
cx.spawn(|this, mut cx| async move {
let Ok(display_snapshot) = this.update(&mut cx, |this, cx| {
@@ -11017,6 +11021,7 @@ impl Editor {
}
fn settings_changed(&mut self, cx: &mut ViewContext<Self>) {
+ self.tasks_update_task = Some(self.refresh_runnables(cx));
self.refresh_inline_completion(true, cx);
self.refresh_inlay_hints(
InlayHintRefreshReason::SettingsChange(inlay_hint_settings(
@@ -11790,7 +11795,7 @@ impl EditorSnapshot {
.then_some(em_width * GIT_BLAME_GUTTER_WIDTH_CHARS);
let mut left_padding = git_blame_entries_width.unwrap_or(Pixels::ZERO);
- left_padding += if show_code_actions {
+ left_padding += if show_code_actions || gutter_settings.runnables {
em_width * 3.0
} else if show_git_gutter && show_line_numbers {
em_width * 2.0
@@ -84,6 +84,7 @@ pub struct Scrollbar {
pub struct Gutter {
pub line_numbers: bool,
pub code_actions: bool,
+ pub runnables: bool,
pub folds: bool,
}
@@ -255,6 +256,10 @@ pub struct GutterContent {
///
/// Default: true
pub code_actions: Option<bool>,
+ /// Whether to show runnable buttons in the gutter.
+ ///
+ /// Default: true
+ pub runnables: Option<bool>,
/// Whether to show fold buttons in the gutter.
///
/// Default: true
@@ -4931,14 +4931,18 @@ impl Element for EditorElement {
}
}
- let test_indicators = self.layout_run_indicators(
- line_height,
- scroll_pixel_position,
- &gutter_dimensions,
- &gutter_hitbox,
- &snapshot,
- cx,
- );
+ let test_indicators = if gutter_settings.runnables {
+ self.layout_run_indicators(
+ line_height,
+ scroll_pixel_position,
+ &gutter_dimensions,
+ &gutter_hitbox,
+ &snapshot,
+ cx,
+ )
+ } else {
+ vec![]
+ };
if !cx.has_active_drag() {
self.layout_hover_popovers(