Improve context expansion (#10957)

Release Notes:

- Improved expand excerpt indicators to allow unidirectional expansion.
Also added the `editor::ExpandExcerptsUp` and
`editor::ExpandExcerptsDown` actions, which can both take a `lines`
parameter. Also added a `expand_excerpt_lines` setting which controls
the default number of lines that the indicators and actions use.

---------

Co-authored-by: conrad <conrad@zed.dev>
This commit is contained in:
Mikayla Maki 2024-05-26 16:30:09 -07:00 committed by GitHub
parent a0f91299dd
commit a9e3d4ec4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 904 additions and 328 deletions

View file

@ -2662,8 +2662,8 @@ pub mod tests {
});
cx.executor().run_until_parked();
let editor =
cx.add_window(|cx| Editor::for_multibuffer(multibuffer, Some(project.clone()), cx));
let editor = cx
.add_window(|cx| Editor::for_multibuffer(multibuffer, Some(project.clone()), true, cx));
let editor_edited = Arc::new(AtomicBool::new(false));
let fake_server = fake_servers.next().await.unwrap();
@ -2871,6 +2871,7 @@ pub mod tests {
"main hint #5".to_string(),
"other hint(edited) #0".to_string(),
"other hint(edited) #1".to_string(),
"other hint(edited) #2".to_string(),
];
assert_eq!(
expected_hints,
@ -2881,8 +2882,8 @@ pub mod tests {
assert_eq!(expected_hints, visible_hint_labels(editor, cx));
let current_cache_version = editor.inlay_hint_cache().version;
// We expect two new hints for the excerpts from `other.rs`:
let expected_version = last_scroll_update_version + 2;
// We expect three new hints for the excerpts from `other.rs`:
let expected_version = last_scroll_update_version + 3;
assert_eq!(
current_cache_version,
expected_version,
@ -2970,8 +2971,8 @@ pub mod tests {
assert!(!buffer_2_excerpts.is_empty());
cx.executor().run_until_parked();
let editor =
cx.add_window(|cx| Editor::for_multibuffer(multibuffer, Some(project.clone()), cx));
let editor = cx
.add_window(|cx| Editor::for_multibuffer(multibuffer, Some(project.clone()), true, cx));
let editor_edited = Arc::new(AtomicBool::new(false));
let fake_server = fake_servers.next().await.unwrap();
let closure_editor_edited = Arc::clone(&editor_edited);