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_507300 | rust_dataset.txt | 507,300 | 512 | let fs = FakeFs::new(cx.executor());
fs.insert_tree(util::path!("/root"), serde_json::json!({ "file.bin": "" }))
.await;
let project = Project::test(fs, [util::path!("/root").as_ref()], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(... |
rust_dataset_chunk_507301 | rust_dataset.txt | 507,301 | 512 | ().map(|item| item.item_id()).collect::<Vec<_>>(),
vec![expected_item_id],
);
assert_eq!(
pane.active_item().unwrap().project_path(cx),
Some(project_path)
);
});
}
}
#[gpui::test]
... |
rust_dataset_chunk_507302 | rust_dataset.txt | 507,302 | 512 | ).unwrap())
.into_iter()
.collect::<HashSet<_>>();
pane.remove_navigation_history_paths(&paths, cx);
{
let state = pane.nav_history.0.lock();
for stack in [
&state.backward_stack,
&state.forwa... |
rust_dataset_chunk_507303 | rust_dataset.txt | 507,303 | 512 | D3^", "D4^", "D5^", "D6*^"],
cx,
);
set_max_tabs(cx, None);
for i in 0..7 {
add_labeled_item(&pane, format!("N{}", i).as_str(), false, cx);
}
// No cap when max tabs is None.
assert_item_labels(
&pane,
[
"D0... |
rust_dataset_chunk_507304 | rust_dataset.txt | 507,304 | 512 | _d.item_id()).unwrap();
pane.pin_tab_at(ix, window, cx);
});
assert_item_labels(&pane, ["C!", "D!", "E", "Settings*"], cx);
set_max_tabs(cx, Some(2));
assert_item_labels(&pane, ["C!", "D!", "Settings*"], cx);
}
#[gpui::test]
async fn test_allow_pinning_dirty_ite... |
rust_dataset_chunk_507305 | rust_dataset.txt | 507,305 | 512 | = Project::test(fs, None, cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
set_max_tabs(cx, Some(3));
let item_a = add_lab... |
rust_dataset_chunk_507306 | rust_dataset.txt | 507,306 | 512 | let item_b = add_labeled_item(&pane, "B", false, cx);
assert_item_labels(&pane, ["A", "B*"], cx);
let item_c = add_labeled_item(&pane, "C", false, cx);
assert_item_labels(&pane, ["A", "B", "C*"], cx);
pane.update_in(cx, |pane, window, cx| {
let ix = pane.index_for_item_id(... |
rust_dataset_chunk_507307 | rust_dataset.txt | 507,307 | 512 | .item_id()).unwrap();
pane.pin_tab_at(ix, window, cx);
});
assert_item_labels(&pane, ["C*!", "A", "B"], cx);
pane.update_in(cx, |pane, window, cx| {
let ix = pane.index_for_item_id(item_b.item_id()).unwrap();
pane.pin_tab_at(ix, window, cx);
});
... |
rust_dataset_chunk_507308 | rust_dataset.txt | 507,308 | 512 | add_labeled_item(&pane, "G", false, cx);
assert_item_labels(&pane, ["A!", "B!", "G*"], cx);
add_labeled_item(&pane, "H", false, cx);
assert_item_labels(&pane, ["A!", "B!", "H*"], cx);
}
#[gpui::test]
async fn test_always_allows_one_unpinned_item_over_max_tabs_regardless_of_pinned_... |
rust_dataset_chunk_507309 | rust_dataset.txt | 507,309 | 512 | cx);
add_labeled_item(&pane, "E", false, cx);
assert_item_labels(&pane, ["A!", "B!", "C!", "D!", "E*"], cx);
add_labeled_item(&pane, "F", false, cx);
assert_item_labels(&pane, ["A!", "B!", "C!", "D!", "F*"], cx);
}
#[gpui::test]
async fn test_can_open_one_item_when_all_ta... |
rust_dataset_chunk_507310 | rust_dataset.txt | 507,310 | 512 | test(fs, None, cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
set_labeled_items(&pane, ["A", "B*", "C"], cx);
assert_item_... |
rust_dataset_chunk_507311 | rust_dataset.txt | 507,311 | 512 | let ix = pane.index_for_item_id(item_a.item_id()).unwrap();
pane.pin_tab_at(ix, window, cx);
let ix = pane.index_for_item_id(item_b.item_id()).unwrap();
pane.pin_tab_at(ix, window, cx);
});
assert_item_labels(&pane, ["A!", "B!", "C*"], cx);
pane.update_in(c... |
rust_dataset_chunk_507312 | rust_dataset.txt | 507,312 | 512 | pane, "C", false, cx);
// Pin one tab
pane.update_in(cx, |pane, window, cx| {
let ix = pane.index_for_item_id(item_a.item_id()).unwrap();
pane.pin_tab_at(ix, window, cx);
});
assert_item_labels(&pane, ["A!", "B", "C*"], cx);
// Verify setting is disabled... |
rust_dataset_chunk_507313 | rust_dataset.txt | 507,313 | 512 | setting is enabled and both tab types exist"
);
}
#[gpui::test]
async fn test_separate_pinned_row_single_row_when_only_pinned_tabs(cx: &mut TestAppContext) {
init_test(cx);
let fs = FakeFs::new(cx.executor());
let project = Project::test(fs, None, cx).await;
let (w... |
rust_dataset_chunk_507314 | rust_dataset.txt | 507,314 | 512 | , cx);
add_labeled_item(&pane, "C", false, cx);
assert_item_labels(&pane, ["A", "B", "C*"], cx);
// Verify pinned_tabs_row does NOT exist (single row layout for unpinned-only)
let pinned_row_bounds = cx.debug_bounds("pinned_tabs_row");
assert!(
pinned_row_bounds.is_n... |
rust_dataset_chunk_507315 | rust_dataset.txt | 507,315 | 512 | (cx.executor());
let project = Project::test(fs, None, cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
// Enable separate ... |
rust_dataset_chunk_507316 | rust_dataset.txt | 507,316 | 512 | _labels(&pane, ["A", "B*"], cx);
// Activate A again
pane.update_in(cx, |pane, window, cx| {
let ix = pane.index_for_item_id(item_a.item_id()).unwrap();
pane.activate_item(ix, true, true, window, cx);
});
assert_item_labels(&pane, ["A*", "B"], cx);
// Pi... |
rust_dataset_chunk_507317 | rust_dataset.txt | 507,317 | 512 | pane.index_for_item_id(item_c.item_id()).unwrap();
pane.unpin_tab_at(ix, window, cx);
});
assert_item_labels(&pane, ["C*", "A", "B"], cx);
}
#[gpui::test]
async fn test_pinning_inactive_tab_without_position_change_preserves_existing_focus(
cx: &mut TestAppContext,
)... |
rust_dataset_chunk_507318 | rust_dataset.txt | 507,318 | 512 | _labeled_item(&pane, "B", false, cx);
let item_c = add_labeled_item(&pane, "C", false, cx);
assert_item_labels(&pane, ["A", "B", "C*"], cx);
// Activate B
pane.update_in(cx, |pane, window, cx| {
let ix = pane.index_for_item_id(item_b.item_id()).unwrap();
pane.act... |
rust_dataset_chunk_507319 | rust_dataset.txt | 507,319 | 512 | _item.clone(), true, true, None, window, cx);
custom_item
});
let moved_item_id = item_a.item_id();
let other_item_id = item_b.item_id();
let custom_item_id = custom_item.item_id();
let pane_item_ids = |pane: &Entity<Pane>, cx: &mut VisualTestContext| {
... |
rust_dataset_chunk_507320 | rust_dataset.txt | 507,320 | 512 | , custom_item_id]);
}
#[gpui::test]
async fn test_drag_unpinned_tab_to_split_creates_pane_with_unpinned_tab(
cx: &mut TestAppContext,
) {
init_test(cx);
let fs = FakeFs::new(cx.executor());
let project = Project::test(fs, None, cx).await;
let (workspace, cx) =
... |
rust_dataset_chunk_507321 | rust_dataset.txt | 507,321 | 512 | ::test(fs, None, cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let pane_a = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
// Add A, B. Pin both. Activate A
let item_a = add_label... |
rust_dataset_chunk_507322 | rust_dataset.txt | 507,322 | 512 | | Workspace::test_new(project.clone(), window, cx));
let pane_a = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
// Add A to pane A and pin
let item_a = add_labeled_item(&pane_a, "A", false, cx);
pane_a.update_in(cx, |pane, window, cx| {
let ix = pa... |
rust_dataset_chunk_507323 | rust_dataset.txt | 507,323 | 512 | _labeled_item(&pane_a, "A", false, cx);
pane_a.update_in(cx, |pane, window, cx| {
let ix = pane.index_for_item_id(item_a.item_id()).unwrap();
pane.pin_tab_at(ix, window, cx);
});
assert_item_labels(&pane_a, ["A*!"], cx);
// Create pane B with pinned item B
... |
rust_dataset_chunk_507324 | rust_dataset.txt | 507,324 | 512 | {
let ix = pane.index_for_item_id(item_a.item_id()).unwrap();
pane.pin_tab_at(ix, window, cx);
});
assert_item_labels(&pane_a, ["A*!"], cx);
// Add B to pane B
let pane_b = workspace.update_in(cx, |workspace, window, cx| {
workspace.split_pane(pane_a... |
rust_dataset_chunk_507325 | rust_dataset.txt | 507,325 | 512 | , cx);
});
assert_item_labels(&pane_a, ["A!", "B*!"], cx);
// Add C, D to pane B. Pin both
let pane_b = workspace.update_in(cx, |workspace, window, cx| {
workspace.split_pane(pane_a.clone(), SplitDirection::Right, window, cx)
});
let item_c = add_labeled_item... |
rust_dataset_chunk_507326 | rust_dataset.txt | 507,326 | 512 | cx| Workspace::test_new(project.clone(), window, cx));
let pane_a = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
// Add A to pane A and pin it
let item_a = add_labeled_item(&pane_a, "A", false, cx);
pane_a.update_in(cx, |pane, window, cx| {
let i... |
rust_dataset_chunk_507327 | rust_dataset.txt | 507,327 | 512 | B*!"], cx);
// Drag pinned A right of B in the same pane
pane_a.update_in(cx, |pane, window, cx| {
let dragged_tab = DraggedTab {
pane: pane_a.clone(),
item: item_a.boxed_clone(),
ix: 0,
detail: 0,
is_active: tr... |
rust_dataset_chunk_507328 | rust_dataset.txt | 507,328 | 512 | _pane_becomes_unpinned(
cx: &mut TestAppContext,
) {
init_test(cx);
let fs = FakeFs::new(cx.executor());
let project = Project::test(fs, None, cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
... |
rust_dataset_chunk_507329 | rust_dataset.txt | 507,329 | 512 | _a.update_in(cx, |pane, window, cx| {
let ix = pane.index_for_item_id(item_a.item_id()).unwrap();
pane.pin_tab_at(ix, window, cx);
});
assert_item_labels(&pane_a, ["A!", "B*"], cx);
// Drag pinned B left of A in the same pane
pane_a.update_in(cx, |pane, window, c... |
rust_dataset_chunk_507330 | rust_dataset.txt | 507,330 | 512 | , 1, false, window, cx);
});
// A stays pinned, B and C remain unpinned
assert_item_labels(&pane_a, ["A!", "C*", "B"], cx);
}
#[gpui::test]
async fn test_drag_unpinned_tab_into_existing_panes_pinned_region(cx: &mut TestAppContext) {
init_test(cx);
let fs = FakeFs::n... |
rust_dataset_chunk_507331 | rust_dataset.txt | 507,331 | 512 | let fs = FakeFs::new(cx.executor());
let project = Project::test(fs, None, cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let pane_a = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
... |
rust_dataset_chunk_507332 | rust_dataset.txt | 507,332 | 512 | // Add A, B, C and pin all
let item_a = add_labeled_item(&pane_a, "A", false, cx);
let item_b = add_labeled_item(&pane_a, "B", false, cx);
let item_c = add_labeled_item(&pane_a, "C", false, cx);
assert_item_labels(&pane_a, ["A", "B", "C*"], cx);
pane_a.update_in(cx, |pan... |
rust_dataset_chunk_507333 | rust_dataset.txt | 507,333 | 512 | detail: 0,
is_active: true,
};
pane.handle_tab_drop(&dragged_tab, 1, false, window, cx);
});
// A should be before C and all are pinned
assert_item_labels(&pane_a, ["B!", "A*!", "C!"], cx);
// Move A to left of B
pane_a.up... |
rust_dataset_chunk_507334 | rust_dataset.txt | 507,334 | 512 | _drag_last_tab_to_first_position(cx: &mut TestAppContext) {
init_test(cx);
let fs = FakeFs::new(cx.executor());
let project = Project::test(fs, None, cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
l... |
rust_dataset_chunk_507335 | rust_dataset.txt | 507,335 | 512 | expect("Tab A (index 0) should have debug bounds");
let tab_c_bounds = cx
.debug_bounds("TAB-2")
.expect("Tab C (index 2) should have debug bounds");
cx.simulate_event(MouseDownEvent {
position: tab_a_bounds.center(),
button: MouseButton::Left,
... |
rust_dataset_chunk_507336 | rust_dataset.txt | 507,336 | 512 | cx,
);
pane.pin_tab_at(
pane.index_for_item_id(item_d.item_id()).unwrap(),
window,
cx,
);
});
assert_item_labels(&pane, ["A!", "B!", "C!", "D*!"], cx);
cx.run_until_parked();
let tab_a_bo... |
rust_dataset_chunk_507337 | rust_dataset.txt | 507,337 | 512 | cx);
cx.run_until_parked();
let tab_a_bounds = cx
.debug_bounds("TAB-0")
.expect("Tab A (index 0) should have debug bounds");
let tab_c_bounds = cx
.debug_bounds("TAB-2")
.expect("Tab C (index 2) should have debug bounds");
cx.simulate_e... |
rust_dataset_chunk_507338 | rust_dataset.txt | 507,338 | 512 | );
pane.pin_tab_at(
pane.index_for_item_id(item_b.item_id()).unwrap(),
window,
cx,
);
});
assert_item_labels(&pane, ["A!", "B!", "C", "D", "E", "F*"], cx);
cx.run_until_parked();
let tab_c_bounds = cx
.... |
rust_dataset_chunk_507339 | rust_dataset.txt | 507,339 | 512 | arked();
let tab_a_bounds = cx
.debug_bounds("TAB-0")
.expect("Tab A (index 1) should have debug bounds");
let tab_b_bounds = cx
.debug_bounds("TAB-1")
.expect("Tab B (index 2) should have debug bounds");
cx.simulate_event(MouseDownEvent {
... |
rust_dataset_chunk_507340 | rust_dataset.txt | 507,340 | 512 | new_file_dispatched.clone();
cx.on_action(move |_: &NewFile, _cx| {
new_file_dispatched.set(true);
});
});
set_pinned_tabs_separate_row(cx, true);
let item_a = add_labeled_item(&pane, "A", false, cx);
add_labeled_item(&pane, "B", false, cx);
... |
rust_dataset_chunk_507341 | rust_dataset.txt | 507,341 | 512 | window, cx| {
pane.add_item(
Box::new(cx.new(|cx| TestItem::new(cx).with_label("D"))),
false,
false,
Some(0),
window,
cx,
);
});
assert_item_labels(&pane, ["D*", "A", "B", "C"], cx);
... |
rust_dataset_chunk_507342 | rust_dataset.txt | 507,342 | 512 | false,
false,
None,
window,
cx,
);
});
assert_item_labels(&pane, ["A", "B", "C", "D*"], cx);
}
#[gpui::test]
async fn test_add_item_with_existing_item(cx: &mut TestAppContext) {
init_test(cx);
let f... |
rust_dataset_chunk_507343 | rust_dataset.txt | 507,343 | 512 | window, cx| {
pane.add_item(b, false, false, Some(1), window, cx);
});
assert_item_labels(&pane, ["A", "B*", "C"], cx);
// 1e. Add item to index after same item in last position
let [_, _, c] = set_labeled_items(&pane, ["A", "B*", "C"], cx);
pane.update_in(cx, |pa... |
rust_dataset_chunk_507344 | rust_dataset.txt | 507,344 | 512 | {
pane.add_item(a, false, false, None, window, cx);
});
assert_item_labels(&pane, ["A*", "B", "C"], cx);
}
#[gpui::test]
async fn test_move_item(cx: &mut TestAppContext) {
init_test(cx);
let fs = FakeFs::new(cx.executor());
let project = Project::test(f... |
rust_dataset_chunk_507345 | rust_dataset.txt | 507,345 | 512 | cx)
});
let item_a = pane1.update_in(cx, |pane, window, cx| {
let item = Box::new(cx.new(|cx| {
TestItem::new(cx)
.with_buffer_kind(ItemBufferKind::Singleton)
.with_label("a")
.with_project_items(&[TestProjectItem:... |
rust_dataset_chunk_507346 | rust_dataset.txt | 507,346 | 512 | _test(cx);
let fs = FakeFs::new(cx.executor());
let project = Project::test(fs, None, cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane()... |
rust_dataset_chunk_507347 | rust_dataset.txt | 507,347 | 512 | with_label("multibuffer 1")
.with_project_items(&[TestProjectItem::new(1, "1.txt", cx)])
})),
false,
false,
None,
window,
cx,
);
});
assert_item_labels(&pane, ["buffer 1", ... |
rust_dataset_chunk_507348 | rust_dataset.txt | 507,348 | 512 | _item(
&CloseActiveItem {
save_intent: None,
close_pinned: false,
},
window,
cx,
)
})
.await
.unwrap();
assert_item_labels(&pane, ["A", "B*", "C", "D"], cx);
pane.... |
rust_dataset_chunk_507349 | rust_dataset.txt | 507,349 | 512 | cx);
add_labeled_item(&pane, "B", false, cx);
add_labeled_item(&pane, "C", false, cx);
add_labeled_item(&pane, "D", false, cx);
assert_item_labels(&pane, ["A", "B", "C", "D*"], cx);
pane.update_in(cx, |pane, window, cx| {
pane.activate_item(1, false, false, window, ... |
rust_dataset_chunk_507350 | rust_dataset.txt | 507,350 | 512 | _ordering_left_neighbour(cx: &mut TestAppContext) {
init_test(cx);
cx.update_global::<SettingsStore, ()>(|s, cx| {
s.update_user_settings(cx, |s| {
s.tabs.get_or_insert_default().activate_on_close =
Some(ActivateOnClose::LeftNeighbour);
});
... |
rust_dataset_chunk_507351 | rust_dataset.txt | 507,351 | 512 | pane.update_in(cx, |pane, window, cx| {
pane.activate_item(0, false, false, window, cx)
});
assert_item_labels(&pane, ["A*", "B", "C"], cx);
pane.update_in(cx, |pane, window, cx| {
pane.close_active_item(
&CloseActiveItem {
save_inten... |
rust_dataset_chunk_507352 | rust_dataset.txt | 507,352 | 512 | E", false, cx);
assert_item_labels(&pane, ["A!", "B!", "C", "D", "E*"], cx);
pane.update_in(cx, |pane, window, cx| {
pane.close_other_items(
&CloseOtherItems {
save_intent: None,
close_pinned: false,
},
... |
rust_dataset_chunk_507353 | rust_dataset.txt | 507,353 | 512 | | Workspace::test_new(project.clone(), window, cx));
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
add_labeled_item(&pane, "A", false, cx);
add_labeled_item(&pane, "B", false, cx);
let item_c = add_labeled_item(&pane, "C", false, cx);
assert... |
rust_dataset_chunk_507354 | rust_dataset.txt | 507,354 | 512 | assert_item_labels(&pane, ["A^", "C*^"], cx);
}
#[gpui::test]
async fn test_close_items_to_the_left(cx: &mut TestAppContext) {
init_test(cx);
let fs = FakeFs::new(cx.executor());
let project = Project::test(fs, None, cx).await;
let (workspace, cx) =
cx.a... |
rust_dataset_chunk_507355 | rust_dataset.txt | 507,355 | 512 | (|window, cx| Workspace::test_new(project.clone(), window, cx));
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
let item_a = add_labeled_item(&pane, "A", false, cx);
add_labeled_item(&pane, "B", false, cx);
add_labeled_item(&pane, "C", false, cx);
... |
rust_dataset_chunk_507356 | rust_dataset.txt | 507,356 | 512 | },
window,
cx,
)
});
cx.executor().run_until_parked();
cx.simulate_prompt_answer("Save all");
save.await.unwrap();
assert_item_labels(&pane, [], cx);
add_labeled_item(&pane, "A", true, cx);
add_labeled_... |
rust_dataset_chunk_507357 | rust_dataset.txt | 507,357 | 512 | Item::new_dirty(1, "Dirty.txt", cx))
});
add_labeled_item(&pane, "Clean2", false, cx);
assert_item_labels(&pane, ["Clean1", "Dirty^", "Clean2*"], cx);
let close_task = pane.update_in(cx, |pane, window, cx| {
pane.close_all_items(
&CloseAllItems {
... |
rust_dataset_chunk_507358 | rust_dataset.txt | 507,358 | 512 | !item.is_dirty,
"item A should no longer be dirty after reload"
);
});
item_b.read_with(cx, |item, _| {
assert_eq!(item.reload_count, 1, "item B should have been reloaded");
assert!(
!item.is_dirty,
"item B should no lo... |
rust_dataset_chunk_507359 | rust_dataset.txt | 507,359 | 512 | , cx);
item.update(cx, |item, cx| {
item.project_items.push(TestProjectItem::new_untitled(cx));
});
assert_item_labels(&pane, ["untitled*^"], cx);
let close_task = pane.update_in(cx, |pane, window, cx| {
pane.close_item_by_id(item.item_id(), SaveIntent::Save, win... |
rust_dataset_chunk_507360 | rust_dataset.txt | 507,360 | 512 | new(cx.executor());
let project = Project::test(fs, None, cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
let singleton_it... |
rust_dataset_chunk_507361 | rust_dataset.txt | 507,361 | 512 | async fn test_close_multibuffer_items(cx: &mut TestAppContext) {
init_test(cx);
let fs = FakeFs::new(cx.executor());
let project = Project::test(fs, None, cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
... |
rust_dataset_chunk_507362 | rust_dataset.txt | 507,362 | 512 | pane, ["C*"], cx);
add_labeled_item(&pane, "A", true, ItemBufferKind::Singleton, cx).update(cx, |item, cx| {
item.project_items
.push(TestProjectItem::new_dirty(1, "A.txt", cx))
});
add_labeled_item(&pane, "B", true, ItemBufferKind::Multibuffer, cx).update(
... |
rust_dataset_chunk_507363 | rust_dataset.txt | 507,363 | 512 | cx,
)
});
cx.executor().run_until_parked();
cx.simulate_prompt_answer("Discard all");
save.await.unwrap();
assert_item_labels(&pane, ["C", "A*^"], cx);
}
#[gpui::test]
async fn test_close_with_save_intent(cx: &mut TestAppContext) {
init_test(cx)... |
rust_dataset_chunk_507364 | rust_dataset.txt | 507,364 | 512 | _view(|window, cx| Workspace::test_new(project, window, cx));
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
cx.simulate_resize(size(px(300.), px(300.)));
add_labeled_item(&pane, "untitled", false, cx);
add_labeled_item(&pane, "untitled", false, cx)... |
rust_dataset_chunk_507365 | rust_dataset.txt | 507,365 | 512 | 0, window, cx);
pane.pin_tab_at(1, window, cx);
pane.pin_tab_at(2, window, cx);
});
for label in ["D", "E", "F", "G", "H", "I", "J", "K"] {
add_labeled_item(&pane, label, false, cx);
}
assert_item_labels(
&pane,
["A!", "B!", "... |
rust_dataset_chunk_507366 | rust_dataset.txt | 507,366 | 512 | "A", false, cx);
add_labeled_item(&pane, "B", false, cx);
add_labeled_item(&pane, "C", false, cx);
assert_item_labels(&pane, ["A", "B", "C*"], cx);
pane.update_in(cx, |pane, window, cx| {
let ix = pane.index_for_item_id(item_a.item_id()).unwrap();
pane.pin_tab_a... |
rust_dataset_chunk_507367 | rust_dataset.txt | 507,367 | 512 | ).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project, window, cx));
// No non-pinned tabs in same pane, non-pinned tabs in another pane
let pane1 = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
let pane2 = work... |
rust_dataset_chunk_507368 | rust_dataset.txt | 507,368 | 512 | );
add_labeled_item(&pane2, "B", false, cx);
set_labeled_items(&pane2, ["B"], cx);
// Close the active item while the workspace entity is already being
// updated. This used to double-lease the workspace and panic, because
// `close_active_item` synchronously reached back into t... |
rust_dataset_chunk_507369 | rust_dataset.txt | 507,369 | 512 | ,
)
})
.await
.unwrap();
pane.update_in(cx, |pane, window, cx| {
pane.close_clean_items(
&CloseCleanItems {
close_pinned: false,
},
window,
cx,
)
})
.a... |
rust_dataset_chunk_507370 | rust_dataset.txt | 507,370 | 512 | window, cx);
});
assert_item_labels(&pane, ["A", "C*", "B"], cx);
pane.update_in(cx, |pane, window, cx| {
pane.swap_item_left(&Default::default(), window, cx);
});
assert_item_labels(&pane, ["C*", "A", "B"], cx);
pane.update_in(cx, |pane, window, cx| {
... |
rust_dataset_chunk_507371 | rust_dataset.txt | 507,371 | 512 | ) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let pane = workspace.read_with(cx, |workspace, _| workspace.active_pane().clone());
// Add an item as preview
let item = pane.update_in(cx, |pane, window, cx| {
let item = Box::new(cx.... |
rust_dataset_chunk_507372 | rust_dataset.txt | 507,372 | 512 | pane, ["A", "B", "C*"], cx);
pane.update_in(cx, |pane, window, cx| {
pane.activate_next_item(&ActivateNextItem { wrap_around: false }, window, cx);
});
assert_item_labels(&pane, ["A", "B", "C*"], cx);
pane.update_in(cx, |pane, window, cx| {
pane.activate_next_it... |
rust_dataset_chunk_507373 | rust_dataset.txt | 507,373 | 512 | _only.txt", cx)])
});
pane.add_item(Box::new(item.clone()), true, true, None, window, cx);
item
});
for save_intent in [
SaveIntent::Save,
SaveIntent::FormatAndSave,
SaveIntent::SaveWithoutFormat,
] {
workspace
... |
rust_dataset_chunk_507374 | rust_dataset.txt | 507,374 | 512 | COUNT] {
pane.update_in(cx, |pane, window, cx| {
pane.items.clear();
let mut active_item_index = 0;
let mut index = 0;
let items = labels.map(|mut label| {
if label.ends_with('*') {
label = label.trim_end_matches('*');
... |
rust_dataset_chunk_507375 | rust_dataset.txt | 507,375 | 512 | .label
.clone();
if ix == pane.active_item_index {
assert_eq!(ix, expected_active_idx);
}
if item.is_dirty(cx) {
state.push('^');
}
if pane.is_tab_... |
rust_dataset_chunk_507376 | rust_dataset.txt | 507,376 | 512 | pane_labels.len();
let last_as_active = format!("{}*", String::from(pane_labels[num_labels - 1]));
// check labels for all split operations
match operation {
SplitMode::EmptyPane => {
assert_item_labels_active_index(&pane_before, &pane_labels, num_labels - 1, cx);
... |
rust_dataset_chunk_507377 | rust_dataset.txt | 507,377 | 512 | SplitMode::MovePane => {
assert_pane_ids_on_axis(&workspace, expected_ids, expected_axis, cx);
}
}
}
#[test]
fn test_dirty_message_for_escapes_markdown_in_path() {
let project_path = ProjectPath {
worktree_id: WorktreeId::from_usize(0),
... |
rust_dataset_chunk_507378 | rust_dataset.txt | 507,378 | 512 | }
impl Item for TestItemView {
type Event = ();
fn tab_content_text(&self, _detail: usize, _cx: &App) -> SharedString {
"".into()
}
fn for_each_project_item(
&self,
cx: &App,
f: &mut dyn Fn... |
rust_dataset_chunk_507379 | rust_dataset.txt | 507,379 | 512 | next: Option<Arc<RelPath>>,
}
impl Oracle {
fn new() -> Self {
Self {
current: None,
previous: None,
next: None,
}
}
fn apply(&mut self, operation: Operation) {
... |
rust_dataset_chunk_507380 | rust_dataset.txt | 507,380 | 512 | workspace,
pane,
worktree_id,
}
}
async fn apply(&mut self, operation: Operation) {
match operation {
Operation::Open {
path,
allow_preview,
... |
rust_dataset_chunk_507381 | rust_dataset.txt | 507,381 | 512 | !(
&active_path.as_ref().unwrap().path,
expected_active_path,
"active path should match the oracle"
);
}
});
}
}
#[gpui::property_test]
asy... |
rust_dataset_chunk_507382 | rust_dataset.txt | 507,382 | 512 | ..) => entry.is_file(),
OpenTarget::Path(_, is_dir, ..) => !is_dir,
}
}
pub fn is_dir(&self) -> bool {
match self {
OpenTarget::Worktree(_, entry, ..) => entry.is_dir(),
OpenTarget::Path(_, is_dir, ..) => *is_dir,
}
}
pub fn path(&self) -> &... |
rust_dataset_chunk_507383 | rust_dataset.txt | 507,383 | 512 | {
first_unmatched = Some(index + character.len_utf8());
}
balance += 1;
}
')' => {
balance -= 1;
if balance <= 0 {
balance = 0;
first_unmatched = None;
}
... |
rust_dataset_chunk_507384 | rust_dataset.txt | 507,384 | 512 | ],
};
for prefix_str in prefixes_to_strip {
if let Some(stripped) = original_path.path.strip_prefix(prefix_str).ok() {
potential_paths.push(PathWithPosition {
path: stripped.to_owned(),
row: original_path.row,
column: original_path.column,
... |
rust_dataset_chunk_507385 | rust_dataset.txt | 507,385 | 512 | .strip_prefix(&worktree_root)
.unwrap_or(&path_with_position.path)
.to_owned(),
row: path_with_position.row,
column: path_with_position.column,
}
};
let normalized_pat... |
rust_dataset_chunk_507386 | rust_dataset.txt | 507,386 | 512 | _check(&potential_paths, matching, cwd, &worktree_candidates, cx);
let fs = project.read(cx).fs().clone();
cx.background_spawn(async move {
for mut path_to_check in fs_paths_to_check {
if let Some(fs_path_to_check) = fs.canonicalize(&path_to_check.path).await.... |
rust_dataset_chunk_507387 | rust_dataset.txt | 507,387 | 512 | {
if let Some(open_target) = background_resolution_task.await {
return Some(open_target);
}
// An inexact path must not resolve to an unrelated file sharing its trailing components.
if matching == PathMatching::Exact {
return None;
}
let worktre... |
rust_dataset_chunk_507388 | rust_dataset.txt | 507,388 | 512 | ential_paths.iter().flat_map(|path_to_check| {
let mut paths_to_check = Vec::new();
let maybe_path = &path_to_check.path;
if maybe_path.starts_with("~") {
if let Some(home_path) =
maybe_path
.strip_prefix("~")
... |
rust_dataset_chunk_507389 | rust_dataset.txt | 507,389 | 512 | ,
column: path_to_check.column,
})
})?
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_project_paths_to_check_uses_the_project_path_style() {
let unix = PathWithPosition::parse_str("/home/user/notes/spec.md:12");
let windows = PathWithPosition::pars... |
rust_dataset_chunk_507390 | rust_dataset.txt | 507,390 | 512 | session, containing all the info needed
/// to restore it including which window it belonged to (for MultiWorkspace grouping).
#[derive(Debug, PartialEq, Clone)]
pub struct SessionWorkspace {
pub workspace_id: WorkspaceId,
pub location: SerializedWorkspaceLocation,
pub paths: PathList,
pub window_id: O... |
rust_dataset_chunk_507391 | rust_dataset.txt | 507,391 | 512 | (crate) id: WorkspaceId,
pub(crate) location: SerializedWorkspaceLocation,
pub(crate) paths: PathList,
/// The workspace's main worktree paths at the time this workspace was saved.
///
/// These paths are used for grouping, deduping, and display in recent-workspace
/// UIs. They are not authorit... |
rust_dataset_chunk_507392 | rust_dataset.txt | 507,392 | 512 | _index) = DockData::column(statement, next_index)?;
Ok((
DockStructure {
left,
right,
bottom,
},
next_index,
))
}
}
impl Bind for DockStructure {
fn bind(&self, statement: &Statement, start_index: i32) -> Result... |
rust_dataset_chunk_507393 | rust_dataset.txt | 507,393 | 512 | (&mut |pane| {
let replaced_pinned_items = pane
.children
.iter()
.take(pane.pinned_count)
.filter(|item| opened_item_ids.contains(&item.item_id))
.count();
pane.children
.retain(|item| !opened_item_i... |
rust_dataset_chunk_507394 | rust_dataset.txt | 507,394 | 512 | {
if let Some((new_member, active_pane, new_items)) = child
.deserialize(project, workspace_id, workspace.clone(), cx)
.await
{
members.push(new_member);
items.extend(new_items);
... |
rust_dataset_chunk_507395 | rust_dataset.txt | 507,395 | 512 | mut AsyncWindowContext,
) -> Result<Vec<Option<Box<dyn ItemHandle>>>> {
let mut item_tasks = Vec::new();
let mut active_item_index = None;
let mut preview_item_index = None;
for (index, item) in self.children.iter().enumerate() {
let project = project.clone();
... |
rust_dataset_chunk_507396 | rust_dataset.txt | 507,396 | 512 | 64;
pub type ItemId = u64;
#[derive(Debug, PartialEq, Eq, Clone)]
pub struct SerializedItem {
pub kind: Arc<str>,
pub item_id: ItemId,
pub active: bool,
pub preview: bool,
}
impl SerializedItem {
pub fn new(kind: impl AsRef<str>, item_id: ItemId, active: bool, preview: bool) -> Self {
Self... |
rust_dataset_chunk_507397 | rust_dataset.txt | 507,397 | 512 | sqlez::{connection::Connection, domain::Domain},
sqlez_macros::sql,
};
use gpui::{Axis, Bounds, Task, WindowBounds, WindowId, point, size};
use project::{
ProjectGroupKey,
bookmark_store::SerializedBookmark,
debugger::breakpoint_store::{BreakpointState, SourceBreakpoint},
trusted_worktrees::DbTrust... |
rust_dataset_chunk_507398 | rust_dataset.txt | 507,398 | 512 | ::statement::Statement,
start_index: i32,
) -> anyhow::Result<i32> {
match self.0 {
gpui::Axis::Horizontal => "Horizontal",
gpui::Axis::Vertical => "Vertical",
}
.bind(statement, start_index)
}
}
impl sqlez::bindable::Column for SerializedAxis {
fn co... |
rust_dataset_chunk_507399 | rust_dataset.txt | 507,399 | 512 | ) -> Result<(Self, i32)> {
let (window_state, next_index) = String::column(statement, start_index)?;
let ((x, y, width, height), _): ((i32, i32, i32, i32), _) =
Column::column(statement, next_index)?;
let bounds = Bounds {
origin: point(px(x as f32), px(y as f32)),
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.