id stringlengths 20 30 | source stringclasses 1
value | chunk_index int64 0 520k | token_count int32 154 512 | content stringlengths 185 57.5k |
|---|---|---|---|---|
rust_dataset_chunk_507800 | rust_dataset.txt | 507,800 | 512 | (cx, &workspace);
workspace.update_in(cx, |workspace, window, cx| {
let item = cx.new(TestItem::new);
workspace.add_item(pane_b.clone(), Box::new(item), None, true, true, window, cx);
});
// Toggle editor zoom maximizes the active pane
workspace.update_in(cx, |wo... |
rust_dataset_chunk_507801 | rust_dataset.txt | 507,801 | 512 | ).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project, window, cx));
workspace.update_in(cx, |workspace, window, cx| {
// Open two docks
let left_dock = workspace.dock_at_position(DockPosition::Left);
let right_dock = w... |
rust_dataset_chunk_507802 | rust_dataset.txt | 507,802 | 512 | , window, cx));
right_dock.update(cx, |dock, cx| dock.set_open(true, window, cx));
assert!(left_dock.read(cx).is_open());
assert!(right_dock.read(cx).is_open());
});
workspace.update_in(cx, |workspace, window, cx| {
// Close them manually
wor... |
rust_dataset_chunk_507803 | rust_dataset.txt | 507,803 | 512 | .toggle_dock(DockPosition::Right, window, cx);
// Verify initial state
assert!(
workspace.left_dock().read(cx).is_open(),
"Left dock should be open"
);
assert_eq!(
workspace
.left_dock()
... |
rust_dataset_chunk_507804 | rust_dataset.txt | 507,804 | 512 | workspace.left_dock().read(cx).is_open(),
"Left dock should be closed"
);
assert!(
!workspace.right_dock().read(cx).is_open(),
"Right dock should be closed"
);
assert!(
!workspace.bottom_dock().read(cx).is_op... |
rust_dataset_chunk_507805 | rust_dataset.txt | 507,805 | 512 | cx| {
TestItem::new(cx).with_project_items(&[TestProjectItem::new(2, "bottom.txt", cx)])
});
let left_item = cx.new(|cx| {
TestItem::new(cx).with_project_items(&[TestProjectItem::new(3, "left.txt", cx)])
});
let right_item = cx.new(|cx| {
TestItem::new... |
rust_dataset_chunk_507806 | rust_dataset.txt | 507,806 | 512 | .active_pane().clone(),
SplitDirection::Left,
window,
cx,
);
right_pane_id
});
let center_pane_id = workspace.update_in(cx, |workspace, window, cx| {
let center_pane_id = workspace.active_pane().entity_id();
... |
rust_dataset_chunk_507807 | rust_dataset.txt | 507,807 | 512 | active_pane.entity_id());
assert_eq!(4, active_pane.read(cx).items_len());
let item_ids_in_pane =
HashSet::from_iter(active_pane.read(cx).items().map(|item| item.item_id()));
assert!(item_ids_in_pane.contains(¢er_item.item_id()));
assert!(item_ids_in_... |
rust_dataset_chunk_507808 | rust_dataset.txt | 507,808 | 512 | &mut VisualTestContext, workspace: &Entity<Workspace>) -> Entity<Pane> {
workspace.update_in(cx, |workspace, window, cx| {
workspace.split_pane(
workspace.active_pane().clone(),
SplitDirection::Right,
window,
cx,
)
... |
rust_dataset_chunk_507809 | rust_dataset.txt | 507,809 | 512 | >(window, cx);
});
cx.run_until_parked();
workspace.update_in(cx, |_, window, cx| {
assert!(panel.focus_handle(cx).is_focused(window));
});
workspace.update_in(cx, |workspace, window, cx| {
assert_eq!(workspace.active_pane(), &second_pane);
le... |
rust_dataset_chunk_507810 | rust_dataset.txt | 507,810 | 512 | 2,
"the split should survive the zoom"
);
});
assert_zoomed_pane_is_padded(cx);
workspace.update_in(cx, |workspace, window, cx| {
workspace.toggle_centered_layout(&ToggleCenteredLayout, window, cx);
});
cx.run_until_parked();
as... |
rust_dataset_chunk_507811 | rust_dataset.txt | 507,811 | 512 | ed_padding_bounds(
cx: &mut VisualTestContext,
) -> (Option<Bounds<Pixels>>, Option<Bounds<Pixels>>) {
(
cx.debug_bounds("zoomed_centered_layout_left_padding"),
cx.debug_bounds("zoomed_centered_layout_right_padding"),
)
}
fn assert_zoomed_pane_is_padded(cx: &... |
rust_dataset_chunk_507812 | rust_dataset.txt | 507,812 | 512 | 4);
assert_eq!(num_items_in_current_pane, 1);
assert_eq!(active_item.item_id(), last_item.item_id());
});
workspace.update_in(cx, |workspace, window, cx| {
workspace.join_all_panes(window, cx);
});
workspace.update(cx, |workspace, cx| {
l... |
rust_dataset_chunk_507813 | rust_dataset.txt | 507,813 | 512 | cx);
workspace.bounds.size.width = px(1920.);
let dock = workspace.right_dock().read(cx);
let initial_width = workspace
.dock_size(&dock, window, cx)
.expect("flexible dock should have an initial width");
assert_eq!(initial_width, px(960... |
rust_dataset_chunk_507814 | rust_dataset.txt | 507,814 | 512 | dock.stored_panel_size_state(&right_panel)
.and_then(|state| state.size),
None
);
});
});
}
#[gpui::test]
async fn test_panel_size_state_persistence(cx: &mut gpui::TestAppContext) {
init_test(cx);
let fs = Fake... |
rust_dataset_chunk_507815 | rust_dataset.txt | 507,815 | 512 | | left_dock.stored_panel_size_state(&p));
assert_eq!(
size_state.and_then(|s| s.size),
Some(px(350.)),
"re-added fixed-width panel should restore persisted size from KVP"
);
});
}
// Flexible panel: ... |
rust_dataset_chunk_507816 | rust_dataset.txt | 507,816 | 512 | ));
workspace.add_panel(new_panel, window, cx);
let right_dock = workspace.right_dock().read(cx);
let size_state = right_dock
.panel::<TestPanel>()
.and_then(|p| right_dock.stored_panel_size_state(&p))
.expect("... |
rust_dataset_chunk_507817 | rust_dataset.txt | 507,817 | 512 | |_, _| {});
});
cx.run_until_parked();
let dock_size = workspace.read_with(cx, |workspace, cx| {
workspace
.left_dock()
.read(cx)
.panel::<TestPanel>()
.and_then(|panel| {
workspace
... |
rust_dataset_chunk_507818 | rust_dataset.txt | 507,818 | 512 | = workspace.left_dock().read(cx);
let first_panel_size = dock.stored_panel_size(&first_panel, window, cx);
let second_panel_size = dock.stored_panel_size(&second_panel, window, cx);
assert_eq!(first_panel_size, Some(px(350.)));
assert_eq!(second_panel_size, Some(px(350.... |
rust_dataset_chunk_507819 | rust_dataset.txt | 507,819 | 512 | |panel, _| panel.flexible = false);
second_panel.update(cx, |panel, _| panel.flexible = false);
workspace.left_dock().update(cx, |dock, cx| {
dock.activate_panel(0, window, cx);
});
workspace.resize_left_dock(px(400.), window, cx);
workspace.l... |
rust_dataset_chunk_507820 | rust_dataset.txt | 507,820 | 512 | (375.);
panel
});
let flexible_panel_a =
cx.new(|cx| TestPanel::new_flexible(DockPosition::Left, 300, cx));
let flexible_panel_b =
cx.new(|cx| TestPanel::new_flexible(DockPosition::Left, 400, cx));
... |
rust_dataset_chunk_507821 | rust_dataset.txt | 507,821 | 512 | cx);
let fixed_panel_b_size = dock.stored_panel_size(&fixed_panel_b, window, cx);
let flexible_panel_a_flex = dock
.stored_panel_size_state(&flexible_panel_a)
.and_then(|state| state.flex);
let flexible_panel_b_flex = dock
.stored_pane... |
rust_dataset_chunk_507822 | rust_dataset.txt | 507,822 | 512 | MultiWorkspace::test_new(project, window, cx));
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
workspace.update(cx, |workspace, _cx| {
workspace.bounds.size.width = px(900.);
});
// Step 1: Add a tab to the center pane then open a flexible p... |
rust_dataset_chunk_507823 | rust_dataset.txt | 507,823 | 512 | // not change the number of center columns, so the flexible panel width stays the same.
workspace.update_in(cx, |workspace, window, cx| {
workspace.split_pane(
workspace.active_pane().clone(),
SplitDirection::Down,
window,
cx,
... |
rust_dataset_chunk_507824 | rust_dataset.txt | 507,824 | 512 | ock_panel_flexible_size(
&right_dock,
right_panel.as_ref(),
window,
cx,
);
let right_dock = right_dock.read(cx);
let right_panel = right_dock
.visible_panel()
.expect("right dock should s... |
rust_dataset_chunk_507825 | rust_dataset.txt | 507,825 | 512 | : &mut Window,
_cx: &mut Context<TestModal>,
) -> impl IntoElement {
div().track_focus(&self.0)
}
}
// Registers its focus handle as a reopenable picker on construction, like a real
// `Picker` does, so the modal layer recognizes it by focus identity.
struct Reop... |
rust_dataset_chunk_507826 | rust_dataset.txt | 507,826 | 512 | A reopenable modal is stashed on dismissal and revealed as the *same*
// entity, so its prior state is preserved exactly.
workspace.update_in(cx, |workspace, window, cx| {
workspace.toggle_modal(window, cx, ReopenableTestModal::new);
});
cx.executor().run_until_parked();
... |
rust_dataset_chunk_507827 | rust_dataset.txt | 507,827 | 512 | window, cx| {
let revealed = workspace.modal_layer.update(cx, |modal_layer, cx| {
modal_layer.hide_modal(window, cx);
modal_layer.reveal_stashed_modal(window, cx)
});
assert!(
revealed,
"a non-reopenable modal must not ... |
rust_dataset_chunk_507828 | rust_dataset.txt | 507,828 | 512 | run_until_parked();
// A non-reopenable modal is already active when the reopen fires, and it
// dismisses *after* the action rather than before it.
workspace.update_in(cx, |workspace, window, cx| {
workspace.toggle_modal(window, cx, TestModal::new);
});
cx.executor(... |
rust_dataset_chunk_507829 | rust_dataset.txt | 507,829 | 512 | ock_size(&left_dock.read(cx), window, cx),
Some(px(300.))
);
workspace.resize_left_dock(px(1337.), window, cx);
assert_eq!(
workspace
.right_dock()
.read(cx)
.visible_panel()
... |
rust_dataset_chunk_507830 | rust_dataset.txt | 507,830 | 512 | |workspace, window, cx| {
// Since panel_1 was visible on the right, we open the left dock and make panel_1 active.
let left_dock = workspace.left_dock();
assert!(left_dock.read(cx).is_open());
assert_eq!(
left_dock.read(cx).visible_panel().unwrap().panel... |
rust_dataset_chunk_507831 | rust_dataset.txt | 507,831 | 512 | ));
// Wo don't close the left dock, because panel_2 wasn't the active panel
workspace.update(cx, |workspace, cx| {
let left_dock = workspace.left_dock();
assert!(left_dock.read(cx).is_open());
assert_eq!(
left_dock.read(cx).visible_panel().unwrap().p... |
rust_dataset_chunk_507832 | rust_dataset.txt | 507,832 | 512 | the panel is no longer zoomed.
workspace.update_in(cx, |_workspace, window, cx| {
cx.focus_self(window);
});
workspace.read_with(cx, |workspace, _| {
assert_eq!(workspace.zoomed, None);
assert_eq!(workspace.zoomed_position, None);
});
// If f... |
rust_dataset_chunk_507833 | rust_dataset.txt | 507,833 | 512 | PanelEvent::Activate` on one panel
// does not end up transitively activating the other when the dock is
// re-opened.
let (panel_a, panel_b) = workspace.update_in(cx, |workspace, window, cx| {
let panel_a = cx.new(|cx| TestPanel::new(DockPosition::Bottom, 0, cx));
let pa... |
rust_dataset_chunk_507834 | rust_dataset.txt | 507,834 | 512 | TestAppContext) {
init_test(cx);
let fs = FakeFs::new(cx.executor());
let project = Project::test(fs, [], cx).await;
let (multi_workspace, cx) =
cx.add_window_view(|window, cx| MultiWorkspace::test_new(project, window, cx));
let workspace = multi_workspace.read_with(... |
rust_dataset_chunk_507835 | rust_dataset.txt | 507,835 | 512 | _with_activation_child(DockPosition::Right, 100, cx));
workspace.add_panel(panel.clone(), window, cx);
workspace.toggle_dock(DockPosition::Right, window, cx);
panel
});
cx.executor().run_until_parked();
workspace.update_in(cx, |_workspace, window, cx| {
... |
rust_dataset_chunk_507836 | rust_dataset.txt | 507,836 | 512 | ")
.with_project_items(&[
dirty_regular_buffer.read(cx).project_items[0].clone(),
dirty_regular_buffer_2.read(cx).project_items[0].clone(),
])
});
let multi_buffer_with_both_files_id = dirty_multi_buffer_with_both.item_id();
... |
rust_dataset_chunk_507837 | rust_dataset.txt | 507,837 | 512 | .update(cx, |buffer, cx| {
buffer.project_items[0].update(cx, |pi, _| pi.is_dirty = true)
});
let close_multi_buffer_task = pane.update_in(cx, |pane, window, cx| {
pane.close_active_item(
&CloseActiveItem {
save_intent: Some(SaveIntent::Close)... |
rust_dataset_chunk_507838 | rust_dataset.txt | 507,838 | 512 | ::new(cx)
.with_label("3.txt")
.with_project_items(&[TestProjectItem::new(3, "3.txt", cx)])
});
let dirty_multi_buffer_with_both = cx.new(|cx| {
TestItem::new(cx)
.with_dirty(true)
.with_buffer_kind(ItemBufferKind::Multibuffer)... |
rust_dataset_chunk_507839 | rust_dataset.txt | 507,839 | 512 | settings.workspace.close_on_file_delete = Some(true);
});
});
let fs = FakeFs::new(cx.background_executor.clone());
let project = Project::test(fs, [], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project, window, cx));
... |
rust_dataset_chunk_507840 | rust_dataset.txt | 507,840 | 512 | _executor.clone());
let project = Project::test(fs, [], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project, window, cx));
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
// Create a test item that ... |
rust_dataset_chunk_507841 | rust_dataset.txt | 507,841 | 512 | settings.workspace.close_on_file_delete = Some(true);
});
});
let fs = FakeFs::new(cx.background_executor.clone());
let project = Project::test(fs, [], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project, w... |
rust_dataset_chunk_507842 | rust_dataset.txt | 507,842 | 512 | .workspace.close_on_file_delete = Some(true);
});
});
let fs = FakeFs::new(cx.background_executor.clone());
let project = Project::test(fs, [], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project, window, cx));
let... |
rust_dataset_chunk_507843 | rust_dataset.txt | 507,843 | 512 | .read_with(cx, |pane, _| {
assert_eq!(
pane.items().count(),
1,
"Should have 1 item remaining after auto-close"
);
});
// Check navigation history after close
let has_item = pane.read_with(cx, |pane, cx| {
let m... |
rust_dataset_chunk_507844 | rust_dataset.txt | 507,844 | 512 | _by_id(unreopenable_item.item_id(), SaveIntent::Skip, window, cx)
.detach_and_log_err(cx);
});
cx.run_until_parked();
workspace
.update_in(cx, |workspace, window, cx| {
workspace.reopen_closed_item(window, cx)
})
.await
... |
rust_dataset_chunk_507845 | rust_dataset.txt | 507,845 | 512 | .add_item(
pane.clone(),
Box::new(dirty_regular_buffer.clone()),
None,
false,
false,
window,
cx,
);
workspace.add_item(
pane.clone(),
Box::new(dirty_reg... |
rust_dataset_chunk_507846 | rust_dataset.txt | 507,846 | 512 | (multi_workspace, cx) =
cx.add_window_view(|window, cx| MultiWorkspace::test_new(project, window, cx));
let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone());
// Add a new panel to the right dock, opening the dock and setting the
// focus to the new panel.
... |
rust_dataset_chunk_507847 | rust_dataset.txt | 507,847 | 512 | | {
workspace.toggle_panel_focus::<TestPanel>(window, cx);
});
cx.dispatch_action(MoveFocusedPanelToNextPosition);
workspace.update(cx, |workspace, cx| {
assert!(workspace.right_dock().read(cx).is_open());
assert_eq!(panel.read(cx).position, DockPosition::Rig... |
rust_dataset_chunk_507848 | rust_dataset.txt | 507,848 | 512 | ));
let item_1 = cx.new(|cx| {
TestItem::new(cx).with_project_items(&[TestProjectItem::new(1, "first.txt", cx)])
});
workspace.update_in(cx, |workspace, window, cx| {
workspace.add_item_to_active_pane(Box::new(item_1), None, true, window, cx);
workspace.move_... |
rust_dataset_chunk_507849 | rust_dataset.txt | 507,849 | 512 | (cx).with_project_items(&[TestProjectItem::new(3, "third.txt", cx)])
});
workspace.update_in(cx, |workspace, window, cx| {
let original_pane = workspace.panes[0].clone();
workspace.set_active_pane(&original_pane, window, cx);
workspace.add_item_to_active_pane(Box::new... |
rust_dataset_chunk_507850 | rust_dataset.txt | 507,850 | 512 | .move_item_to_pane_in_direction(
&MoveItemToPaneInDirection {
direction: SplitDirection::Right,
focus: true,
clone: true,
},
window,
cx,
);
});
cx.run_until_parked();
... |
rust_dataset_chunk_507851 | rust_dataset.txt | 507,851 | 512 | .update_in(cx, |workspace, window, cx| {
workspace.split_pane(pane_a.clone(), SplitDirection::Right, window, cx)
});
// Add item with SAME project path to pane B, and pin it
let item_b = cx.new(|cx| {
TestItem::new(cx).with_project_items(&[TestProjectItem::new(1, "test.t... |
rust_dataset_chunk_507852 | rust_dataset.txt | 507,852 | 512 | _items(&[TestProjectItem::new(1, "test.txt", cx)])
});
pane_c.update_in(cx, |pane, window, cx| {
pane.add_item(Box::new(item_c.clone()), true, true, None, window, cx);
});
// close_pinned: true should close the pinned copy too
workspace.update_in(cx, |workspace, wind... |
rust_dataset_chunk_507853 | rust_dataset.txt | 507,853 | 512 | ::new("TestItem", 4, false, false),
],
true,
2,
),
cx,
)
.await;
let (items_len, pinned_count) =
pane.read_with(cx, |pane, _| (pane.items_len(), pane.pinned_count()));
assert_eq!(items_len, 3);
as... |
rust_dataset_chunk_507854 | rust_dataset.txt | 507,854 | 512 | cx,
)
.await;
pane.read_with(cx, |pane, _| {
assert_eq!(pane.items_len(), 2);
assert_eq!(pane.active_item_index(), 0);
assert_eq!(
pane.preview_item_id(),
pane.item_for_index(1).map(|item| item.item_id()),
"the ... |
rust_dataset_chunk_507855 | rust_dataset.txt | 507,855 | 512 | should shrink the pinned count"
);
// The same holds when the dropped tabs lead the pinned region.
let pane = serialize_pane(&workspace, &[false, false, true, true, true], 4, cx);
assert_eq!(pane.children.len(), 3);
assert_eq!(pane.pinned_count, 2);
// Dropping an unpi... |
rust_dataset_chunk_507856 | rust_dataset.txt | 507,856 | 512 | project = workspace.project().clone();
let workspace = cx.entity().downgrade();
let task = window.spawn(cx, async move |cx| {
serialized_pane
.deserialize_to(
&project,
&weak_pane,
Worksp... |
rust_dataset_chunk_507857 | rust_dataset.txt | 507,857 | 512 | impl Render for TestPngItemView {
fn render(
&mut self,
_window: &mut Window,
_cx: &mut Context<Self>,
) -> impl IntoElement {
Empty
}
}
impl ProjectItem for TestPngItemView {
type Item = Te... |
rust_dataset_chunk_507858 | rust_dataset.txt | 507,858 | 512 | for TestIpynbItemView {
type Item = TestIpynbItem;
fn for_project_item(
_project: Entity<Project>,
_pane: Option<&Pane>,
_item: Entity<Self::Item>,
_: &mut Window,
cx: &mut Context<Self>,
) -> Self
... |
rust_dataset_chunk_507859 | rust_dataset.txt | 507,859 | 512 | let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let worktree_id = project.update(cx, |project, cx| {
project.worktrees(cx).next().unwrap().read(cx).id()
});
let handle = workspace
... |
rust_dataset_chunk_507860 | rust_dataset.txt | 507,860 | 512 | clone());
let one_in_left_pane = workspace
.update_in(cx, |workspace, window, cx| {
workspace.open_path(
(worktree_id, rel_path("one.png")),
Some(left_pane.downgrade()),
true,
... |
rust_dataset_chunk_507861 | rust_dataset.txt | 507,861 | 512 | two_in_right_pane = workspace
.update_in(cx, |workspace, window, cx| {
workspace.open_path(
(worktree_id, rel_path("two.png")),
Some(right_pane.downgrade()),
true,
window,
... |
rust_dataset_chunk_507862 | rust_dataset.txt | 507,862 | 512 | opened_item.read_with(cx, |item, _| item.project_path.clone());
assert_eq!(project_path.worktree_id, worktree_id);
assert_eq!(project_path.path.as_ref(), rel_path("docs/sibling.png"));
}
#[gpui::test]
async fn test_register_project_item_two_enter_one_leaves(cx: &mut Tes... |
rust_dataset_chunk_507863 | rust_dataset.txt | 507,863 | 512 | ::test_new(project.clone(), window, cx));
// Test with status bar shown (default)
workspace.read_with(cx, |workspace, cx| {
let visible = workspace.status_bar_visible(cx);
assert!(visible, "Status bar should be visible by default");
});
// Test with status bar h... |
rust_dataset_chunk_507864 | rust_dataset.txt | 507,864 | 512 | pane, window, cx| {
pane.add_item(Box::new(item_a.clone()), true, true, None, window, cx);
pane.add_item(Box::new(item_b.clone()), true, true, None, window, cx);
});
pane.read_with(cx, |pane, _| {
assert_eq!(pane.items_len(), 2);
assert_eq!(pane.active_it... |
rust_dataset_chunk_507865 | rust_dataset.txt | 507,865 | 512 | (true, window, cx));
panel
});
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
let item_a = cx.new(TestItem::new);
let item_b = cx.new(TestItem::new);
let item_b_id = item_b.entity_id();
pane.update_in(cx, |pane, window, ... |
rust_dataset_chunk_507866 | rust_dataset.txt | 507,866 | 512 | cx)
})
.unwrap();
// Switch to workspace A
multi_workspace_handle
.update(cx, |mw, window, cx| {
let workspace = mw.workspaces().next().unwrap().clone();
mw.activate(workspace, None, window, cx);
})
.unwrap();
... |
rust_dataset_chunk_507867 | rust_dataset.txt | 507,867 | 512 | and the dock is still open
workspace_a.update_in(cx, |workspace, window, cx| {
assert!(
workspace.right_dock().read(cx).is_open(),
"dock should still be open after switching back"
);
assert!(
panel.is_zoomed(window, cx),
... |
rust_dataset_chunk_507868 | rust_dataset.txt | 507,868 | 512 | }
#[gpui::test]
async fn test_background_workspace_does_not_clobber_window_title(cx: &mut TestAppContext) {
init_test(cx);
let fs = FakeFs::new(cx.executor());
fs.insert_tree(path!("/root1"), json!({ "a.txt": "" }))
.await;
fs.insert_tree(path!("/root2"), json!({ "b... |
rust_dataset_chunk_507869 | rust_dataset.txt | 507,869 | 512 | cx.update(|cx| {
let settings_store = SettingsStore::test(cx);
cx.set_global(settings_store);
cx.set_global(db::AppDatabase::test_new());
theme_settings::init(theme::LoadThemes::JustBase, cx);
});
}
#[gpui::test]
async fn test_toggle_theme_mode_persi... |
rust_dataset_chunk_507870 | rust_dataset.txt | 507,870 | 512 | . Static -> Dynamic
// this assertion checks theme changed from static to dynamic.
let settings_text = SettingsStore::load_settings(&settings_fs).await.unwrap();
let parsed: serde_json::Value = settings::parse_json_with_comments(&settings_text).unwrap();
assert_eq!(
parsed["t... |
rust_dataset_chunk_507871 | rust_dataset.txt | 507,871 | 512 | .clone(), window, cx);
workspace
.right_dock()
.update(cx, |dock, cx| dock.set_open(true, window, cx));
panel
});
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
pane.update_in(cx, |pane, window, cx| {
... |
rust_dataset_chunk_507872 | rust_dataset.txt | 507,872 | 512 | .executor());
let project = Project::test(fs, [], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project, window, cx));
// Add two panels to the left dock and open it.
let (panel_a, panel_b) = workspace.update_in(cx, |workspace, window, ... |
rust_dataset_chunk_507873 | rust_dataset.txt | 507,873 | 512 | assert!(
workspace.right_dock().read(cx).is_open(),
"Right dock should still be open after a settings change"
);
assert_eq!(
workspace.right_dock().read(cx).panels_len(),
2,
"Both panels should still be i... |
rust_dataset_chunk_507874 | rust_dataset.txt | 507,874 | 512 | fs.insert_tree(
path!("/project"),
json!({
"dir": { "deleted.rs": "", "excluded.rs": "" },
"dir2": { "retained.rs": "" },
"replaced.rs": "old",
}),
)
.await;
fs.insert_tree(path!("/other"), json!({ "dir":... |
rust_dataset_chunk_507875 | rust_dataset.txt | 507,875 | 512 | _eq!(
workspace.read_with(cx, |workspace, _| workspace
.persisted_recent_navigation_history
.clone()),
original_history
);
workspace.read_with(cx, |workspace, cx| {
assert_eq!(
workspace
.recent_navi... |
rust_dataset_chunk_507876 | rust_dataset.txt | 507,876 | 512 | cx,
);
assert_eq!(workspace.persisted_recent_navigation_history, expected);
});
cx.run_until_parked();
assert_eq!(fs.metadata_call_count(), metadata_calls);
cx.executor().advance_clock(SERIALIZATION_THROTTLE_TIME);
cx.run_until_parked();
... |
rust_dataset_chunk_507877 | rust_dataset.txt | 507,877 | 512 | _id,
cx,
)])
});
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
workspace.update_in(cx, |workspace, window, cx| {
workspace.add_item_to_active_pane(Box::new(item_a.clone()), None, true, window, cx);
});
... |
rust_dataset_chunk_507878 | rust_dataset.txt | 507,878 | 512 | .unwrap()
.item_id()),
item_a.entity_id()
);
project
.update(cx, |project, cx| project.save_buffer(buffer.clone(), cx))
.await
.unwrap();
item_a.update(cx, |_, cx| cx.emit(ItemEvent::UpdateBreadcrumbs));
workspace.read_with... |
rust_dataset_chunk_507879 | rust_dataset.txt | 507,879 | 512 | #[gpui::test]
async fn test_recent_navigation_history_includes_persisted_paths(
cx: &mut gpui::TestAppContext,
) {
init_test(cx);
let fs = FakeFs::new(cx.executor());
fs.insert_tree(
path!("/project"),
json!({
"a.rs": "",
... |
rust_dataset_chunk_507880 | rust_dataset.txt | 507,880 | 512 | let fs = FakeFs::new(cx.executor());
fs.insert_tree(
path!("/project"),
json!({
"a.rs": "",
"b.rs": "",
}),
)
.await;
let project = Project::test(fs, [path!("/project").as_ref()], cx).await;
let (workspace, cx) ... |
rust_dataset_chunk_507881 | rust_dataset.txt | 507,881 | 512 | {
project_item.project_path = Some(path_b.clone());
});
item.update(cx, |_, cx| {
cx.emit(ItemEvent::UpdateBreadcrumbs);
});
assert_eq!(
workspace.read_with(cx, |workspace, _| {
workspace.persisted_recent_navigation_history.clone()
... |
rust_dataset_chunk_507882 | rust_dataset.txt | 507,882 | 512 | ().read(cx).id()
});
for index in 0..=MAX_RECENT_SELECTIONS {
workspace.update(cx, |workspace, cx| {
assert!(workspace.remember_navigation_history_path(
&ProjectPath {
worktree_id,
path: rel_path(&format!("{i... |
rust_dataset_chunk_507883 | rust_dataset.txt | 507,883 | 512 | ("dir").into(),
};
let entry_id = project.entry_for_path(&directory_path, cx).unwrap().id;
(worktree_id, entry_id)
});
workspace.update(cx, |workspace, _| {
workspace.persisted_recent_navigation_history = vec![
PathBuf::from(path!("/projec... |
rust_dataset_chunk_507884 | rust_dataset.txt | 507,884 | 512 | schemes - should go to open_url
workspace.update_in(cx, |workspace, window, cx| {
workspace.open_url_or_file("mailto:test@example.com", None, window, cx);
});
assert_eq!(cx.opened_url(), Some("mailto:test@example.com".to_string()));
// Test opening a path that doesn't exist... |
rust_dataset_chunk_507885 | rust_dataset.txt | 507,885 | 512 | ::<TestPanel>(window, cx);
});
workspace.read_with(cx, |workspace, cx| {
assert_eq!(
workspace
.bottom_dock()
.read(cx)
.active_panel()
.map(|panel| panel.panel_id()),
Some(first_p... |
rust_dataset_chunk_507886 | rust_dataset.txt | 507,886 | 512 | ::test]
async fn test_stale_serialized_dock_state_discarded_when_panel_loading_finishes(
cx: &mut gpui::TestAppContext,
) {
init_test(cx);
let fs = FakeFs::new(cx.executor());
let project = Project::test(fs, [], cx).await;
let (workspace, cx) =
cx.add_window_v... |
rust_dataset_chunk_507887 | rust_dataset.txt | 507,887 | 512 | cx,
);
});
});
workspace.read_with(cx, |workspace, cx| {
let dock = workspace.bottom_dock().read(cx);
assert!(
!dock.is_open(),
"dock must not open for a panel that can no longer register",
... |
rust_dataset_chunk_507888 | rust_dataset.txt | 507,888 | 512 | .clone(), window, cx);
panel
});
workspace.read_with(cx, |workspace, cx| {
let dock = workspace.bottom_dock().read(cx);
assert!(dock.is_open());
assert_eq!(
dock.active_panel().map(|panel| panel.panel_id()),
Some(second_pane... |
rust_dataset_chunk_507889 | rust_dataset.txt | 507,889 | 512 | cx.run_until_parked();
workspace.update_in(cx, |workspace, window, cx| {
let dock = workspace.bottom_dock().read(cx);
assert!(dock.is_open());
assert_eq!(
dock.active_panel().map(|panel| panel.panel_id()),
Some(sibling_panel.entity_id()),
... |
rust_dataset_chunk_507890 | rust_dataset.txt | 507,890 | 512 | _: &App) -> Pixels {
px(300.)
}
fn icon(&self, _: &Window, _: &App) -> Option<ui::IconName> {
Some(ui::IconName::Terminal)
}
fn icon_tooltip(&self, _: &Window, _: &App) -> Option<&'static str> {
Some("Second Test Panel")
}
fn toggle... |
rust_dataset_chunk_507891 | rust_dataset.txt | 507,891 | 512 | _with_no_tabs: settings::CloseWindowWhenNoItems,
pub on_new_window: settings::OnNewWindow,
pub on_last_window_closed: settings::OnLastWindowClosed,
pub text_rendering_mode: settings::TextRenderingMode,
pub use_display_p3: bool,
pub resize_all_panels_in_dock: Vec<DockPosition>,
pub close_on_file_... |
rust_dataset_chunk_507892 | rust_dataset.txt | 507,892 | 512 | _separate_row: bool,
}
impl Settings for WorkspaceSettings {
fn from_settings(content: &settings::SettingsContent) -> Self {
let workspace = &content.workspace;
Self {
active_pane_modifiers: ActivePanelModifiers {
border_size: Some(
*workspace
... |
rust_dataset_chunk_507893 | rust_dataset.txt | 507,893 | 512 | screen_mode.unwrap(),
zoomed_padding: workspace.zoomed_padding.unwrap(),
window_decorations: workspace.window_decorations.unwrap(),
focus_follows_mouse: FocusFollowsMouse {
enabled: workspace
.focus_follows_mouse
.unwrap()
... |
rust_dataset_chunk_507894 | rust_dataset.txt | 507,894 | 512 | ings_button: bool,
pub active_encoding_button: EncodingDisplayOptions,
pub pending_keystrokes_indicator: bool,
}
impl Settings for StatusBarSettings {
fn from_settings(content: &settings::SettingsContent) -> Self {
let status_bar = content.status_bar.clone().unwrap();
StatusBarSettings {
... |
rust_dataset_chunk_507895 | rust_dataset.txt | 507,895 | 512 | ed/crates/worktree/src/ignore.rs ---
use ignore::gitignore::Gitignore;
use std::{ffi::OsStr, path::Path, sync::Arc};
#[derive(Clone, Debug)]
pub struct IgnoreStack {
pub repo_root: Option<Arc<Path>>,
/// The repository root, or the worktree root when no repository contains
/// the worktree.
/// Global ... |
rust_dataset_chunk_507896 | rust_dataset.txt | 507,896 | 512 | , is_dir: bool) -> bool {
if is_dir && abs_path.file_name() == Some(OsStr::new(".git")) {
return true;
}
match self.top.as_ref() {
IgnoreStackEntry::None => false,
IgnoreStackEntry::All => true,
IgnoreStackEntry::Global { ignore } => {
... |
rust_dataset_chunk_507897 | rust_dataset.txt | 507,897 | 512 | }
}
}
--- FILE: zed/crates/worktree/src/worktree.rs ---
mod ignore;
mod worktree_settings;
use ::ignore::gitignore::{Gitignore, GitignoreBuilder};
use anyhow::{Context as _, Result, anyhow};
use clock::ReplicaId;
use collections::{BTreeMap, HashMap, HashSet, VecDeque};
use encoding_rs::Encoding;
use file_conten... |
rust_dataset_chunk_507898 | rust_dataset.txt | 507,898 | 512 | , Range},
path::{Path, PathBuf},
pin::Pin,
sync::{
Arc,
atomic::{AtomicUsize, Ordering::SeqCst},
},
time::{Duration, Instant},
};
use sum_tree::{Bias, Dimensions, Edit, KeyedItem, SeekTarget, SumTree, Summary, TreeMap, TreeSet};
use text::{LineEnding, Rope};
use util::{
ResultExt... |
rust_dataset_chunk_507899 | rust_dataset.txt | 507,899 | 512 | ,
pub is_writable: bool,
}
pub struct LoadedBinaryFile {
pub file: Arc<File>,
pub content: Vec<u8>,
}
impl fmt::Debug for LoadedBinaryFile {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("LoadedBinaryFile")
.field("file", &self.file)
.field("... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.