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_507200 | rust_dataset.txt | 507,200 | 512 | workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test_new(project.clone(), window, cx));
let count_notifications = |workspace: &Entity<Workspace>, cx: &mut TestAppContext| {
workspace.read_with(cx, |workspace, _| workspace.notification_ids().len())
};
let sho... |
rust_dataset_chunk_507201 | rust_dataset.txt | 507,201 | 512 | |workspace, _| workspace.notification_ids().len())
};
workspace.update(cx, |workspace, cx| {
let request = LanguageServerPromptRequest::test(
gpui::PromptLevel::Warning,
"Test notification".to_string(),
vec![], // Empty actions would trigger ... |
rust_dataset_chunk_507202 | rust_dataset.txt | 507,202 | 512 | ()
.advance_clock(Duration::from_millis(custom_duration_ms - 500));
assert_eq!(count_notifications(&workspace, cx), 1);
// Advance time past the custom duration
cx.executor().advance_clock(Duration::from_millis(1000));
assert_eq!(count_notifications(&workspace, cx), 0);
... |
rust_dataset_chunk_507203 | rust_dataset.txt | 507,203 | 512 | actions.clone(), true),
(Vec::new(), true),
(Vec::new(), false),
(actions, true),
] {
let id = emit_language_server_prompt(
&project,
"server",
PromptLevel::Warning,
"same message",
ac... |
rust_dataset_chunk_507204 | rust_dataset.txt | 507,204 | 512 | , |workspace, cx| workspace.clear_all_notifications(cx));
cx.update(|_, cx| {
let mut settings = ProjectSettings::get_global(cx).clone();
settings
.global_lsp_settings
.notifications
.dismiss_timeout_ms = Some(0);
ProjectSetting... |
rust_dataset_chunk_507205 | rust_dataset.txt | 507,205 | 512 | Group {
pub root: Member,
}
pub struct PaneRenderResult {
pub element: gpui::AnyElement,
pub contains_active_pane: bool,
#[cfg(any(test, feature = "test-support"))]
pub decorated_pane_ix: Option<usize>,
}
impl PaneGroup {
pub fn with_root(root: Member) -> Self {
Self { root }
}
... |
rust_dataset_chunk_507206 | rust_dataset.txt | 507,206 | 512 | .
///
/// Returns:
/// - Ok(true) if it found and moved a pane
/// - Ok(false) if it found but did not move the pane
/// - Err(_) if it did not find the pane
pub fn move_to_border(
&mut self,
active_pane: &Entity<Pane>,
direction: SplitDirection,
) -> Result<bool> {
... |
rust_dataset_chunk_507207 | rust_dataset.txt | 507,207 | 512 | Member::Axis(axis) => {
let _ = axis.resize(pane, direction, amount, bounds);
}
};
}
pub fn reset_pane_sizes(&mut self) {
match &mut self.root {
Member::Pane(_) => {}
Member::Axis(axis) => {
axis.reset_pane_sizes();... |
rust_dataset_chunk_507208 | rust_dataset.txt | 507,208 | 512 | () - distance_to_next.into())
}
SplitDirection::Down => {
Point::new(center.x, bounding_box.bottom() + distance_to_next.into())
}
};
self.pane_at_pixel_position(target)
}
pub fn invert_axies(&mut self) {
self.root.invert_pane_axies();
... |
rust_dataset_chunk_507209 | rust_dataset.txt | 507,209 | 512 | Decoration {
let follower_state = self.follower_states.iter().find_map(|(leader_id, state)| {
if state.center_pane == *pane {
Some((*leader_id, state))
} else {
None
}
});
let Some((leader_id, follower_state)) = follower_state e... |
rust_dataset_chunk_507210 | rust_dataset.txt | 507,210 | 512 | cx| {
crate::join_in_room_project(
leader_project_id,
leader_user_id,
app_state.clone(),
cx,
... |
rust_dataset_chunk_507211 | rust_dataset.txt | 507,211 | 512 | ized: Option<&WeakEntity<Pane>>,
render_cx: &dyn PaneLeaderDecorator,
window: &mut Window,
cx: &mut App,
) -> PaneRenderResult {
match self {
Member::Pane(pane) => {
if zoomed == Some(&pane.downgrade().into()) {
return PaneRenderResult ... |
rust_dataset_chunk_507212 | rust_dataset.txt | 507,212 | 512 | }
}
pub fn contains_pane(&self, needle: &Entity<Pane>) -> bool {
match self {
Member::Pane(pane) => pane == needle,
Member::Axis(axis) => axis
.members
.iter()
.any(|member| member.contains_pane(needle)),
}
}
fn c... |
rust_dataset_chunk_507213 | rust_dataset.txt | 507,213 | 512 | (
&mut self,
old_pane: &Entity<Pane>,
new_pane: &Entity<Pane>,
direction: SplitDirection,
) -> bool {
for (mut idx, member) in self.members.iter_mut().enumerate() {
match member {
Member::Axis(axis) => {
if axis.split(old_pane, ... |
rust_dataset_chunk_507214 | rust_dataset.txt | 507,214 | 512 | ) = remove_member {
self.members.remove(idx);
*self.flexes.lock() = vec![1.; self.members.len()];
}
if self.members.len() == 1 {
let result = self.members.pop();
*self.flexes.lock() = vec![1.; self.members.len()];
O... |
rust_dataset_chunk_507215 | rust_dataset.txt | 507,215 | 512 | = if found_pane {
self.members.iter().position(|m| {
if let Member::Pane(p) = m {
p == pane
} else {
false
}
})
} else {
found_axis_index
};
if ix.is_none() {
... |
rust_dataset_chunk_507216 | rust_dataset.txt | 507,216 | 512 | Pane>, to: &Entity<Pane>) {
for member in self.members.iter_mut() {
match member {
Member::Axis(axis) => axis.swap(from, to),
Member::Pane(pane) => {
if pane == from {
*member = Member::Pane(to.clone());
... |
rust_dataset_chunk_507217 | rust_dataset.txt | 507,217 | 512 | if let Some(maximized) = maximized {
if let Some(maximized_pane) = maximized.upgrade() {
for member in &self.members {
if member.contains_pane(&maximized_pane) {
return member.render(
basis,
... |
rust_dataset_chunk_507218 | rust_dataset.txt | 507,218 | 512 | match self {
SplitDirection::Up => write!(f, "up"),
SplitDirection::Down => write!(f, "down"),
SplitDirection::Left => write!(f, "left"),
SplitDirection::Right => write!(f, "right"),
}
}
}
impl SplitDirection {
pub fn all() -> [Self; 4] {
[Self::... |
rust_dataset_chunk_507219 | rust_dataset.txt | 507,219 | 512 | };
use gpui::{CursorStyle, Hitbox};
use parking_lot::Mutex;
use settings::Settings;
use smallvec::SmallVec;
use ui::prelude::*;
use util::ResultExt;
use crate::Workspace;
use crate::WorkspaceSettings;
use super::{HANDLE_HITBOX_SIZE, HORIZONTAL_MIN_SIZE, VERTICAL_MIN_SIZE};
... |
rust_dataset_chunk_507220 | rust_dataset.txt | 507,220 | 512 | mask: Vec<bool>) -> Self {
self.is_leaf_pane_mask = mask;
self
}
fn compute_resize(
flexes: &Arc<Mutex<Vec<f32>>>,
e: &MouseMoveEvent,
ix: usize,
axis: Axis,
child_start: Point<Pixels>,
container_size: Size... |
rust_dataset_chunk_507221 | rust_dataset.txt | 507,221 | 512 | then this code will produce [2, 1, 0]
let mut successors = iter::from_fn({
let forward = proposed_current_pixel_change > px(0.);
let mut ix_offset = 0;
let len = flexes.len();
move || {
let result = if forward {
... |
rust_dataset_chunk_507222 | rust_dataset.txt | 507,222 | 512 | apply_along(axis, |origin| origin + pane_bounds.size.along(axis)),
size: pane_bounds.size.apply_along(axis, |_| px(DIVIDER_SIZE)),
};
PaneAxisHandleLayout {
hitbox: window.insert_hitbox(handle_bounds, HitboxBehavior::BlockMouse),
divider_bounds,
... |
rust_dataset_chunk_507223 | rust_dataset.txt | 507,223 | 512 | .lock();
bounding_boxes.clear();
let mut layout = PaneAxisLayout {
dragged_handle,
children: Vec::new(),
};
for (ix, mut child) in mem::take(&mut self.children).into_iter().enumerate() {
let child_flex = flexes[ix];
... |
rust_dataset_chunk_507224 | rust_dataset.txt | 507,224 | 512 | .active_pane_modifiers
.border_size
.and_then(|val| (val >= 0.).then_some(val));
for (ix, child) in &mut layout.children.iter_mut().enumerate() {
if overlay_opacity.is_some() || overlay_border.is_some() {
// the overlay has... |
rust_dataset_chunk_507225 | rust_dataset.txt | 507,225 | 512 | .click_count >= 2 {
let mut borrow = flexes.lock();
*borrow = vec![1.; borrow.len()];
workspace
.update(cx, |this, cx| this.serialize_workspace(window, cx))
... |
rust_dataset_chunk_507226 | rust_dataset.txt | 507,226 | 512 | notifications::NotifyResultExt,
toolbar::Toolbar,
workspace_settings::{AutosaveSetting, FocusFollowsMouse, TabBarSettings, WorkspaceSettings},
};
use anyhow::Result;
use collections::{BTreeSet, HashMap, HashSet, VecDeque};
use futures::{StreamExt, stream::FuturesUnordered};
use git::{CopyFilePermalink, Open... |
rust_dataset_chunk_507227 | rust_dataset.txt | 507,227 | 512 | <dyn Iterator<Item = &'a SelectedEntry> + 'a> {
if self.marked_selections.contains(&self.active_selection) {
Box::new(self.marked_selections.iter())
} else {
Box::new(std::iter::once(&self.active_selection))
}
}
}
#[derive(Clone, Copy, PartialEq, Debug, Deserialize, ... |
rust_dataset_chunk_507228 | rust_dataset.txt | 507,228 | 512 | )]
pub close_pinned: bool,
}
/// Closes all items in the pane.
#[derive(Clone, PartialEq, Debug, Deserialize, JsonSchema, Default, Action)]
#[action(namespace = pane)]
#[serde(deny_unknown_fields)]
pub struct CloseAllItems {
#[serde(default)]
pub save_intent: Option<SaveIntent>,
#[serde(default)]
p... |
rust_dataset_chunk_507229 | rust_dataset.txt | 507,229 | 512 | pub enum SplitMode {
/// Clone the current pane.
#[default]
ClonePane,
/// Create an empty new pane.
EmptyPane,
/// Move the item into a new pane. This will map to nop if only one pane exists.
MovePane,
}
macro_rules! split_structs {
($($name:ident => $doc:literal),* $(,)?) => {
... |
rust_dataset_chunk_507230 | rust_dataset.txt | 507,230 | 512 | /// Navigates forward in the tag stack.
GoToNewerTag,
/// Joins this pane into the next pane.
JoinIntoNext,
/// Joins all panes into one.
JoinAll,
/// Reopens the most recently closed item.
ReopenClosedItem,
/// Splits the pane to the left, moving ... |
rust_dataset_chunk_507231 | rust_dataset.txt | 507,231 | 512 | .debug_struct("RemovedItem")
.field("item", &item.item_id())
.finish(),
Event::Split { direction, mode } => f
.debug_struct("Split")
.field("direction", direction)
.field("mode", mode)
.finish(),
... |
rust_dataset_chunk_507232 | rust_dataset.txt | 507,232 | 512 | >>,
can_toggle_zoom: bool,
should_display_tab_bar: Rc<dyn Fn(&Window, &mut Context<Pane>) -> bool>,
should_display_welcome_page: bool,
render_tab_bar_buttons: Rc<
dyn Fn(
&mut Pane,
&mut Window,
&mut Context<Pane>,
) -> (Option<AnyElement>, Option<AnyE... |
rust_dataset_chunk_507233 | rust_dataset.txt | 507,233 | 512 | tag_stack: VecDeque<TagStackEntry>,
tag_stack_pos: usize,
paths_by_item: HashMap<EntityId, (ProjectPath, Option<PathBuf>)>,
pane: WeakEntity<Pane>,
next_timestamp: Arc<AtomicUsize>,
preview_item_id: Option<EntityId>,
}
#[derive(Debug, Default, Copy, Clone)]
pub enum NavigationMode {
#[default]... |
rust_dataset_chunk_507234 | rust_dataset.txt | 507,234 | 512 | _out(&focus_handle, window, Pane::focus_out),
cx.observe_global_in::<SettingsStore>(window, Self::settings_changed),
cx.subscribe(&project, Self::project_events),
];
let handle = cx.entity().downgrade();
Self {
alternate_file_items: (None, None),
... |
rust_dataset_chunk_507235 | rust_dataset.txt | 507,235 | 512 | welcome_page: None,
}
}
fn alternate_file(&mut self, _: &AlternateFile, window: &mut Window, cx: &mut Context<Pane>) {
let (_, alternative) = &self.alternate_file_items;
if let Some(alternative) = alternative {
let existing = self
.items()
.f... |
rust_dataset_chunk_507236 | rust_dataset.txt | 507,236 | 512 | Focus);
cx.notify();
}
self.toolbar.update(cx, |toolbar, cx| {
toolbar.focus_changed(true, window, cx);
});
if let Some(active_item) = self.active_item() {
if self.focus_handle.is_focused(window) {
// Schedule a redraw next frame, so ... |
rust_dataset_chunk_507237 | rust_dataset.txt | 507,237 | 512 | self.diagnostic_summary_update = cx.spawn(async move |this, cx| {
cx.background_executor()
.timer(Duration::from_millis(30))
.await;
this.update(cx, |this, cx| {
this.u... |
rust_dataset_chunk_507238 | rust_dataset.txt | 507,238 | 512 | self.is_tab_pinned(self.active_item_index)
}
pub fn activation_history(&self) -> &[ActivationHistoryEntry] {
&self.activation_history
}
pub fn set_should_display_tab_bar<F>(&mut self, should_display_tab_bar: F)
where
F: 'static + Fn(&Window, &mut Context<Pane>) -> bool,
{
... |
rust_dataset_chunk_507239 | rust_dataset.txt | 507,239 | 512 | .nav_history.0.lock().clone();
NavHistory(Arc::new(Mutex::new(history)))
}
pub fn set_nav_history(&mut self, history: NavHistory, cx: &Context<Self>) {
self.nav_history = history;
self.nav_history().0.lock().pane = cx.entity().downgrade();
}
pub fn disable_history(&mut self) {
... |
rust_dataset_chunk_507240 | rust_dataset.txt | 507,240 | 512 | Tag,
window: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(workspace) = self.workspace.upgrade() {
let pane = cx.entity().downgrade();
window.defer(cx, move |window, cx| {
workspace.update(cx, |workspace, cx| {
workspace
... |
rust_dataset_chunk_507241 | rust_dataset.txt | 507,241 | 512 |
}
/// Marks the item with the given ID as the preview item.
/// This will be ignored if the global setting `preview_tabs` is disabled.
///
/// This is a low-level method. Prefer `unpreview_item_if_preview()` or `set_new_preview_item()`.
pub(crate) fn set_preview_item_id(&mut self, item_id: Opt... |
rust_dataset_chunk_507242 | rust_dataset.txt | 507,242 | 512 | index, item));
break;
}
}
}
let preview_was_active = self.preview_item_idx() == Some(self.active_item_index);
let set_up_existing_item =
|index: usize, pane: &mut Self, window: &mut Window, cx: &mut Context<Self>| {
if... |
rust_dataset_chunk_507243 | rust_dataset.txt | 507,243 | 512 | .read(cx).error == invalid_buffer_view.read(cx).error
&& existing_error_view.read(cx).active_project_path(cx)
== invalid_buffer_view.read(cx).active_project_path(cx)
{
already_open_view = Some(existing_error_view);
... |
rust_dataset_chunk_507244 | rust_dataset.txt | 507,244 | 512 | _exists {
self.close_items_on_item_open(window, cx);
}
if item.buffer_kind(cx) == ItemBufferKind::Singleton
&& let Some(&entry_id) = item.project_entry_ids(cx).first()
{
let Some(project) = self.project.upgrade() else {
return;
};
... |
rust_dataset_chunk_507245 | rust_dataset.txt | 507,245 | 512 | _item_index < self.active_item_index {
self.active_item_index -= 1;
}
insertion_index = insertion_index.min(self.items.len());
self.items.insert(insertion_index, item.clone());
if existing_item_is_active {
... |
rust_dataset_chunk_507246 | rust_dataset.txt | 507,246 | 512 | pub fn active_item(&self) -> Option<Box<dyn ItemHandle>> {
self.items.get(self.active_item_index).cloned()
}
fn active_item_id(&self) -> EntityId {
self.items[self.active_item_index].item_id()
}
pub fn pixel_position_of_cursor(&self, cx: &App) -> Option<Point<Pixels>> {
sel... |
rust_dataset_chunk_507247 | rust_dataset.txt | 507,247 | 512 | _in(&mut self, _: &ZoomIn, window: &mut Window, cx: &mut Context<Self>) {
if !self.can_toggle_zoom {
cx.propagate();
} else if !self.zoomed && !self.items.is_empty() {
if !self.focus_handle.contains_focused(window, cx) {
cx.focus_self(window);
}
... |
rust_dataset_chunk_507248 | rust_dataset.txt | 507,248 | 512 | (1, Ordering::SeqCst),
});
}
}
pub fn activate_previous_item(
&mut self,
action: &ActivatePreviousItem,
window: &mut Window,
cx: &mut Context<Self>,
) {
let mut index = self.active_item_index;
if index > 0 {
index -= 1;
... |
rust_dataset_chunk_507249 | rust_dataset.txt | 507,249 | 512 | {
if self.items.is_empty() {
// Close the window when there's no active items to close, if configured
if WorkspaceSettings::get_global(cx)
.when_closing_with_no_tabs
.should_close()
{
window.dispatch_action(Box::new(CloseWindow... |
rust_dataset_chunk_507250 | rust_dataset.txt | 507,250 | 512 | _intent: SaveIntent,
close_pinned: bool,
window: &mut Window,
cx: &mut Context<Self>,
) -> Task<Result<()>> {
let pinned_item_ids = self.pinned_item_ids();
let matching_item_ids: Vec<_> = self
.items()
.filter(|item| item.project_path(cx).as_ref() == S... |
rust_dataset_chunk_507251 | rust_dataset.txt | 507,251 | 512 | : &mut Window,
cx: &mut Context<Self>,
) -> Task<Result<()>> {
if self.items.is_empty() {
return Task::ready(Ok(()));
}
let clean_item_ids = self.clean_item_ids(cx);
let pinned_item_ids = self.pinned_item_ids();
self.close_items(window, cx, SaveIntent::C... |
rust_dataset_chunk_507252 | rust_dataset.txt | 507,252 | 512 | .is_empty() {
return Task::ready(Ok(()));
}
let pinned_item_ids = self.pinned_item_ids();
self.close_items(
window,
cx,
action.save_intent.unwrap_or(SaveIntent::Close),
&|item_id| action.close_pinned || !pinned_item_ids.contains(&item... |
rust_dataset_chunk_507253 | rust_dataset.txt | 507,253 | 512 | _list.push(index);
items_len -= 1;
}
// The sort and reverse is necessary since we remove items
// using their index position, hence removing from the end
// of the list first to avoid changing indexes.
index_list.sort_unstable();
index_list
.iter(... |
rust_dataset_chunk_507254 | rust_dataset.txt | 507,254 | 512 | .iter().take(5).join("\n"),
file_names.len() - 5
)
} else {
file_names.into_iter().join("\n")
}
}
pub fn close_items(
&self,
window: &mut Window,
cx: &mut Context<Pane>,
mut save_intent: SaveIntent,
should_close: &d... |
rust_dataset_chunk_507255 | rust_dataset.txt | 507,255 | 512 | Ok(0) => save_intent = SaveIntent::SaveAll,
Ok(1) => save_intent = SaveIntent::Skip,
Ok(2) => return Ok(()),
_ => {}
}
}
for item_to_close in items_to_close {
let mut should_close = t... |
rust_dataset_chunk_507256 | rust_dataset.txt | 507,256 | 512 | ane_if_empty: bool,
window: &mut Window,
cx: &mut Context<Self>,
) {
let Some(item_index) = self.index_for_item_id(item_id) else {
return;
};
self._remove_item(
item_index,
activate_pane,
close_pane_if_empty,
None,
... |
rust_dataset_chunk_507257 | rust_dataset.txt | 507,257 | 512 | => {
self.activation_history.pop();
left_neighbour_index()
}
};
let should_activate = activate_pane || self.has_focus(window, cx);
if self.items.len() == 1 && should_activate {
self.focus_handle.focus(window, c... |
rust_dataset_chunk_507258 | rust_dataset.txt | 507,258 | 512 | you started editing it. Do you want to recreate it?";
let path_style = project.read_with(cx, |project, cx| project.path_style(cx));
if save_intent == SaveIntent::Skip {
let is_saveable_singleton = cx.update(|_window, cx| {
item.can_save(cx) && item.buffer_kind(cx) == ItemBu... |
rust_dataset_chunk_507259 | rust_dataset.txt | 507,259 | 512 | window.prompt(
PromptLevel::Warning,
DELETED_MESSAGE,
None,
&["Save", "Close", "Cancel"],
cx,
)
})?;
match answer.await {
... |
rust_dataset_chunk_507260 | rust_dataset.txt | 507,260 | 512 | ,
&prompt,
None,
&["Save", "Don't Save", "Cancel"],
cx,
))
} else {
None
}
... |
rust_dataset_chunk_507261 | rust_dataset.txt | 507,261 | 512 | = new_path.await.ok().flatten().into_iter().flatten().next()
else {
return Ok(false);
};
let project_path = pane.update(cx, |pane, cx| {
pane.project
.update(cx, |project, cx| {
... |
rust_dataset_chunk_507262 | rust_dataset.txt | 507,262 | 512 | _item) = self.active_item() {
let focus_handle = active_item.item_focus_handle(cx);
window.focus(&focus_handle, cx);
}
}
pub fn split(
&mut self,
direction: SplitDirection,
mode: SplitMode,
window: &mut Window,
cx: &mut Context<Self>,
... |
rust_dataset_chunk_507263 | rust_dataset.txt | 507,263 | 512 | {
Some(item.item_id())
} else {
None
}
})?;
self.remove_item(item_id, false, true, window, cx);
self.nav_history.remove_item(item_id);
Some(())
}
fn update_toolbar(&mut self, window: &mut Window, cx: &mut Context<Self>) ... |
rust_dataset_chunk_507264 | rust_dataset.txt | 507,264 | 512 | window: &mut Window, cx: &mut Context<Self>) {
if self.items.is_empty() {
return;
}
let pinned_item_ids = self.pinned_item_ids().into_iter().rev();
for pinned_item_id in pinned_item_ids {
if let Some(ix) = self.index_for_item_id(pinned_item_id) {
... |
rust_dataset_chunk_507265 | rust_dataset.txt | 507,265 | 512 | .pinned_tab_count > ix
}
fn has_unpinned_tabs(&self) -> bool {
self.pinned_tab_count < self.items.len()
}
fn activate_unpinned_tab(&mut self, window: &mut Window, cx: &mut Context<Self>) {
if self.items.is_empty() {
return;
}
let Some(index) = self
... |
rust_dataset_chunk_507266 | rust_dataset.txt | 507,266 | 512 | _item_id
.map(|id| id == item.item_id())
.unwrap_or(false);
let label = item.tab_content(
TabContentParams {
detail: Some(detail),
selected: is_active,
preview: is_preview,
deemphasized: !self.has_focus(window, ... |
rust_dataset_chunk_507267 | rust_dataset.txt | 507,267 | 512 | close_side {
ClosePosition::Left => ui::TabCloseSide::Start,
ClosePosition::Right => ui::TabCloseSide::End,
})
.toggle_state(is_active)
.on_click(cx.listener({
let item_handle = item.boxed_clone();
move |pane: &mut Self... |
rust_dataset_chunk_507268 | rust_dataset.txt | 507,268 | 512 | .can_drop_predicate.clone(), |this, p| {
this.can_drop(move |a, window, cx| p(a, window, cx))
})
.on_drop(
cx.listener(move |this, dragged_tab: &DraggedTab, window, cx| {
this.drag_split_direction = None;
this.handle_tab_dro... |
rust_dataset_chunk_507269 | rust_dataset.txt | 507,269 | 512 | .map(|this| {
if is_active {
let focus_handle = focus_handle.clone();
this.tooltip(move |window, cx| {
Tooltip::for_action_in(
end_slot_tooltip_text,
... |
rust_dataset_chunk_507270 | rust_dataset.txt | 507,270 | 512 | (cx);
let item_handle = item.boxed_clone();
right_click_menu(ix)
.trigger(|_, _, _| tab)
.menu(move |window, cx| {
let pane = pane.clone();
let menu_context = menu_context.clone();
let extra_actions = item_handle.tab_extra_context_... |
rust_dataset_chunk_507271 | rust_dataset.txt | 507,271 | 512 | ,
move |pane, window, cx| {
pane.close_multibuffer_items(
&close_multibuffers_action,
window,
... |
rust_dataset_chunk_507272 | rust_dataset.txt | 507,272 | 512 | (TogglePinTab.boxed_clone()),
window.handler_for(&pane, move |pane, window, cx| {
pane.pin_tab_at(ix, window, cx);
}),
)
}
... |
rust_dataset_chunk_507273 | rust_dataset.txt | 507,273 | 512 | _some_and(|project| {
let project = project.read(cx);
project.is_local() || project.is_via_wsl_with_host_interop(cx)
});
let is_remote = pane
.read(cx)
... |
rust_dataset_chunk_507274 | rust_dataset.txt | 507,274 | 512 | ,
cx,
);
},
),
)
},
... |
rust_dataset_chunk_507275 | rust_dataset.txt | 507,275 | 512 | )
.icon_size(IconSize::Small)
.on_click({
let entity = cx.entity();
move |_, window, cx| {
entity.update(cx, |pane, cx| {
pane.navigate_backward(&Default::default(), window, cx)
})
}
... |
rust_dataset_chunk_507276 | rust_dataset.txt | 507,276 | 512 | tab_bar_settings.show_pinned_tabs_in_separate_row;
if use_separate_rows && !pinned_tabs.is_empty() && !unpinned_tabs.is_empty() {
self.render_two_row_tab_bar(
pinned_tabs,
unpinned_tabs,
tab_count,
navigate_backward,
n... |
rust_dataset_chunk_507277 | rust_dataset.txt | 507,277 | 512 | 0, creating a loop.
let is_scrollable = max_scroll > px(2.0);
let has_active_unpinned_tab = self.active_item_index >= self.pinned_tab_count;
h_flex()
.children(pinned_tabs)
.when(is_scrollable && is_scrolled, |this| {
... |
rust_dataset_chunk_507278 | rust_dataset.txt | 507,278 | 512 | .child(self.render_tab_bar_drop_target(tab_count, cx))
}
fn render_tab_bar_drop_target(
&self,
tab_count: usize,
cx: &mut Context<Pane>,
) -> impl IntoElement {
div()
.id("tab_bar_drop_target")
.min_w_6()
.h(Tab::container_heig... |
rust_dataset_chunk_507279 | rust_dataset.txt | 507,279 | 512 | above.
.child("")
.drag_over::<DraggedTab>(|bar, _, _, cx| {
bar.bg(cx.theme().colors().drop_target_background)
})
.drag_over::<DraggedSelection>(|bar, _, _, cx| {
bar.bg(cx.theme().colors().drop_target_background)
})
... |
rust_dataset_chunk_507280 | rust_dataset.txt | 507,280 | 512 | .y - event.bounds.top(),
);
let direction = if relative_cursor.x < size
|| relative_cursor.x > rect.width - size
|| relative_cursor.y < size
|| relative_cursor.y > rect.height - size
{
[
SplitDirection::Up,
SplitDir... |
rust_dataset_chunk_507281 | rust_dataset.txt | 507,281 | 512 | .read(cx)
.items()
.find(|item| item.item_id() == item_id)
.cloned()
else {
return;
};
if item.can_split(cx)... |
rust_dataset_chunk_507282 | rust_dataset.txt | 507,282 | 512 | mut Window,
cx: &mut Context<Self>,
) {
let item_id = dragged_tab.item.item_id();
let pinned_count = self.pinned_tab_count;
self.handle_tab_drop(dragged_tab, pinned_count, false, window, cx);
let to_pane = cx.entity();
self.workspace
.update(cx, |_, cx|... |
rust_dataset_chunk_507283 | rust_dataset.txt | 507,283 | 512 | &mut Window,
cx: &mut Context<Self>,
) {
if let Some(active_item) = self.active_item()
&& active_item.handle_drop(self, project_entry_id, window, cx)
{
return;
}
let mut to_pane = cx.entity();
let split_direction = self.drag_split_direction;
... |
rust_dataset_chunk_507284 | rust_dataset.txt | 507,284 | 512 | (self, paths, window, cx)
{
return;
}
let mut to_pane = cx.entity();
let mut split_direction = self.drag_split_direction;
let paths = paths.paths().to_vec();
let (should_block, needs_wsl_translation) = self
.workspace
.update(cx, |work... |
rust_dataset_chunk_507285 | rust_dataset.txt | 507,285 | 512 | "wslpath failed for {}: {e:#}, dropping this path",
path.display()
),
}
}
if translated.is_empty() && !paths.is_empty() {
... |
rust_dataset_chunk_507286 | rust_dataset.txt | 507,286 | 512 | EntityId, side: Side) -> Vec<EntityId> {
match side {
Side::Left => self
.items()
.take_while(|item| item.item_id() != item_id)
.map(|item| item.item_id())
.collect(),
Side::Right => self
.items()
... |
rust_dataset_chunk_507287 | rust_dataset.txt | 507,287 | 512 | (pane.new_item_context_menu_handle.clone())
.menu(move |window, cx| {
Some(ContextMenu::build(window, cx, |menu, _, _| {
menu.action("New File", NewFile.boxed_clone())
.action("Open File", ToggleFileFinder::default().boxed_clone())
... |
rust_dataset_chunk_507288 | rust_dataset.txt | 507,288 | 512 | (
if zoomed { "Zoom Out" } else { "Zoom In" },
&ToggleZoom,
cx,
)
})
})
.into_any_element()
.into();
(None, right_children)
}
impl Focusable for Pane {
fn focus_handle(&self, _cx:... |
rust_dataset_chunk_507289 | rust_dataset.txt | 507,289 | 512 | Direction::Right, split.mode, window, cx)
}))
.on_action(cx.listener(|pane, split: &SplitDown, window, cx| {
pane.split(SplitDirection::Down, split.mode, window, cx)
}))
.on_action(cx.listener(|pane, _: &SplitAndMoveUp, window, cx| {
pane.s... |
rust_dataset_chunk_507290 | rust_dataset.txt | 507,290 | 512 | on_action(cx.listener(Self::unpin_all_tabs))
.when(PreviewTabsSettings::get_global(cx).enabled, |this| {
this.on_action(
cx.listener(|pane: &mut Pane, _: &TogglePreviewTab, window, cx| {
if let Some(active_item_id) = pane.active_item().map(|i| i.it... |
rust_dataset_chunk_507291 | rust_dataset.txt | 507,291 | 512 | mut Self, action: &RevealInProjectPanel, _window, cx| {
let entry_id = action.entry_id.map(ProjectEntryId::from_proto);
let active_project_path =
pane.active_item().and_then(|item| item.project_path(cx));
pane.project
... |
rust_dataset_chunk_507292 | rust_dataset.txt | 507,292 | 512 | overflow_hidden()
.child(self.toolbar.clone())
.child(item.to_any_view())
} else {
let placeholder = div
.id("pane_placeholder")
.h_flex()
... |
rust_dataset_chunk_507293 | rust_dataset.txt | 507,293 | 512 | ().bottom_0().left_0(),
Some(SplitDirection::Up) => {
div.top_0().left_0().right_0().h(size)
}
Some(SplitDirection::Down) => {
div.l... |
rust_dataset_chunk_507294 | rust_dataset.txt | 507,294 | 512 | {
item: self.item.clone(),
data,
timestamp: 0,
is_preview: self.is_preview_item(),
row: None,
}
}
pub fn push_tag(&mut self, origin: Option<NavigationEntry>, target: Option<NavigationEntry>) {
if let (Some(origin_entry), Some(target_e... |
rust_dataset_chunk_507295 | rust_dataset.txt | 507,295 | 512 | if state.backward_stack.is_empty()
&& state.forward_stack.is_empty()
&& state.closed_stack.is_empty()
&& state.paths_by_item.is_empty()
&& state.tag_stack.is_empty()
{
return;
}
state.mode = NavigationMode::Normal;
stat... |
rust_dataset_chunk_507296 | rust_dataset.txt | 507,296 | 512 | (entry));
if state.forward_stack.len() >= MAX_NAVIGATION_HISTORY_LEN {
state.forward_stack.pop_front();
}
state.forward_stack.push_back(NavigationEntry {
item,
data: data.map(|data| Arc::new(data) as Arc<dyn Any... |
rust_dataset_chunk_507297 | rust_dataset.txt | 507,297 | 512 | path_for_item.0 = project_path;
path_for_item.1 = abs_path;
}
}
pub fn path_for_item(&self, item_id: EntityId) -> Option<(ProjectPath, Option<PathBuf>)> {
self.0.lock().paths_by_item.get(&item_id).cloned()
}
pub fn push_tag(&mut self, origin: NavigationEntry, target: Navig... |
rust_dataset_chunk_507298 | rust_dataset.txt | 507,298 | 512 | += 1;
keep
});
}
}
fn dirty_message_for(buffer_path: Option<ProjectPath>, path_style: PathStyle) -> String {
let path = buffer_path.as_ref().and_then(|p| {
let path = p.path.display(path_style);
if path.is_empty() { None } else { Some(path) }
});
match path {
... |
rust_dataset_chunk_507299 | rust_dataset.txt | 507,299 | 512 | , rc::Rc};
use super::*;
use crate::{
Member,
item::test::{TestItem, TestProjectItem},
};
use gpui::{
AppContext, Axis, Modifiers, MouseButton, MouseDownEvent, MouseMoveEvent, MouseUpEvent,
TestAppContext, VisualTestContext, size,
};
use project::FakeFs;
use ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.