Allow to toggle git hunk diffs (#11080)
Part of https://github.com/zed-industries/zed/issues/4523 Added two new actions with the default keybindings ``` "cmd-'": "editor::ToggleHunkDiff", "cmd-\"": "editor::ExpandAllHunkDiffs", ``` that allow to browse git hunk diffs in Zed: https://github.com/zed-industries/zed/assets/2690773/9a8a7d10-ed06-4960-b4ee-fe28fc5c4768 The hunks are dynamic and alter on user folds and modifications, or toggle hidden, if the modifications were not adjacent to the expanded hunk. Release Notes: - Added `editor::ToggleHunkDiff` (`cmd-'`) and `editor::ExpandAllHunkDiffs` (`cmd-"`) actions to browse git hunk diffs in Zed
This commit is contained in:
parent
5831d80f51
commit
caa0d35b8b
24 changed files with 3115 additions and 249 deletions
|
@ -13,6 +13,7 @@ path = "src/outline.rs"
|
|||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
collections.workspace = true
|
||||
editor.workspace = true
|
||||
fuzzy.workspace = true
|
||||
gpui.workspace = true
|
||||
|
|
|
@ -98,6 +98,8 @@ struct OutlineViewDelegate {
|
|||
last_query: String,
|
||||
}
|
||||
|
||||
enum OutlineRowHighlights {}
|
||||
|
||||
impl OutlineViewDelegate {
|
||||
fn new(
|
||||
outline_view: WeakView<OutlineView>,
|
||||
|
@ -150,8 +152,6 @@ impl OutlineViewDelegate {
|
|||
}
|
||||
}
|
||||
|
||||
enum OutlineRowHighlights {}
|
||||
|
||||
impl PickerDelegate for OutlineViewDelegate {
|
||||
type ListItem = ListItem;
|
||||
|
||||
|
@ -316,6 +316,7 @@ impl PickerDelegate for OutlineViewDelegate {
|
|||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use collections::HashSet;
|
||||
use gpui::{TestAppContext, VisualTestContext};
|
||||
use indoc::indoc;
|
||||
use language::{Language, LanguageConfig, LanguageMatcher};
|
||||
|
@ -482,7 +483,10 @@ mod tests {
|
|||
|
||||
fn highlighted_display_rows(editor: &View<Editor>, cx: &mut VisualTestContext) -> Vec<u32> {
|
||||
editor.update(cx, |editor, cx| {
|
||||
editor.highlighted_display_rows(cx).into_keys().collect()
|
||||
editor
|
||||
.highlighted_display_rows(HashSet::default(), cx)
|
||||
.into_keys()
|
||||
.collect()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue