Detailed changes
@@ -370,8 +370,6 @@
"gutter": {
// Whether to show line numbers in the gutter.
"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 breakpoints in the gutter.
@@ -1020,7 +1020,6 @@ pub struct EditorSnapshot {
show_gutter: bool,
show_line_numbers: Option<bool>,
show_git_diff_gutter: Option<bool>,
- show_code_actions: Option<bool>,
show_runnables: Option<bool>,
show_breakpoints: Option<bool>,
git_blame_gutter_max_author_length: Option<usize>,
@@ -2212,7 +2211,6 @@ impl Editor {
show_gutter: self.show_gutter,
show_line_numbers: self.show_line_numbers,
show_git_diff_gutter: self.show_git_diff_gutter,
- show_code_actions: self.show_code_actions,
show_runnables: self.show_runnables,
show_breakpoints: self.show_breakpoints,
git_blame_gutter_max_author_length,
@@ -6700,69 +6698,6 @@ impl Editor {
Some(self.edit_prediction_provider.as_ref()?.provider.clone())
}
- fn render_code_actions_indicator(
- &self,
- _style: &EditorStyle,
- row: DisplayRow,
- is_active: bool,
- breakpoint: Option<&(Anchor, Breakpoint)>,
- cx: &mut Context<Self>,
- ) -> Option<IconButton> {
- let color = Color::Muted;
- let position = breakpoint.as_ref().map(|(anchor, _)| *anchor);
- let show_tooltip = !self.context_menu_visible();
-
- if self.available_code_actions.is_some() {
- Some(
- IconButton::new("code_actions_indicator", ui::IconName::Bolt)
- .shape(ui::IconButtonShape::Square)
- .icon_size(IconSize::XSmall)
- .icon_color(color)
- .toggle_state(is_active)
- .when(show_tooltip, |this| {
- this.tooltip({
- let focus_handle = self.focus_handle.clone();
- move |window, cx| {
- Tooltip::for_action_in(
- "Toggle Code Actions",
- &ToggleCodeActions {
- deployed_from_indicator: None,
- quick_launch: false,
- },
- &focus_handle,
- window,
- cx,
- )
- }
- })
- })
- .on_click(cx.listener(move |editor, e: &ClickEvent, window, cx| {
- let quick_launch = e.down.button == MouseButton::Left;
- window.focus(&editor.focus_handle(cx));
- editor.toggle_code_actions(
- &ToggleCodeActions {
- deployed_from_indicator: Some(row),
- quick_launch,
- },
- window,
- cx,
- );
- }))
- .on_right_click(cx.listener(move |editor, event: &ClickEvent, window, cx| {
- editor.set_breakpoint_context_menu(
- row,
- position,
- event.down.position,
- window,
- cx,
- );
- })),
- )
- } else {
- None
- }
- }
-
fn clear_tasks(&mut self) {
self.tasks.clear()
}
@@ -20093,10 +20028,6 @@ impl EditorSnapshot {
0.0.into()
};
- let show_code_actions = self
- .show_code_actions
- .unwrap_or(gutter_settings.code_actions);
-
let show_runnables = self.show_runnables.unwrap_or(gutter_settings.runnables);
let show_breakpoints = self.show_breakpoints.unwrap_or(gutter_settings.breakpoints);
@@ -20122,7 +20053,7 @@ impl EditorSnapshot {
let mut left_padding = git_blame_entries_width.unwrap_or(Pixels::ZERO);
left_padding += if !is_singleton {
em_width * 4.0
- } else if show_code_actions || show_runnables || show_breakpoints {
+ } else if show_runnables || show_breakpoints {
em_width * 3.0
} else if show_git_gutter && show_line_numbers {
em_width * 2.0
@@ -119,7 +119,6 @@ pub struct Scrollbar {
#[derive(Copy, Clone, Debug, Serialize, Deserialize, JsonSchema, PartialEq, Eq)]
pub struct Gutter {
pub line_numbers: bool,
- pub code_actions: bool,
pub runnables: bool,
pub breakpoints: bool,
pub folds: bool,
@@ -468,10 +467,6 @@ pub struct GutterContent {
///
/// Default: true
pub line_numbers: Option<bool>,
- /// Whether to show code action buttons in the gutter.
- ///
- /// Default: true
- pub code_actions: Option<bool>,
/// Whether to show runnable buttons in the gutter.
///
/// Default: true
@@ -2409,52 +2409,6 @@ impl EditorElement {
elements
}
- fn layout_code_actions_indicator(
- &self,
- line_height: Pixels,
- newest_selection_head: DisplayPoint,
- scroll_pixel_position: gpui::Point<Pixels>,
- gutter_dimensions: &GutterDimensions,
- gutter_hitbox: &Hitbox,
- breakpoint_points: &mut HashMap<DisplayRow, (Anchor, Breakpoint)>,
- display_hunks: &[(DisplayDiffHunk, Option<Hitbox>)],
- window: &mut Window,
- cx: &mut App,
- ) -> Option<AnyElement> {
- let mut active = false;
- let mut button = None;
- let row = newest_selection_head.row();
- self.editor.update(cx, |editor, cx| {
- if let Some(crate::CodeContextMenu::CodeActions(CodeActionsMenu {
- deployed_from_indicator,
- ..
- })) = editor.context_menu.borrow().as_ref()
- {
- active = deployed_from_indicator.map_or(true, |indicator_row| indicator_row == row);
- };
-
- let breakpoint = breakpoint_points.get(&row);
- button = editor.render_code_actions_indicator(&self.style, row, active, breakpoint, cx);
- });
-
- let button = button?;
- breakpoint_points.remove(&row);
-
- let button = prepaint_gutter_button(
- button,
- row,
- line_height,
- gutter_dimensions,
- scroll_pixel_position,
- gutter_hitbox,
- display_hunks,
- window,
- cx,
- );
-
- Some(button)
- }
-
fn calculate_relative_line_numbers(
&self,
snapshot: &EditorSnapshot,
@@ -4857,10 +4811,6 @@ impl EditorElement {
for test_indicator in layout.test_indicators.iter_mut() {
test_indicator.paint(window, cx);
}
-
- if let Some(indicator) = layout.code_actions_indicator.as_mut() {
- indicator.paint(window, cx);
- }
});
}
@@ -7545,7 +7495,6 @@ impl Element for EditorElement {
let gutter_settings = EditorSettings::get_global(cx).gutter;
- let mut code_actions_indicator = None;
if let Some(newest_selection_head) = newest_selection_head {
let newest_selection_point =
newest_selection_head.to_point(&snapshot.display_snapshot);
@@ -7564,52 +7513,6 @@ impl Element for EditorElement {
window,
cx,
);
-
- let show_code_actions = snapshot
- .show_code_actions
- .unwrap_or(gutter_settings.code_actions);
- if show_code_actions {
- let newest_selection_point =
- newest_selection_head.to_point(&snapshot.display_snapshot);
- if !snapshot
- .is_line_folded(MultiBufferRow(newest_selection_point.row))
- {
- let buffer = snapshot.buffer_snapshot.buffer_line_for_row(
- MultiBufferRow(newest_selection_point.row),
- );
- if let Some((buffer, range)) = buffer {
- let buffer_id = buffer.remote_id();
- let row = range.start.row;
- let has_test_indicator = self
- .editor
- .read(cx)
- .tasks
- .contains_key(&(buffer_id, row));
-
- let has_expand_indicator = row_infos
- .get(
- (newest_selection_head.row() - start_row).0
- as usize,
- )
- .is_some_and(|row_info| row_info.expand_info.is_some());
-
- if !has_test_indicator && !has_expand_indicator {
- code_actions_indicator = self
- .layout_code_actions_indicator(
- line_height,
- newest_selection_head,
- scroll_pixel_position,
- &gutter_dimensions,
- &gutter_hitbox,
- &mut breakpoint_rows,
- &display_hunks,
- window,
- cx,
- );
- }
- }
- }
- }
}
}
@@ -7818,7 +7721,6 @@ impl Element for EditorElement {
mouse_context_menu,
test_indicators,
breakpoints,
- code_actions_indicator,
crease_toggles,
crease_trailers,
tab_invisible,
@@ -7989,7 +7891,6 @@ pub struct EditorLayout {
cursors: Vec<(DisplayPoint, Hsla)>,
visible_cursors: Vec<CursorLayout>,
selections: Vec<(PlayerColor, Vec<SelectionLayout>)>,
- code_actions_indicator: Option<AnyElement>,
test_indicators: Vec<AnyElement>,
breakpoints: Vec<AnyElement>,
crease_toggles: Vec<Option<AnyElement>>,