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_507700
rust_dataset.txt
507,700
512
None; cx.emit(Event::ZoomChanged); } if let Some(maximized) = self.maximized_pane.take() { if maximized.upgrade().as_ref() == Some(&self.active_pane) { cx.notify(); return; } } self.maximized_pane = Some(self.active_p...
rust_dataset_chunk_507701
rust_dataset.txt
507,701
512
(dock_is_open, |this| { this.role(gpui::Role::Complementary) .aria_label(dock_label) .when(a11y_active, |this| { this.track_focus(self.region_focus_handles.dock(position)) }) }) .flex() ...
rust_dataset_chunk_507702
rust_dataset.txt
507,702
512
the currently-visible major window regions ("parts"), in a stable /// cyclic order: title bar, left dock, editor, right dock, bottom dock, /// status bar. Closed docks are skipped. Used by /// [`FocusNextPart`]/[`FocusPreviousPart`] so keyboard and screen-reader /// users can move between regions witho...
rust_dataset_chunk_507703
rust_dataset.txt
507,703
512
toolbar( self.status_bar.read(cx).focus_handle(cx), )); parts } /// Moves focus to the next (or previous) visible window region. See /// [`FocusNextPart`]. fn move_part_focus(&mut self, forward: bool, window: &mut Window, cx: &mut Context<Self>) { let parts = self.fo...
rust_dataset_chunk_507704
rust_dataset.txt
507,704
512
move_titlebar_item_focus( &mut self, forward: bool, window: &mut Window, cx: &mut Context<Self>, ) { let previous = window.focused(cx); if forward { window.focus_next(cx); } else { window.focus_prev(cx); } let landed_in...
rust_dataset_chunk_507705
rust_dataset.txt
507,705
512
let Some(current_window_id) = cx.active_window().map(|a| a.window_id()) else { return; }; let windows = cx.windows(); let next_window = SystemWindowTabController::get_next_tab_group_window(cx, current_window_id).or_else( || { windows ...
rust_dataset_chunk_507706
rust_dataset.txt
507,706
512
mut size = new_size.min(workspace_width - RESIZE_HANDLE_SIZE); self.right_dock.read_with(cx, |right_dock, cx| { let right_dock_size = right_dock .stored_active_panel_size(window, cx) .unwrap_or(Pixels::ZERO); if right_dock_size + size > workspace_width {...
rust_dataset_chunk_507707
rust_dataset.txt
507,707
512
_| { file.project.all_languages.defaults.show_edit_predictions = Some(!show_edit_predictions) }); } fn toggle_theme_mode(&mut self, _: &ToggleMode, _window: &mut Window, cx: &mut Context<Self>) { let current_mode = ThemeSettings::get_global(cx).theme.mode(); let next_mode =...
rust_dataset_chunk_507708
rust_dataset.txt
507,708
512
_identity)) = self.restricted_worktree_paths(cx) else { return Task::ready(()); }; let db = WorkspaceDb::global(cx); cx.spawn_in(window, async move |workspace, cx| { let source_has_undecided_worktrees = db .has_undecided_restricted_worktrees(sourc...
rust_dataset_chunk_507709
rust_dataset.txt
507,709
512
workspace, window, cx| { if workspace.active_modal::<SecurityModal>(cx).is_none() { workspace.open_worktree_trust_security_modal(window, cx); } }) .ok(); } })); } fn open_work...
rust_dataset_chunk_507710
rust_dataset.txt
507,710
512
>, _: &mut App) -> Result<()>; fn remote_participant_for_peer_id(&self, _: PeerId, _: &App) -> Option<RemoteCollaborator>; fn is_sharing_project(&self, _: &App) -> bool; fn is_sharing_screen(&self, _: &App) -> bool; fn has_remote_participants(&self, _: &App) -> bool; fn local_participant_is_guest(&s...
rust_dataset_chunk_507711
rust_dataset.txt
507,711
512
64 }, UnsharedProject, External, } impl ParticipantLocation { pub fn from_proto(location: Option<proto::ParticipantLocation>) -> Result<Self> { match location .and_then(|l| l.variant) .context("participant location was not provided")? { proto::participant...
rust_dataset_chunk_507712
rust_dataset.txt
507,712
512
_env_override() -> Option<Bounds<Pixels>> { ZED_WINDOW_POSITION .zip(*ZED_WINDOW_SIZE) .map(|(position, size)| Bounds { origin: position, size, }) } struct StopRestoringOnDrop { restoring_workspace: Rc<Cell<bool>>, restoring_from: Rc<RefCell<Option<Serialized...
rust_dataset_chunk_507713
rust_dataset.txt
507,713
512
_path && restored_project_paths.contains(project_path_to_open) { *project_path = None; } }); } else { for _ in 0..project_paths_to_open.len() { opened_items.push(None); ...
rust_dataset_chunk_507714
rust_dataset.txt
507,714
512
Behavior { /// An ARIA toolbar (title bar, status bar). Region navigation focuses the /// container and descends to its first control, which is usable for /// everyone, so this is not gated on assistive technology. Toolbar, /// A landmark region (a dock or the editor). The wrapper carries the //...
rust_dataset_chunk_507715
rust_dataset.txt
507,715
512
) -> Self { Self { left_dock: cx.focus_handle(), right_dock: cx.focus_handle(), bottom_dock: cx.focus_handle(), editor: cx.focus_handle(), } } fn dock(&self, position: DockPosition) -> &FocusHandle { match position { DockPositi...
rust_dataset_chunk_507716
rust_dataset.txt
507,716
512
workspace: &mut Workspace, window: &mut Window, cx: &mut Context<Workspace>, ) { let docks = workspace .all_docks() .into_iter() .filter_map(|dock_entity| { let dock = dock_entity.read(cx); if dock.is_open() { let dock_pos = dock.position()...
rust_dataset_chunk_507717
rust_dataset.txt
507,717
512
(Self::adjust_padding( settings.right_padding.map(|padding| padding.0), )), ) }; let centered_paddings = render_centered_paddings(pad_center_pane); let zoomed_paddings = render_centered_paddings(pad_zoomed_pane); let ui_font = theme_setting...
rust_dataset_chunk_507718
rust_dataset.txt
507,718
512
_item_focus(false, window, cx); cx.stop_propagation(); } _ => {} } }, )) .w_full() ...
rust_dataset_chunk_507719
rust_dataset.txt
507,719
512
.x, window, cx, ); } DockPosition::Bottom => { ...
rust_dataset_chunk_507720
rust_dataset.txt
507,720
512
, |this, p| { this.child( p.border_r_1(), ...
rust_dataset_chunk_507721
rust_dataset.txt
507,721
512
, window, cx, )) .child( div() .flex() ...
rust_dataset_chunk_507722
rust_dataset.txt
507,722
512
border_l_1(), Some(DockPosition::Bottom) => overlay.top_2().border_t_1(), None => { overlay.top_2().bottom_2().left_2().right_2().border_1() } ...
rust_dataset_chunk_507723
rust_dataset.txt
507,723
512
() }); Ok(response) }) } async fn handle_update_followers( this: Entity<Self>, envelope: TypedEnvelope<proto::UpdateFollowers>, mut cx: AsyncApp, ) -> Result<()> { let leader_id = envelope.original_sender_id()?; let update = envelope....
rust_dataset_chunk_507724
rust_dataset.txt
507,724
512
{ fn file_project_paths(&self, cx: &App) -> Vec<ProjectPath> { self.read(cx) .worktrees(cx) .flat_map(|worktree| { let worktree_id = worktree.read(cx).id(); worktree.read(cx).files(true, 0).map(move |f| ProjectPath { worktree_id, ...
rust_dataset_chunk_507725
rust_dataset.txt
507,725
512
OpenMode::Activate, cx, ) }) .await { Ok(OpenResult { window, .. }) => { fallback_handle = Some(window); break; } ...
rust_dataset_chunk_507726
rust_dataset.txt
507,726
512
(); for serialized in project_groups.iter().cloned() { let SerializedProjectGroupState { key, expanded } = serialized.into_restored_state(); if key.path_list().paths().is_empty() { continue; } let mut resolved_paths = Vec::new(); for pa...
rust_dataset_chunk_507727
rust_dataset.txt
507,727
512
_display.uuid().ok() == Some(display)) }); if !display_connected { return; } window_handle .update(cx, |_, window, _cx| { window.restore_native_window_state(&native_window_state); }) .log_err(); } actions!( collab, [ /// Opens the channel note...
rust_dataset_chunk_507728
rust_dataset.txt
507,728
512
active_call.has_remote_participants(cx) && !already_in_channel; (should_prompt, already_in_channel) }); if already_in_channel { let task = cx.update(|cx| { if let Some((project, host)) = active_call.most_active_project(cx) { Some(join_in_room_project(pro...
rust_dataset_chunk_507729
rust_dataset.txt
507,729
512
ost_active_project(cx) { return Some(join_in_room_project(project, host, app_state.clone(), cx)); } // If you are the first to join a channel, see if you should share your project. if !active_call.has_remote_participants(cx) && !active_call.local_participant_is_guest(cx)...
rust_dataset_chunk_507730
rust_dataset.txt
507,730
512
erializedItem { kind: Arc::from(handle.serialized_item_kind()), item_id: handle.item_id().as_u64(), active: Some(handle.item_id()) == active_item_id, preview: pane.is_active_preview_item(handle.item_id()), }) }) ...
rust_dataset_chunk_507731
rust_dataset.txt
507,731
512
ErrorCode::UpgradeRequired => concat!( "Your are running an unsupported version of Zed. ", "Please update to continue." ) .into(), ErrorCode::NoSuchChannel => concat!( ...
rust_dataset_chunk_507732
rust_dataset.txt
507,732
512
Visible, } fn matches_remote_location( connection: &RemoteConnectionOptions, requested: &RemoteConnectionOptions, ) -> bool { match (connection, requested) { (RemoteConnectionOptions::Ssh(_), RemoteConnectionOptions::Ssh(_)) => { connection.identity() == requested.identity() } ...
rust_dataset_chunk_507733
rust_dataset.txt
507,733
512
_workspace.workspaces().any(|workspace| { let project = workspace.read(cx).project.read(cx); match (project.remote_connection_options(cx), serialized_location) { (Some(connection), SerializedWorkspaceLocation::Remote(requested)) => { ...
rust_dataset_chunk_507734
rust_dataset.txt
507,734
512
_to_path(url_path, path_style)) } _ => path, } }) .collect() } pub fn find_existing_workspace( abs_paths: &[impl AsRef<Path>], open_options: &OpenOptions, host: &ProjectHost<'_>, cx: &mut AsyncApp, ) -> Option<WorkspaceOpenTarget> { cx.upd...
rust_dataset_chunk_507735
rust_dataset.txt
507,735
512
let paths = paths_for_candidate(abs_paths, host, path_style); !paths.iter().any(|path| { let path = util::paths::SanitizedPath::new(path); project .worktrees(cx) .filter_map(|worktree| { ...
rust_dataset_chunk_507736
rust_dataset.txt
507,736
512
_to_sidebar: true, wait: false, requesting_window: None, open_mode: OpenMode::default(), env: None, open_in_dev_container: false, } } } impl OpenOptions { fn should_reuse_existing_window(&self) -> bool { !matches!( self.wor...
rust_dataset_chunk_507737
rust_dataset.txt
507,737
512
); workspace })?; (window, workspace) } else { let window_bounds_override = window_bounds_env_override(); let (window_bounds, display) = if let Some(bounds) = window_bounds_override { (Some(WindowBounds::Windowed(bounds)), None) ...
rust_dataset_chunk_507738
rust_dataset.txt
507,738
512
<OpenResult>> { let abs_paths = abs_paths.to_vec(); cx.spawn(async move |cx| { let mut reuse_target = find_existing_workspace(&abs_paths, &open_options, &ProjectHost::Local, cx); let mut creation_window = open_options.requesting_window; // Fallback: if no workspace contain...
rust_dataset_chunk_507739
rust_dataset.txt
507,739
512
_sidebar.auto_open { multi_workspace.open_sidebar(cx); } else { // Opening the sidebar is also what pins the // workspace we are about to navigate away from, // so ...
rust_dataset_chunk_507740
rust_dataset.txt
507,740
512
{ result .window .update(cx, |_, window, _cx| { window.activate_window(); }) .log_err(); } result } }) } pub fn open_new( open_options: OpenOptions, app_...
rust_dataset_chunk_507741
rust_dataset.txt
507,741
512
None, window, cx, ) })? .await; let item = items.pop().flatten(); item.with_context(|| format!("path {path:?} i...
rust_dataset_chunk_507742
rust_dataset.txt
507,742
512
.clone(), cx).await?; open_remote_project_inner( project, paths, workspace_id, serialized_workspace, app_state, window, provisional_project_group_key, source_workspace, cx, ) .await }...
rust_dataset_chunk_507743
rust_dataset.txt
507,743
512
|this, cx| { let Some(worktree_id) = this.find_worktree(&worktree_path, cx) .and_then(|(worktree, rel_path)| { if rel_path.is_empty() { Some(worktree.read(cx).id()) } else...
rust_dataset_chunk_507744
rust_dataset.txt
507,744
512
} pub fn join_in_room_project( project_id: u64, follow_user_id: u64, app_state: Arc<AppState>, cx: &mut App, ) -> Task<Result<()>> { let windows = cx.windows(); cx.spawn(async move |cx| { let existing_window_and_workspace: Option<( WindowHandle<MultiWorkspace>, E...
rust_dataset_chunk_507745
rust_dataset.txt
507,745
512
, cx| { let follow_peer_id = GlobalAnyActiveCall::try_global(cx) .and_then(|call| call.0.peer_id_for_user_in_room(follow_user_id, cx)) .or_else(|| { // If we couldn't follow the given user, follow the host instead. l...
rust_dataset_chunk_507746
rust_dataset.txt
507,746
512
window in workspace_windows { match prepare_window_to_close(*window, CloseIntent::Quit, cx).await { Ok(true) => prepared_windows.push(*window), Ok(false) => { cancelled = true; break; } Err(error) => { log::error!( ...
rust_dataset_chunk_507747
rust_dataset.txt
507,747
512
, cx| { if !matches!(prepared, Ok(true)) { for workspace in multi_workspace.workspaces() { workspace.update(cx, |workspace, _| { workspace.removing = false; }); } } multi_workspace.activat...
rust_dataset_chunk_507748
rust_dataset.txt
507,748
512
_decorations( element: impl IntoElement, window: &mut Window, cx: &mut App, ) -> Stateful<Div> { client_side_decorations_with_rounded_corners( element, Corners { top_left: true, top_right: true, bottom_right: true, bottom_left: true, ...
rust_dataset_chunk_507749
rust_dataset.txt
507,749
512
::CLIENT_SIDE_DECORATION_SHADOW) }) .when(!tiling.left, |div| { div.pl(theme::CLIENT_SIDE_DECORATION_SHADOW) }) .when(!tiling.right, |div| { div.pr(theme::CLIENT_SIDE_DECORATION_SHADOW) }) ...
rust_dataset_chunk_507750
rust_dataset.txt
507,750
512
h: 0., s: 0., l: 0., a: 0.4, }, ) .blur_radius(theme::CLIENT_SIDE_DECORATION_SHADOW / 2.), ...
rust_dataset_chunk_507751
rust_dataset.txt
507,751
512
Bounds::new(Point::default(), window_size).inset(shadow_size * 1.5); if bounds.contains(&pos) { return None; } let corner_size = size(shadow_size * 1.5, shadow_size * 1.5); let top_left_bounds = Bounds::new(Point::new(px(0.), px(0.)), corner_size); if !tiling.top && top_left_bounds.contain...
rust_dataset_chunk_507752
rust_dataset.txt
507,752
512
_pane, window, cx); } } fn move_all_items( from_pane: &Entity<Pane>, to_pane: &Entity<Pane>, window: &mut Window, cx: &mut App, ) { let destination_is_different = from_pane != to_pane; let mut moved_items = 0; for (item_ix, item_handle) in from_pane .read(cx) .items() ...
rust_dataset_chunk_507753
rust_dataset.txt
507,753
512
move_active_item( source: &Entity<Pane>, destination: &Entity<Pane>, focus_destination: bool, close_if_empty: bool, window: &mut Window, cx: &mut App, ) { if source == destination { return; } let Some(active_item) = source.read(cx).active_item() else { return; };...
rust_dataset_chunk_507754
rust_dataset.txt
507,754
512
{ let remote_connection_id = db .get_or_create_remote_connection(connection_options) .await .context("fetching serialized ssh project")?; let serialized_workspace = db.remote_workspace_for_roots(&paths, remote_connection_id); let (window_bounds, display) = i...
rust_dataset_chunk_507755
rust_dataset.txt
507,755
512
> { #[derive(Deserialize)] struct LegacyPanelState { #[serde(default)] width: Option<Pixels>, #[serde(default)] height: Option<Pixels>, } let workspace_id = workspace .database_id() .map(|id| i64::from(id).to_string()) .or_else(|| workspace.sessio...
rust_dataset_chunk_507756
rust_dataset.txt
507,756
512
WindowTitleContext { project_name: "project".to_string(), file_name: None, file_path: Some("/tmp/project/src/main.rs".to_string()), relative_path: Some("src/main.rs".to_string()), file_stem: Some("main".to_string()), remote_name: Some("nickname".t...
rust_dataset_chunk_507757
rust_dataset.txt
507,757
512
render_window_title_format("${typoName}", " — ", &context), "" ); } #[test] fn test_render_window_title_format_renders_new_variables() { let context = WindowTitleContext { project_name: "project".to_string(), app_name: "Zed", branch: Some("fe...
rust_dataset_chunk_507758
rust_dataset.txt
507,758
512
) = cx.add_window_view(|window, cx| Workspace::test_new(project, window, cx)); let title_bar = cx.new(|cx| TestItem::new(cx)); workspace.update_in(cx, |workspace, window, cx| { workspace.set_titlebar_item(title_bar.clone().into(), window, cx); }); cx.run_until_par...
rust_dataset_chunk_507759
rust_dataset.txt
507,759
512
); assert!(panel.read(cx).focus_handle(cx).contains_focused(window, cx)); }); } #[gpui::test] async fn test_tab_disambiguation(cx: &mut TestAppContext) { init_test(cx); let fs = FakeFs::new(cx.executor()); let project = Project::test(fs, [], cx).awai...
rust_dataset_chunk_507760
rust_dataset.txt
507,760
512
new(item3.clone()), None, true, window, cx); }); item1.read_with(cx, |item, _| assert_eq!(item.tab_detail.get(), Some(1))); item2.read_with(cx, |item, _| assert_eq!(item.tab_detail.get(), Some(3))); item3.read_with(cx, |item, _| assert_eq!(item.tab_detail.get(), Some(3))); } #[g...
rust_dataset_chunk_507761
rust_dataset.txt
507,761
512
window, cx| { workspace.add_item_to_active_pane(Box::new(item2), None, true, window, cx) }); assert_eq!(cx.window_title().as_deref(), Some("root1 — two.txt")); project.update(cx, |project, cx| { assert_eq!( project.active_entry(), project ...
rust_dataset_chunk_507762
rust_dataset.txt
507,762
512
().read(cx).id() }); let item1 = cx.new(|cx| { TestItem::new(cx).with_project_items(&[new_test_project_item( 1, "one.txt", worktree_id, cx, )]) }); let item2 = cx.new(|cx| { TestItem::new...
rust_dataset_chunk_507763
rust_dataset.txt
507,763
512
item = cx.new(|cx| { TestItem::new(cx).with_project_items(&[TestProjectItem::new(1, "src/one.txt", cx)]) }); workspace.update_in(cx, |workspace, window, cx| { workspace.add_item_to_active_pane(Box::new(item), None, true, window, cx) }); assert_eq!(cx.window_titl...
rust_dataset_chunk_507764
rust_dataset.txt
507,764
512
_until_parked(); assert_eq!(cx.window_title().as_deref(), Some("root1")); cx.update(|_, cx| { SettingsStore::update_global(cx, |settings, cx| { settings.update_user_settings(cx, |settings| { settings.workspace.window_title_format = Some("${typoName}".to_s...
rust_dataset_chunk_507765
rust_dataset.txt
507,765
512
Name}${separator}${fileStem}${separator}${filePath}" .to_string(), ); }) }); }); cx.executor().run_until_parked(); assert_eq!(cx.window_title().as_deref(), Some("Zed — root1, root2")); let item = cx.new(|cx| { ...
rust_dataset_chunk_507766
rust_dataset.txt
507,766
512
(project.clone(), window, cx)); cx.update(|_, cx| { SettingsStore::update_global(cx, |settings, cx| { settings.update_user_settings(cx, |settings| { settings.workspace.window_title_format = Some( "${projectName}${separator}${branch}${separ...
rust_dataset_chunk_507767
rust_dataset.txt
507,767
512
let item = cx.new(|cx| { TestItem::new(cx).with_project_items(&[TestProjectItem::new(1, "src/one.txt", cx)]) }); workspace.update_in(cx, |workspace, window, cx| { workspace.add_item_to_active_pane(Box::new(item), None, true, window, cx) }); cx.update(|_,...
rust_dataset_chunk_507768
rust_dataset.txt
507,768
512
cx); w.add_item_to_active_pane(Box::new(item3.clone()), None, true, window, cx); }); let task = workspace.update_in(cx, |w, window, cx| { w.prepare_to_close(CloseIntent::CloseWindow, window, cx) }); cx.executor().run_until_parked(); cx.simulate_prompt_ans...
rust_dataset_chunk_507769
rust_dataset.txt
507,769
512
window, cx| { w.add_item_to_active_pane(Box::new(item_b.clone()), None, true, window, cx) }); // Verify workspace A is active multi_workspace_handle .read_with(cx, |mw, _| { assert_eq!(mw.workspace(), &workspace_a); }) .unwrap(); ...
rust_dataset_chunk_507770
rust_dataset.txt
507,770
512
multi_workspace_handle .update(cx, |mw, window, cx| { mw.activate(workspace_a.clone(), None, window, cx); }) .unwrap(); let cx = &mut VisualTestContext::from_window(multi_workspace_handle.into(), cx); // Workspace B has a dirty item. ...
rust_dataset_chunk_507771
rust_dataset.txt
507,771
512
"removal should have succeeded"); // Should be back on workspace A, and B should be gone. multi_workspace_handle .read_with(cx, |mw, _cx| { assert_eq!( mw.workspace(), &workspace_a, "should be back on workspace A a...
rust_dataset_chunk_507772
rust_dataset.txt
507,772
512
`Quit`), // so hot-exit is safe there. #[cfg(target_os = "macos")] #[gpui::test] async fn test_close_window_without_worktrees_prompts(cx: &mut TestAppContext) { init_test(cx); cx.update(|cx| { register_serializable_item::<TestItem>(cx); }); let fs = FakeFs:...
rust_dataset_chunk_507773
rust_dataset.txt
507,773
512
_item_to_active_pane(Box::new(item.clone()), None, true, window, cx); }); multi_workspace.update_in(cx, |mw, window, cx| { mw.close_window(&CloseWindow, window, cx); }); cx.executor().run_until_parked(); assert!(cx.has_pending_prompt()); cx.simulate_prompt_a...
rust_dataset_chunk_507774
rust_dataset.txt
507,774
512
= Project::test(fs, None, cx).await; let (workspace, cx) = cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx)); let item = cx.new(|cx| { TestItem::new(cx) .with_dirty(true) .with_serialize(|| Some(Task::ready(Ok(()))...
rust_dataset_chunk_507775
rust_dataset.txt
507,775
512
.await.unwrap()); } #[gpui::test] async fn test_replace_window_with_worktrees_hot_exits(cx: &mut TestAppContext) { init_test(cx); cx.update(|cx| { register_serializable_item::<TestItem>(cx); }); let fs = FakeFs::new(cx.executor()); fs.insert_tree("/root...
rust_dataset_chunk_507776
rust_dataset.txt
507,776
512
, window, cx| { w.prepare_to_close(CloseIntent::CloseWindow, window, cx) }); cx.executor().run_until_parked(); // The failing serialization must not short-circuit the close; a // save/discard prompt must be shown for the dirty scratch item. assert!( cx.ha...
rust_dataset_chunk_507777
rust_dataset.txt
507,777
512
new(item3.clone()), None, true, window, cx); workspace.add_item_to_active_pane(Box::new(item4.clone()), None, true, window, cx); workspace.active_pane().clone() }); let close_items = pane.update_in(cx, |pane, window, cx| { pane.activate_item(1, true, true, window, cx...
rust_dataset_chunk_507778
rust_dataset.txt
507,778
512
_eq!(item4.read(cx).save_count, 1); assert_eq!(item4.read(cx).save_as_count, 1); assert_eq!(item4.read(cx).reload_count, 0); assert_eq!(pane.items_len(), 1); assert_eq!(pane.active_item().unwrap().item_id(), item2.item_id()); }); } #[gpui::test] async...
rust_dataset_chunk_507779
rust_dataset.txt
507,779
512
1 // multi-entry items: (3, 4) let (left_pane, right_pane) = workspace.update_in(cx, |workspace, window, cx| { let left_pane = workspace.active_pane().clone(); workspace.add_item_to_active_pane(Box::new(item_2_3.clone()), None, true, window, cx); workspace.add_...
rust_dataset_chunk_507780
rust_dataset.txt
507,780
512
still close since their entries exist in left pane. cx.simulate_prompt_answer("Cancel"); close.await; right_pane.read_with(cx, |pane, _| { assert_eq!(pane.items_len(), 1); }); // Remove item 3 from left pane, making (2,3) the only item with entry 3. left_pa...
rust_dataset_chunk_507781
rust_dataset.txt
507,781
512
None, true, window, cx); }); // Autosave on window change. item.update(cx, |item, cx| { SettingsStore::update_global(cx, |settings, cx| { settings.update_user_settings(cx, |settings| { settings.workspace.autosave = Some(AutosaveSetting::OnWindowC...
rust_dataset_chunk_507782
rust_dataset.txt
507,782
512
still dirty and unsaved. cx.executor().advance_clock(Duration::from_millis(250)); item.read_with(cx, |item, _| assert_eq!(item.save_count, 3)); // After delay expires, the file is saved. cx.executor().advance_clock(Duration::from_millis(250)); item.read_with(cx, |item, _| asser...
rust_dataset_chunk_507783
rust_dataset.txt
507,783
512
); } }); pane.update_in(cx, |pane, window, cx| { pane.close_items(window, cx, SaveIntent::Close, &move |id| id == item_id) }) .await .unwrap(); assert!(!cx.has_pending_prompt()); item.read_with(cx, |item, _| assert_eq!(item.save_count, 6))...
rust_dataset_chunk_507784
rust_dataset.txt
507,784
512
()), None, true, window, cx); }); // Set autosave to OnFocusChange and focus the first child handle, // simulating the user's cursor being inside one of the multibuffer's excerpts. item.update_in(cx, |item, window, cx| { SettingsStore::update_global(cx, |settings, cx| { ...
rust_dataset_chunk_507785
rust_dataset.txt
507,785
512
.child_focus_handles[0], cx); }); cx.executor().run_until_parked(); item.read_with(cx, |item, _| assert_eq!(item.save_count, 1)); cx.deactivate_window(); item.read_with(cx, |item, _| { assert_eq!( item.save_count, 2, "Deactivating wind...
rust_dataset_chunk_507786
rust_dataset.txt
507,786
512
}); cx.executor().run_until_parked(); item.read_with(cx, |item, _| { assert_eq!( item.save_count, 0, "Returning focus to the same item should skip deferred save" ); }); // Open modal again with a dirty item. item.up...
rust_dataset_chunk_507787
rust_dataset.txt
507,787
512
(cx, |pane, window, cx| { pane.activate_item(0, true, true, window, cx); }); cx.executor().run_until_parked(); // Set up OnFocusChange autosave and make item1 dirty. item1.update(cx, |item, cx| { SettingsStore::update_global(cx, |settings, cx| { s...
rust_dataset_chunk_507788
rust_dataset.txt
507,788
512
assert!(!pane.can_navigate_forward()); }); item.update_in(cx, |item, _, cx| { item.set_state("one".to_string(), cx); }); // Toolbar must be notified to re-render the navigation buttons assert_eq!(*toolbar_notify_count.borrow(), 1); pane.read_wit...
rust_dataset_chunk_507789
rust_dataset.txt
507,789
512
"b.txt", cx)]) }); let item_c = cx.new(|cx| { TestItem::new(cx).with_project_items(&[TestProjectItem::new(3, "c.txt", cx)]) }); let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone()); workspace.update_in(cx, |workspace, window, cx| { ...
rust_dataset_chunk_507790
rust_dataset.txt
507,790
512
update_in(cx, |workspace, window, cx| { workspace.go_back(pane.downgrade(), window, cx) }) .await .unwrap(); let active_item = workspace.read_with(cx, |workspace, cx| { workspace.active_item(cx).unwrap().item_id() }); assert_eq!( ...
rust_dataset_chunk_507791
rust_dataset.txt
507,791
512
] async fn test_activate_last_pane(cx: &mut gpui::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)...
rust_dataset_chunk_507792
rust_dataset.txt
507,792
512
| MultiWorkspace::test_new(project, window, cx)); let workspace = multi_workspace.read_with(cx, |mw, _| mw.workspace().clone()); // A horizontal split of three panes whose last child is itself a vertical // split, so equalizing has to recurse into the nested axis. workspace.update_in(cx...
rust_dataset_chunk_507793
rust_dataset.txt
507,793
512
Context) { init_test(cx); let fs = FakeFs::new(cx.executor()); let project = Project::test(fs, [], cx).await; let (workspace, cx) = cx.add_window_view(|window, cx| Workspace::test_new(project, window, cx)); let panel = workspace.update_in(cx, |workspace, window, cx|...
rust_dataset_chunk_507794
rust_dataset.txt
507,794
512
(!panel.read(cx).focus_handle(cx).contains_focused(window, cx)); assert!(pane.read(cx).focus_handle(cx).contains_focused(window, cx)); }); // Open the dock workspace.update_in(cx, |workspace, window, cx| { workspace.toggle_dock(DockPosition::Right, window, cx); }...
rust_dataset_chunk_507795
rust_dataset.txt
507,795
512
_zoomed(window, cx)); assert!(workspace.zoomed.is_none()); assert!(!panel.read(cx).focus_handle(cx).contains_focused(window, cx)); }); // Opening the dock, when it's zoomed, retains focus workspace.update_in(cx, |workspace, window, cx| { workspace.toggle_dock...
rust_dataset_chunk_507796
rust_dataset.txt
507,796
512
}); cx.run_until_parked(); workspace.update_in(cx, |workspace, window, cx| { workspace.toggle_panel_focus::<TestPanel>(window, cx); }); let activation_focus_handle = workspace.update_in(cx, |_workspace, window, cx| { let activation_focus_handle = panel ...
rust_dataset_chunk_507797
rust_dataset.txt
507,797
512
, cx); }); workspace.update_in(cx, |workspace, window, cx| { assert!( workspace.right_dock().read(cx).is_open(), "Dock should be open after toggling from center" ); assert!( panel.read(cx).focus_handle(cx).contains_focu...
rust_dataset_chunk_507798
rust_dataset.txt
507,798
512
, |settings| { settings.workspace.close_panel_on_toggle = Some(false); }); }); workspace.update_in(cx, |workspace, window, cx| { workspace.toggle_panel_focus::<TestPanel>(window, cx); }); workspace.update_in(cx, |workspace, window, cx| { ...
rust_dataset_chunk_507799
rust_dataset.txt
507,799
512
should focus the pane" ); }); // Zoom In again is a no-op pane.update_in(cx, |pane, window, cx| { pane.zoom_in(&crate::ZoomIn, window, cx); }); workspace.update_in(cx, |workspace, window, cx| { assert!(pane.read(cx).is_zoomed(), "Second Zoom...