chore: Remove outline dependency from breadcrumbs (#22504)

This slashes our incremental dev times (touch editor) by 0.6s
(8.1->7.6s) due to unblocking terminal_view build sooner.

Closes #ISSUE

Release Notes:

- N/A
This commit is contained in:
Piotr Osiewicz 2024-12-30 13:08:26 +01:00 committed by GitHub
parent 5f4f3a9c87
commit 3f33ca01a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 43 additions and 16 deletions

View file

@ -25,6 +25,7 @@ theme.workspace = true
ui.workspace = true
util.workspace = true
workspace.workspace = true
zed_actions.workspace = true
[dev-dependencies]
editor = { workspace = true, features = ["test-support"] }

View file

@ -4,9 +4,7 @@ use std::{
sync::Arc,
};
use editor::{
actions::ToggleOutline, scroll::Autoscroll, Anchor, AnchorRangeExt, Editor, EditorMode,
};
use editor::{scroll::Autoscroll, Anchor, AnchorRangeExt, Editor, EditorMode};
use fuzzy::StringMatch;
use gpui::{
div, rems, AppContext, DismissEvent, EventEmitter, FocusHandle, FocusableView, HighlightStyle,
@ -24,9 +22,22 @@ use workspace::{DismissDecision, ModalView};
pub fn init(cx: &mut AppContext) {
cx.observe_new_views(OutlineView::register).detach();
zed_actions::outline::TOGGLE_OUTLINE
.set(|view, cx| {
let Ok(view) = view.downcast::<Editor>() else {
return;
};
toggle(view, &Default::default(), cx);
})
.ok();
}
pub fn toggle(editor: View<Editor>, _: &ToggleOutline, cx: &mut WindowContext) {
pub fn toggle(
editor: View<Editor>,
_: &zed_actions::outline::ToggleOutline,
cx: &mut WindowContext,
) {
let outline = editor
.read(cx)
.buffer()
@ -459,7 +470,7 @@ mod tests {
workspace: &View<Workspace>,
cx: &mut VisualTestContext,
) -> View<Picker<OutlineViewDelegate>> {
cx.dispatch_action(ToggleOutline);
cx.dispatch_action(zed_actions::outline::ToggleOutline);
workspace.update(cx, |workspace, cx| {
workspace
.active_modal::<OutlineView>(cx)