Remove into SelectionEffects from .change_selections

In #32656 I generalized the argument to change selections to allow
controling both the scroll and the nav history (and the completion
trigger).

To avoid conflicting with ongoing debugger cherry-picks I left the
argument as an `impl Into<>`, but I think it's clearer to make callers
specify what they want here.

I converted a lot of `None` arguments to `SelectionEffects::no_scroll()`
to be exactly compatible; but I think many people used none as an "i
don't care" value in which case Default::default() might be more
appropraite
This commit is contained in:
Conrad Irwin 2025-06-27 09:48:17 -06:00
parent f338c46bf7
commit 28380d714d
65 changed files with 837 additions and 625 deletions

View file

@ -18,7 +18,7 @@ use client::zed_urls;
use collections::VecDeque;
use debugger_ui::debugger_panel::DebugPanel;
use editor::ProposedChangesEditorToolbar;
use editor::{Editor, MultiBuffer, scroll::Autoscroll};
use editor::{Editor, MultiBuffer};
use futures::future::Either;
use futures::{StreamExt, channel::mpsc, select_biased};
use git_ui::git_panel::GitPanel;
@ -1125,7 +1125,7 @@ fn open_log_file(workspace: &mut Workspace, window: &mut Window, cx: &mut Contex
editor.update(cx, |editor, cx| {
let last_multi_buffer_offset = editor.buffer().read(cx).len(cx);
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
editor.change_selections(Default::default(), window, cx, |s| {
s.select_ranges(Some(
last_multi_buffer_offset..last_multi_buffer_offset,
));
@ -1774,7 +1774,7 @@ mod tests {
use super::*;
use assets::Assets;
use collections::HashSet;
use editor::{DisplayPoint, Editor, display_map::DisplayRow, scroll::Autoscroll};
use editor::{DisplayPoint, Editor, SelectionEffects, display_map::DisplayRow};
use gpui::{
Action, AnyWindowHandle, App, AssetSource, BorrowAppContext, SemanticVersion,
TestAppContext, UpdateGlobal, VisualTestContext, WindowHandle, actions,
@ -3348,7 +3348,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
editor.change_selections(Default::default(), window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(10), 0)
..DisplayPoint::new(DisplayRow(10), 0)])
});
@ -3378,7 +3378,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor3.update(cx, |editor, cx| {
editor.change_selections(Some(Autoscroll::fit()), window, cx, |s| {
editor.change_selections(Default::default(), window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(12), 0)
..DisplayPoint::new(DisplayRow(12), 0)])
});
@ -3593,7 +3593,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.change_selections(None, window, cx, |s| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(15), 0)
..DisplayPoint::new(DisplayRow(15), 0)])
})
@ -3604,7 +3604,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.change_selections(None, window, cx, |s| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(3), 0)
..DisplayPoint::new(DisplayRow(3), 0)])
});
@ -3615,7 +3615,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.change_selections(None, window, cx, |s| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(13), 0)
..DisplayPoint::new(DisplayRow(13), 0)])
})
@ -3627,7 +3627,7 @@ mod tests {
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.transact(window, cx, |editor, window, cx| {
editor.change_selections(None, window, cx, |s| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(2), 0)
..DisplayPoint::new(DisplayRow(14), 0)])
});
@ -3640,7 +3640,7 @@ mod tests {
workspace
.update(cx, |_, window, cx| {
editor1.update(cx, |editor, cx| {
editor.change_selections(None, window, cx, |s| {
editor.change_selections(SelectionEffects::no_scroll(), window, cx, |s| {
s.select_display_ranges([DisplayPoint::new(DisplayRow(1), 0)
..DisplayPoint::new(DisplayRow(1), 0)])
})