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_507600 | rust_dataset.txt | 507,600 | 512 | _item: None,
titlebar_focus_handle: cx.focus_handle(),
region_focus_handles: RegionFocusHandles::new(cx),
notifications: Notifications::default(),
suppressed_notifications: HashSet::default(),
left_dock,
bottom_dock,
right_dock,
... |
rust_dataset_chunk_507601 | rust_dataset.txt | 507,601 | 512 | <Workspace>) + Send>>,
open_mode: OpenMode,
cx: &mut App,
) -> Task<anyhow::Result<OpenResult>> {
#[cfg(target_os = "windows")]
let wsl_path = abs_paths
.iter()
.find_map(|path| util::paths::WslPath::from_path(path));
let project_handle = Project::loca... |
rust_dataset_chunk_507602 | rust_dataset.txt | 507,602 | 512 | _handle.read_with(cx, |this, cx| {
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_507603 | rust_dataset.txt | 507,603 | 512 | (window_bounds, display) = if let Some(bounds) = window_bounds_override {
(Some(WindowBounds::Windowed(bounds)), None)
} else if let Some(workspace) = serialized_workspace.as_ref()
&& let Some(display) = workspace.display
&& le... |
rust_dataset_chunk_507604 | rust_dataset.txt | 507,604 | 512 | .is_empty();
// Check if serialized workspace has paths before it's moved
let serialized_workspace_has_paths = serialized_workspace
.as_ref()
.map(|ws| !ws.paths.is_empty())
.unwrap_or(false);
let all_paths_resolved = project_paths.ite... |
rust_dataset_chunk_507605 | rust_dataset.txt | 507,605 | 512 | log_err();
}
// Auto-show the security modal if the project has restricted worktrees
window
.update(cx, |_, window, cx| {
workspace.update(cx, |workspace, cx| {
workspace.show_worktree_trust_security_modal(false, window, cx... |
rust_dataset_chunk_507606 | rust_dataset.txt | 507,606 | 512 | _name().to_string());
let bottom_dock_zoom = self.zoomed_position == Some(DockPosition::Bottom);
DockStructure {
left: DockData {
visible: left_visible,
active_panel: left_active_panel,
zoom: left_dock_zoom,
},
right: D... |
rust_dataset_chunk_507607 | rust_dataset.txt | 507,607 | 512 | self.active_worktree_creation.label = label;
self.active_worktree_creation.is_switch = is_switch;
cx.emit(Event::WorktreeCreationChanged);
cx.notify();
}
/// Captures the current workspace state for restoring after a worktree switch.
/// This includes dock layout, open file ... |
rust_dataset_chunk_507608 | rust_dataset.txt | 507,608 | 512 | _panel_size_state(
&self,
panel_key: &str,
size_state: dock::PanelSizeState,
cx: &mut App,
) {
let Some(workspace_id) = self
.database_id()
.map(|id| i64::from(id).to_string())
.or(self.session_id())
else {
return;
... |
rust_dataset_chunk_507609 | rust_dataset.txt | 507,609 | 512 | _default();
let position = dock.position();
let use_flex = panel.has_flexible_size(window, cx);
if position.axis() == Axis::Horizontal
&& use_flex
&& let Some(flex) = size_state.flex.or_else(|| self.default_dock_flex(position))
{
let workspace_width ... |
rust_dataset_chunk_507610 | rust_dataset.txt | 507,610 | 512 | , s)| s.size.unwrap_or_else(|| panel.default_size(window, cx)))
.unwrap_or_default();
let available = (workspace_width - opposite_width).max(RESIZE_HANDLE_SIZE);
let remaining = (available - size).max(px(1.));
Some((size * center_column_count / remaining).max(0.0))
... |
rust_dataset_chunk_507611 | rust_dataset.txt | 507,611 | 512 | (|size| {
let state = dock::PanelSizeState {
size: Some(size),
flex: None,
};
self.persist_panel_size_state(T::panel_key(), state, cx);
state
})
... |
rust_dataset_chunk_507612 | rust_dataset.txt | 507,612 | 512 | ()>>) {
self._panels_task = Some(task);
}
pub fn take_panels_task(&mut self) -> Option<Task<Result<()>>> {
self._panels_task.take()
}
pub fn user_store(&self) -> &Entity<UserStore> {
&self.app_state.user_store
}
pub fn project(&self) -> &Entity<Project> {
&self... |
rust_dataset_chunk_507613 | rust_dataset.txt | 507,613 | 512 | _history()
.for_each_entry(cx, &mut |entry, (project_path, fs_path)| {
if let Some(fs_path) = &fs_path {
abs_paths_opened
.entry(fs_path.clone())
.or_default()
.insert(project_... |
rust_dataset_chunk_507614 | rust_dataset.txt | 507,614 | 512 | project_path, Some(abs_path.clone())));
}
}
recent_history.retain(|(path, _)| !self.is_deleted_history_path(path, cx));
recent_history.into_iter()
}
pub fn recent_navigation_history(
&self,
limit: Option<usize>,
cx: &App,
) -> Vec<(ProjectPath, O... |
rust_dataset_chunk_507615 | rust_dataset.txt | 507,615 | 512 | ) else {
return;
};
let worktree = worktree.read(cx);
let removed_paths = changes
.iter()
.filter(|(path, entry_id, change)| {
*change == PathChange::Removed
&& worktree.entry_for_id(*entry_id).is_none()
... |
rust_dataset_chunk_507616 | rust_dataset.txt | 507,616 | 512 | }
if changed {
let mut seen_paths = HashSet::default();
self.persisted_recent_navigation_history
.retain(|path| seen_paths.insert(path.clone()));
}
changed
}
fn remember_navigation_history_path(&mut self, project_path: &ProjectPath, cx: &App) ->... |
rust_dataset_chunk_507617 | rust_dataset.txt | 507,617 | 512 | .nav_history_mut(), cx)?;
// If the item is still present in this pane, then activate it.
if let Some(index) = entry
.item
.upgrade()
.and_then(|v| pane.index_for_item(v.as_ref()))
{
... |
rust_dataset_chunk_507618 | rust_dataset.txt | 507,618 | 512 | = entry.data {
navigated |= item.navigate(data, window, cx);
}
})?;
}
Err(open_by_project_path_e) => {
// Fall back to opening by abs path, in case an external file was op... |
rust_dataset_chunk_507619 | rust_dataset.txt | 507,619 | 512 | , window, cx)
}
pub fn reopen_closed_item(
&mut self,
window: &mut Window,
cx: &mut Context<Workspace>,
) -> Task<Result<()>> {
self.navigate_history(
self.active_pane().downgrade(),
NavigationMode::ReopeningClosedItem,
window,
... |
rust_dataset_chunk_507620 | rust_dataset.txt | 507,620 | 512 | mut self,
mut path_prompt_options: PathPromptOptions,
lister: DirectoryLister,
mode: OpenPathPromptMode,
window: &mut Window,
cx: &mut Context<Self>,
) -> oneshot::Receiver<Option<OpenPathPromptResult>> {
// TODO: If `on_prompt_for_open_path` is set, we should always ... |
rust_dataset_chunk_507621 | rust_dataset.txt | 507,621 | 512 | lister: DirectoryLister,
suggested_name: Option<String>,
window: &mut Window,
cx: &mut Context<Self>,
) -> oneshot::Receiver<Option<Vec<PathBuf>>> {
if self.project.read(cx).is_via_collab()
|| self.project.read(cx).is_via_remote_server()
|| !WorkspaceS... |
rust_dataset_chunk_507622 | rust_dataset.txt | 507,622 | 512 | via WSL (allowing host access).
///
/// If the given workspace has a local project, then it will be passed
/// to the callback. Otherwise, a new empty window will be created.
pub fn with_local_workspace<T, F>(
&mut self,
window: &mut Window,
cx: &mut Context<Self>,
callb... |
rust_dataset_chunk_507623 | rust_dataset.txt | 507,623 | 512 | None,
OpenMode::Activate,
cx,
);
cx.spawn_in(window, async move |_vh, cx| {
let OpenResult {
window: multi_workspace_window,
..
} = task.await?;
multi_workspace... |
rust_dataset_chunk_507624 | rust_dataset.txt | 507,624 | 512 | cx| {
let active_panel = dock
.active_panel()
.filter(|panel| panel.panel_focus_handle(cx).contains_focused(window, cx));
if let Some(panel) = active_panel {
panel.move_to_next_position(window, cx);
}
... |
rust_dataset_chunk_507625 | rust_dataset.txt | 507,625 | 512 | if answer.await.log_err() == Some(1) {
return anyhow::Ok(false);
} else {
if let Ok(task) = cx.update(|_window, cx| active_call.0.hang_up(cx)) {
task.await.log_err();
}
... |
rust_dataset_chunk_507626 | rust_dataset.txt | 507,626 | 512 | All),
true,
window,
cx,
)
.detach_and_log_err(cx);
}
fn send_keystrokes(
&mut self,
action: &SendKeystrokes,
window: &mut Window,
cx: &mut Context<Self>,
) {
let keystrokes: Vec<Keystroke> = action
.0
... |
rust_dataset_chunk_507627 | rust_dataset.txt | 507,627 | 512 | { "g z": ["workspace::SendKeystrokes", ": j <enter> u"]}
// )
window.draw(cx).clear(cx);
return true;
}
false
... |
rust_dataset_chunk_507628 | rust_dataset.txt | 507,628 | 512 | (Event::Activate))?;
}
if remaining_dirty_items.len() > 1 {
let answer = workspace.update_in(cx, |_, window, cx| {
cx.emit(Event::Activate);
let detail = Pane::file_names_for_prompt(
&mut rem... |
rust_dataset_chunk_507629 | rust_dataset.txt | 507,629 | 512 | &paths,
app_state,
OpenOptions {
requesting_window,
open_mode,
workspace_matching: if open_mode == OpenMode::NewWindow {
WorkspaceMa... |
rust_dataset_chunk_507630 | rust_dataset.txt | 507,630 | 512 | visible,
cx,
)
})
.ok()
{
Some(project_path) => project_path.await.log_err(),
None => None,
... |
rust_dataset_chunk_507631 | rust_dataset.txt | 507,631 | 512 | , after all
// paths finish opening. This avoids races between concurrently-opening paths
// (directories in particular) and makes the resulting project panel selection
// deterministic.
if let Some((winner_abs_path, winner_is_dir)) = winner {
'emit_winner... |
rust_dataset_chunk_507632 | rust_dataset.txt | 507,632 | 512 | )
{
*result_in_caller_order = result;
}
}
results_in_caller_order
})
}
pub fn open_resolved_path(
&mut self,
path: ResolvedPath,
window: &mut Window,
cx: &mut Context<Self>,
) -> Task<anyhow:... |
rust_dataset_chunk_507633 | rust_dataset.txt | 507,633 | 512 | results.into_iter().flatten() {
result.log_err();
}
}
anyhow::Ok(())
})
.detach_and_log_err(cx);
}
pub fn project_path_for_path(
project: Entity<Project>,
abs_path: &Path,
visible: bool,
cx: &mut App,
... |
rust_dataset_chunk_507634 | rust_dataset.txt | 507,634 | 512 | to `act_as` so that wrapper items (e.g.
// diff views) resolve to the inner view they expose.
item.to_any_view()
.downcast::<I>()
.ok()
.or_else(|| item.act_as::<I>(cx))
}
fn active_project_path(&self, cx: &App) -> Option<ProjectPath> {
self.active_i... |
rust_dataset_chunk_507635 | rust_dataset.txt | 507,635 | 512 | : &mut Context<Self>,
) {
if let Some(task) = self.close_all_internal(
false,
action.save_intent.unwrap_or(SaveIntent::Close),
window,
cx,
) {
task.detach_and_log_err(cx)
}
}
/// Closes the active item across all panes.
... |
rust_dataset_chunk_507636 | rust_dataset.txt | 507,636 | 512 | current_pane_close = current_pane.update(cx, |pane, cx| {
pane.close_other_items(
&CloseOtherItems {
save_intent: None,
close_pinned: false,
},
None,
window,
... |
rust_dataset_chunk_507637 | rust_dataset.txt | 507,637 | 512 | return;
};
dock.activate_panel(panel_ix, window, cx);
}
if let Some(active_panel) = dock.active_panel() {
if was_visible {
if active_panel
.panel_focus_handle(cx)
.contains_focus... |
rust_dataset_chunk_507638 | rust_dataset.txt | 507,638 | 512 | open docks.
///
/// Updates `last_open_dock_positions` with positions of all currently open
/// docks, to later be restored by the 'Toggle All Docks' action.
fn save_open_dock_positions(&mut self, cx: &mut Context<Self>) {
let open_dock_positions = self.get_open_dock_positions(cx);
if !... |
rust_dataset_chunk_507639 | rust_dataset.txt | 507,639 | 512 | workspace center.
/// When the `close_panel_on_toggle` setting is enabled, also closes the
/// panel when transferring focus back to the center.
pub fn toggle_panel_focus<T: Panel>(
&mut self,
window: &mut Window,
cx: &mut Context<Self>,
) -> bool {
let mut did_focus_pan... |
rust_dataset_chunk_507640 | rust_dataset.txt | 507,640 | 512 | ) -> Option<Arc<dyn PanelHandle>> {
let mut result_panel = None;
let mut serialize = false;
for dock in self.all_docks() {
if let Some(panel_index) = dock.read(cx).panel_index_for_type::<T>() {
let mut focus_center = false;
let panel = dock.update(cx,... |
rust_dataset_chunk_507641 | rust_dataset.txt | 507,641 | 512 | {
dock.update(cx, |dock, cx| {
if dock.panel::<T>().is_some() {
dock.set_open(false, window, cx)
}
})
}
}
pub fn panel<T: Panel>(&self, cx: &App) -> Option<Entity<T>> {
self.all_docks()
.iter()
... |
rust_dataset_chunk_507642 | rust_dataset.txt | 507,642 | 512 | _to_reveal {
self.zoomed = None;
self.zoomed_position = None;
cx.emit(Event::ZoomChanged);
}
cx.notify();
}
fn add_pane(&mut self, window: &mut Window, cx: &mut Context<Self>) -> Entity<Pane> {
let pane = cx.new(|cx| {
let mut pane = Pane... |
rust_dataset_chunk_507643 | rust_dataset.txt | 507,643 | 512 | ,
window,
cx,
)
});
}
pub fn split_item(
&mut self,
split_direction: SplitDirection,
item: Box<dyn ItemHandle>,
window: &mut Window,
cx: &mut Context<Self>,
) {
let new_pane = self.split_pane(self.active_pan... |
rust_dataset_chunk_507644 | rust_dataset.txt | 507,644 | 512 | a pane explicitly limits reuse and opening to
/// that pane.
pub fn open_path(
&mut self,
path: impl Into<ProjectPath>,
pane: Option<WeakEntity<Pane>>,
focus_item: bool,
window: &mut Window,
cx: &mut App,
) -> Task<anyhow::Result<Box<dyn ItemHandle>>> {
... |
rust_dataset_chunk_507645 | rust_dataset.txt | 507,645 | 512 | -> Option<Entity<Pane>> {
let pane_contains_project_item = |pane: &Entity<Pane>| {
pane.read(cx).items().any(|item| {
if item.buffer_kind(cx) != ItemBufferKind::Singleton {
return false;
}
if let Some(project_entry_id) = project_e... |
rust_dataset_chunk_507646 | rust_dataset.txt | 507,646 | 512 | let mut open_abs_path = |this: &mut Self, path, cx: &mut _| {
let url_or_path = url_or_path.to_owned();
let task = this.open_abs_path(
path,
OpenOptions {
visible: Some(OpenVisible::None),
..Default::default()
... |
rust_dataset_chunk_507647 | rust_dataset.txt | 507,647 | 512 | if task.await.is_err() {
cx.update(|cx| cx.open_url(&url_or_path));
}
})
.detach();
return;
}
// Couldn't resolve as a file path - try opening as URL anyway
// (the OS might be able to ha... |
rust_dataset_chunk_507648 | rust_dataset.txt | 507,648 | 512 | <()> {
if WorkspaceSettings::get_global(cx).on_new_window != settings::OnNewWindow::Readme
|| self.items(cx).next().is_some()
{
return Task::ready(());
}
let project = self.project.clone();
let mut candidates = Vec::new();
for worktree in project.... |
rust_dataset_chunk_507649 | rust_dataset.txt | 507,649 | 512 | workspace.items(cx).next().is_some()
|| project.read(cx).worktree_for_id(worktree_id, cx).is_none()
{
return;
}
let Some(pane) = pane.upgrade() else {
return;
... |
rust_dataset_chunk_507650 | rust_dataset.txt | 507,650 | 512 | let reveal_if_open = pane.is_none() && WorkspaceSettings::get_global(cx).reveal_if_open;
let requested_pane = pane.unwrap_or_else(|| self.active_pane.clone());
let existing_item = self
.find_project_item(&requested_pane, &project_item, cx)
.map(|item| (requested_pane.clon... |
rust_dataset_chunk_507651 | rust_dataset.txt | 507,651 | 512 | pub fn open_shared_screen(
&mut self,
peer_id: PeerId,
window: &mut Window,
cx: &mut Context<Self>,
) {
if let Some(shared_screen) =
self.shared_screen_for_peer(peer_id, &self.active_pane, window, cx)
{
self.active_pane.update(cx, |pane, cx| {... |
rust_dataset_chunk_507652 | rust_dataset.txt | 507,652 | 512 | next_watched_peer = if should_watch_peer {
Some(peer_id)
} else {
self.next_watched_peer(cx)
};
self.auto_watch = AutoWatch::Active {
watched_peer: next_watched_peer,
};
if let Some(next_watched_peer) = next_w... |
rust_dataset_chunk_507653 | rust_dataset.txt | 507,653 | 512 | .destination) {
Some(&destination) => destination.clone(),
None => {
if !action.clone && self.active_pane.read(cx).items_len() < 2 {
return;
}
let direction = SplitDirection::Right;
let split_off_pane = self
... |
rust_dataset_chunk_507654 | rust_dataset.txt | 507,654 | 512 | &mut self,
direction: SplitDirection,
window: &mut Window,
cx: &mut App,
) {
use ActivateInDirectionTarget as Target;
enum Origin {
Sidebar,
LeftDock,
RightDock,
BottomDock,
Center,
}
let origin: Or... |
rust_dataset_chunk_507655 | rust_dataset.txt | 507,655 | 512 | if dir == away_from_sidebar => try_dock(near_dock)
.or_else(|| get_last_active_pane().map(Target::Pane))
.or_else(|| try_dock(&self.bottom_dock))
.or_else(|| try_dock(far_dock)),
(Origin::Sidebar, _) => None,
// We're in the center, so we first ... |
rust_dataset_chunk_507656 | rust_dataset.txt | 507,656 | 512 | );
if sidebar_on_right {
dock_target.or(sidebar_target)
} else {
dock_target
}
}
(Origin::RightDock, SplitDirection::Left) => {
if let Some(last_active_pane) = get_last_active_pane() {
... |
rust_dataset_chunk_507657 | rust_dataset.txt | 507,657 | 512 | new_pane
}
};
if action.clone {
if self
.active_pane
.read(cx)
.active_item()
.is_some_and(|item| item.can_split(cx))
{
clone_active_item(
self.database_id(),
... |
rust_dataset_chunk_507658 | rust_dataset.txt | 507,658 | 512 | _bottom_dock(panel_size + amount, window, cx),
DockPosition::Right => self.resize_right_dock(panel_size + amount, window, cx),
}
} else {
self.center
.resize(&self.active_pane, axis, amount, &self.bounds);
}
cx.notify();
}
pub fn r... |
rust_dataset_chunk_507659 | rust_dataset.txt | 507,659 | 512 | , cx);
if pane.read(cx).is_zoomed() {
self.zoomed = Some(pane.downgrade().into());
} else {
self.zoomed = None;
}
self.zoomed_position = None;
cx.emit(Event::ZoomChanged);
self.update_active_view_for_followers(window, cx);
pane.update(cx, |... |
rust_dataset_chunk_507660 | rust_dataset.txt | 507,660 | 512 | EmptyPane => {
self.split_pane(pane.clone(), *direction, window, cx);
}
SplitMode::MovePane => {
self.split_and_move(pane.clone(), *direction, window, cx);
}
};
}
pane::Eve... |
rust_dataset_chunk_507661 | rust_dataset.txt | 507,661 | 512 | anes_by_item.entry(item.item_id())
&& entry.get().entity_id() == pane.entity_id()
{
entry.remove();
}
cx.emit(Event::ItemRemoved {
item_id: item.item_id(),
});
}
pane::Even... |
rust_dataset_chunk_507662 | rust_dataset.txt | 507,662 | 512 | | pane.take_active_item(window, cx)) else {
return;
};
let new_pane = self.add_pane(window, cx);
new_pane.update(cx, |pane, cx| {
pane.add_item(item, true, true, None, window, cx)
});
self.center.split(&pane, &new_pane, direction);
cx.notify();
... |
rust_dataset_chunk_507663 | rust_dataset.txt | 507,663 | 512 | ane_in_direction(SplitDirection::Down, cx))
.or_else(|| self.find_pane_in_direction(SplitDirection::Left, cx))
.or_else(|| self.find_pane_in_direction(SplitDirection::Up, cx));
let Some(next_pane) = next_pane else {
return;
};
move_all_items(&pane, &next_pane,... |
rust_dataset_chunk_507664 | rust_dataset.txt | 507,664 | 512 | _of(&self.active_pane.clone(), window, cx)
}
pub fn adjacent_pane_of(
&mut self,
origin: &Entity<Pane>,
window: &mut Window,
cx: &mut Context<Self>,
) -> Entity<Pane> {
self.center
.find_pane_in_direction(origin, SplitDirection::Right, cx)
.cl... |
rust_dataset_chunk_507665 | rust_dataset.txt | 507,665 | 512 | items_by_leader_view_id: Default::default(),
},
);
cx.notify();
match leader_id {
CollaboratorId::PeerId(leader_peer_id) => {
let room_id = self.active_call()?.room_id(cx)?;
let project_id = self.project.read(cx).remote_id(... |
rust_dataset_chunk_507666 | rust_dataset.txt | 507,666 | 512 | {
None
}
}
CollaboratorId::Agent => Some(CollaboratorId::Agent),
}
} else {
None
};
let pane = self.active_pane.clone();
let Some(leader_id) = next_leader_id.or_else(|| {
Som... |
rust_dataset_chunk_507667 | rust_dataset.txt | 507,667 | 512 | // Otherwise, follow.
if let Some(task) = self.start_following(leader_id, window, cx) {
task.detach_and_log_err(cx)
}
}
pub fn unfollow(
&mut self,
leader_id: impl Into<CollaboratorId>,
window: &mut Window,
cx: &mut Context<Self>,
) -> Option<()>... |
rust_dataset_chunk_507668 | rust_dataset.txt | 507,668 | 512 | });
}
if active_project_path_changed {
match active_entry.as_ref() {
None => self.last_active_project_path = None,
Some(path)
if !self.is_deleted_history_path(path, cx)
&& self.remember_navigation_histor... |
rust_dataset_chunk_507669 | rust_dataset.txt | 507,669 | 512 | .as_str()) != (template, separator)
},
);
if settings_changed {
self.last_window_title_settings = Some((template.to_string(), separator.to_string()));
}
let needs = WindowTitleNeeds::from_template(template);
let context =
Self::window_title_con... |
rust_dataset_chunk_507670 | rust_dataset.txt | 507,670 | 512 | file_name()
.map(|file_name| file_name.to_string())
.or_else(|| {
Some(
project
.worktree_for_id(project_path.worktree_id, cx)?
.read(cx)
... |
rust_dataset_chunk_507671 | rust_dataset.txt | 507,671 | 512 | window, bypassing the change-detection caches.
///
/// Several workspaces can share a single platform window (a multi-workspace
/// window). The `last_window_title`/`window_edited` caches assume the
/// window's title and edited state reflect *this* workspace, but after the
/// active workspace cha... |
rust_dataset_chunk_507672 | rust_dataset.txt | 507,672 | 512 | _id, s);
self.update_window_edited(window, cx);
}
fn render_notifications(&self, _window: &mut Window, _cx: &mut Context<Self>) -> Option<Div> {
if self.notifications.is_empty() {
None
} else {
Some(
div()
.absolute()
... |
rust_dataset_chunk_507673 | rust_dataset.txt | 507,673 | 512 | ().collect(),
active_view,
}
}
fn handle_update_followers(
&mut self,
leader_id: PeerId,
message: proto::UpdateFollowers,
_window: &mut Window,
_cx: &mut Context<Self>,
) {
self.leader_updates_tx
.unbounded_send((leader_id, mes... |
rust_dataset_chunk_507674 | rust_dataset.txt | 507,674 | 512 | let mut tasks = Vec::new();
this.update_in(cx, |this, window, cx| {
let project = this.project.clone();
if let Some(state) = this.follower_states.get(&leader_id.into()) {
let view_id = ViewId::from_proto(id)?;
if le... |
rust_dataset_chunk_507675 | rust_dataset.txt | 507,675 | 512 | (task) = task else {
anyhow::bail!(
"failed to construct view from leader (maybe from a different version of zed?)"
);
};
let mut new_item = task.await?;
pane.update_in(cx, |pane, window, cx| {
let mut item_to_remov... |
rust_dataset_chunk_507676 | rust_dataset.txt | 507,676 | 512 | => {
let existing_view =
follower_state
.center_pane
.read(cx)
.items()
.find_map(|item| {
let item = item.to_followable_item_handl... |
rust_dataset_chunk_507677 | rust_dataset.txt | 507,677 | 512 | ) = id
&& let Some(variant) = item.to_state_proto(window, cx)
{
let view = Some(proto::View {
id,
leader_id: leader_peer_id,
variant: Some(variant),
... |
rust_dataset_chunk_507678 | rust_dataset.txt | 507,678 | 512 | |store, cx| {
store.update_followers(project_id, update, cx)
})
}
pub fn leader_for_pane(&self, pane: &Entity<Pane>) -> Option<CollaboratorId> {
self.follower_states.iter().find_map(|(leader_id, state)| {
if state.center_pane == *pane || state.dock_pane.as_ref() == Some... |
rust_dataset_chunk_507679 | rust_dataset.txt | 507,679 | 512 | {
let state = self.follower_states.get(&CollaboratorId::Agent)?;
let active_view_id = state.active_view_id?;
Some(
state
.items_by_leader_view_id
.get(&active_view_id)?
.view
.boxed_clone(),
)
}
fn acti... |
rust_dataset_chunk_507680 | rust_dataset.txt | 507,680 | 512 | .is_window_active() {
if let Some(database_id) = self.database_id {
let db = WorkspaceDb::global(cx);
cx.background_spawn(async move { db.update_timestamp(database_id).await })
.detach();
}
} else {
// When window is deactiv... |
rust_dataset_chunk_507681 | rust_dataset.txt | 507,681 | 512 | self) -> Option<WorkspaceId> {
self.database_id
}
#[cfg(any(test, feature = "test-support"))]
pub(crate) fn set_database_id(&mut self, id: WorkspaceId) {
self.database_id = Some(id);
}
pub fn session_id(&self) -> Option<String> {
self.session_id.clone()
}
fn save_w... |
rust_dataset_chunk_507682 | rust_dataset.txt | 507,682 | 512 | items.entry(item.item_id()).or_insert(item);
items
});
let item_tasks = serializable_items
.into_values()
.filter_map(|item| {
let item_id = item.item_id();
let task = item.serialize(self, false, cx)?;
Some(asyn... |
rust_dataset_chunk_507683 | rust_dataset.txt | 507,683 | 512 | Member::Axis(PaneAxis { members, .. }) => {
for child in members.iter() {
self.remove_panes(child.clone(), window, cx)
}
}
Member::Pane(pane) => {
self.force_remove_pane(&pane, &None, window, cx);
}
}
}
... |
rust_dataset_chunk_507684 | rust_dataset.txt | 507,684 | 512 | ) = self.database_id() else {
return Task::ready(());
};
fn build_serialized_pane_group(
pane_group: &Member,
window: &mut Window,
cx: &mut App,
) -> SerializedPaneGroup {
match pane_group {
Member::Axis(PaneAxis {
... |
rust_dataset_chunk_507685 | rust_dataset.txt | 507,685 | 512 | (paths.is_empty()
&& location == SerializedWorkspaceLocation::Local)
.then(|| docks.clone());
let window_bounds = Some(SerializedWindowBounds(window.window_bounds()));
let identity_paths_hint = self.project_group_key(cx).path_list().clone();
... |
rust_dataset_chunk_507686 | rust_dataset.txt | 507,686 | 512 | HistoryManager::global(cx) {
let paths = PathList::new(&self.root_paths(cx));
manager.update(cx, |this, cx| {
this.update_history(id, HistoryManagerEntry::new(id, &paths), cx);
});
}
}
async fn serialize_items(
this: &WeakEntity<Self>,
... |
rust_dataset_chunk_507687 | rust_dataset.txt | 507,687 | 512 | _group = None;
let mut center_items = None;
// Traverse the splits tree and add to things
if let Some((group, active_pane, items)) = serialized_workspace
.center_group
.deserialize(&project, serialized_workspace.id, workspace.clone(), cx)
... |
rust_dataset_chunk_507688 | rust_dataset.txt | 507,688 | 512 | );
}
});
items_opened_while_restoring.extend(items);
}
workspace.remove_panes(workspace.center.root.clone(), window, cx);
// Swap workspace center group
workspace.... |
rust_dataset_chunk_507689 | rust_dataset.txt | 507,689 | 512 | , cx);
});
}
workspace.restoring_workspace.set(false);
cx.notify();
})?;
project
.update(cx, |project, cx| {
project.bookmark_store().update(cx, |bookmark_store, cx| {
... |
rust_dataset_chunk_507690 | rust_dataset.txt | 507,690 | 512 |
.as_ref()
.and_then(|provider| provider.active_thread_state(cx))
{
match status {
ThreadStatus::Running | ThreadStatus::Stepping => {
context.add("debugger_running");
}
ThreadStatus::Stopped => context.add("... |
rust_dataset_chunk_507691 | rust_dataset.txt | 507,691 | 512 | ))
.on_action(cx.listener(Self::save_all))
.on_action(cx.listener(Self::send_keystrokes))
.on_action(cx.listener(Self::add_folder_to_project))
.on_action(cx.listener(Self::follow_next_collaborator))
.on_action(cx.listener(Self::activate_pane_at_index))
... |
rust_dataset_chunk_507692 | rust_dataset.txt | 507,692 | 512 | , cx| {
workspace.activate_next_pane(window, cx)
}))
.on_action(cx.listener(|workspace, _: &ActivateLastPane, window, cx| {
workspace.activate_last_pane(window, cx)
}))
.on_action(cx.listener(|workspace, _: &FocusNextPart, window, cx| {
... |
rust_dataset_chunk_507693 | rust_dataset.txt | 507,693 | 512 | .swap_pane_in_direction(SplitDirection::Down, cx)
}))
.on_action(cx.listener(|workspace, _: &SwapPaneAdjacent, window, cx| {
const DIRECTION_PRIORITY: [SplitDirection; 4] = [
SplitDirection::Down,
SplitDirection::Up,
Spl... |
rust_dataset_chunk_507694 | rust_dataset.txt | 507,694 | 512 | on_action(cx.listener(
|workspace: &mut Workspace, _: &ClearAllNotifications, _, cx| {
workspace.clear_all_notifications(cx);
},
))
.on_action(cx.listener(
|workspace: &mut Workspace, _: &ClearNavigationHistory, window, cx| {
... |
rust_dataset_chunk_507695 | rust_dataset.txt | 507,695 | 512 | }
},
))
.on_action(cx.listener(
|workspace: &mut Workspace, _: &ResetPaneSizes, _window, cx| {
workspace.reset_pane_sizes(cx);
},
))
.on_action(cx.listener(
|workspace:... |
rust_dataset_chunk_507696 | rust_dataset.txt | 507,696 | 512 | ) = recent_pane {
let wrap_around = action.wrap_around;
pane.update(cx, |pane, cx| {
let current_index = pane.active_item_index();
let items_len = pane.items_len();
... |
rust_dataset_chunk_507697 | rust_dataset.txt | 507,697 | 512 | (cx);
if let Some(active_panel) = dock.active_panel() {
if active_panel.pane(cx).is_none() {
let active_pane = workspace.active_pane().clone();
active_pane.update(cx, |pane, cx| {
... |
rust_dataset_chunk_507698 | rust_dataset.txt | 507,698 | 512 | register_action<A: Action>(
&mut self,
callback: impl Fn(&mut Self, &A, &mut Window, &mut Context<Self>) + 'static,
) -> &mut Self {
let callback = Arc::new(callback);
self.workspace_actions.push(Box::new(move |div, _, _, cx| {
let callback = callback.clone();
... |
rust_dataset_chunk_507699 | rust_dataset.txt | 507,699 | 512 | pub fn hide_modal(&mut self, window: &mut Window, cx: &mut App) -> bool {
self.modal_layer
.update(cx, |modal_layer, cx| modal_layer.hide_modal(window, cx))
}
fn reopen_last_picker(
&mut self,
_: &ReopenLastPicker,
window: &mut Window,
cx: &mut Context<Self>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.