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_507500 | rust_dataset.txt | 507,500 | 512 | }
#[gpui::test]
async fn test_recent_project_workspaces_remote_paths_do_not_use_local_fs_identity(
cx: &mut gpui::TestAppContext,
) {
let fs = fs::FakeFs::new(cx.executor());
let db = WorkspaceDb::open_test_db(
"test_recent_project_workspaces_remote_paths_do_not_use_... |
rust_dataset_chunk_507501 | rust_dataset.txt | 507,501 | 512 | 00:00:01".to_owned())
.await
.unwrap();
let recents = db.recent_project_workspaces(fs.as_ref()).await.unwrap();
assert_eq!(recents.len(), 2);
assert_eq!(recents[0].workspace_id, WorkspaceId(2));
assert_eq!(recents[1].workspace_id, WorkspaceId(1));
}
#[g... |
rust_dataset_chunk_507502 | rust_dataset.txt | 507,502 | 512 | ();
assert_eq!(recents.len(), 1);
let deleted = db
.delete_recent_workspace_group(&recents[0], fs.as_ref())
.await
.unwrap();
assert_eq!(deleted, vec![WorkspaceId(2), WorkspaceId(1)]);
let recents = db.recent_project_workspaces(fs.as_ref()).await.unw... |
rust_dataset_chunk_507503 | rust_dataset.txt | 507,503 | 512 | : Some(PathList::new(&[path!("/repo")])),
..workspace_with(
2,
&[Path::new(path!("/repo/.delta/worktrees/b/repo"))],
empty_pane_group(),
None,
)
})
.await;
db.set_timestamp_for_tests(WorkspaceId(1), "2024-01-... |
rust_dataset_chunk_507504 | rust_dataset.txt | 507,504 | 512 | ",
"worktrees": {
"feature": {
"commondir": "../../",
"HEAD": "ref: refs/heads/feature"
}
}
},
"src": { "main.rs": "" }
}),
... |
rust_dataset_chunk_507505 | rust_dataset.txt | 507,505 | 512 | .run_until_parked();
let active_db_id = workspace_worktree.read_with(cx, |ws, _| ws.database_id());
assert!(
active_db_id.is_some(),
"Active workspace should have a database ID"
);
// --- Phase 2: Read back and verify the serialized state ---
let sessio... |
rust_dataset_chunk_507506 | rust_dataset.txt | 507,506 | 512 | ized_mw, app_state, &mut cx).await
})
})
.await
.expect("restore_multiworkspace should succeed");
cx.run_until_parked();
// The restored window should have the same project group keys.
let restored_keys: Vec<ProjectGroupKey> = restored_handle... |
rust_dataset_chunk_507507 | rust_dataset.txt | 507,507 | 512 | mw, cx| mw.open_sidebar(cx));
let workspace_b = multi_workspace.update_in(cx, |mw, window, cx| {
mw.test_add_workspace(project_b.clone(), window, cx)
});
let _workspace_c = multi_workspace.update_in(cx, |mw, window, cx| {
mw.test_add_workspace(project_c.clone(), window, ... |
rust_dataset_chunk_507508 | rust_dataset.txt | 507,508 | 512 | | {
mw.remove_project_group(&key_a, window, cx)
.detach_and_log_err(cx);
});
cx.run_until_parked();
let active_paths =
multi_workspace.read_with(cx, |mw, cx| mw.workspace().read(cx).root_paths(cx));
assert_eq!(
active_paths
... |
rust_dataset_chunk_507509 | rust_dataset.txt | 507,509 | 512 | cx));
multi_workspace.update(cx, |mw, cx| mw.open_sidebar(cx));
let workspace_b = multi_workspace.update_in(cx, |mw, window, cx| {
mw.test_add_workspace(project_b.clone(), window, cx)
});
cx.run_until_parked();
// workspace_a is first in the workspaces vec.
... |
rust_dataset_chunk_507510 | rust_dataset.txt | 507,510 | 512 | #[default]
Next,
}
impl Direction {
pub fn opposite(&self) -> Self {
match self {
Direction::Prev => Direction::Next,
Direction::Next => Direction::Prev,
}
}
}
#[derive(Clone, Copy, Debug, Default)]
pub struct SearchOptions {
pub case: bool,
pub word: bo... |
rust_dataset_chunk_507511 | rust_dataset.txt | 507,511 | 512 | ,
cx: &mut Context<Self>,
);
fn query_suggestion(
&mut self,
seed_query_override: Option<SeedQuerySetting>,
window: &mut Window,
cx: &mut Context<Self>,
) -> String;
fn activate_match(
&mut self,
index: usize,
matches: &[Self::Match],
... |
rust_dataset_chunk_507512 | rust_dataset.txt | 507,512 | 512 | .await, SearchToken::default()))
}
fn active_match_index(
&mut self,
direction: Direction,
matches: &[Self::Match],
token: SearchToken,
window: &mut Window,
cx: &mut Context<Self>,
) -> Option<usize>;
fn set_select_search_options(&mut self, _: Option<Sele... |
rust_dataset_chunk_507513 | rust_dataset.txt | 507,513 | 512 | Send>,
current_index: usize,
direction: Direction,
count: usize,
token: SearchToken,
window: &mut Window,
cx: &mut App,
) -> usize;
fn find_matches(
&self,
query: Arc<SearchQuery>,
window: &mut Window,
cx: &mut App,
) -> Task<A... |
rust_dataset_chunk_507514 | rust_dataset.txt | 507,514 | 512 | Token,
window: &mut Window,
cx: &mut App,
) {
let matches = matches.downcast_ref().unwrap();
self.update(cx, |this, cx| {
this.update_matches(matches.as_slice(), active_match_index, token, window, cx)
});
}
fn query_suggestion(
&self,
seed_... |
rust_dataset_chunk_507515 | rust_dataset.txt | 507,515 | 512 | Match>(matches.len());
{
let mut any_matches = any_matches.downcast_mut::<T::Match>().unwrap();
for mat in matches {
any_matches.push(mat);
}
}
any_matches
})
}
fn find_matches_with_token(
&se... |
rust_dataset_chunk_507516 | rust_dataset.txt | 507,516 | 512 | : bool, window: &mut Window, cx: &mut App) {
self.update(cx, |this, cx| {
this.search_bar_visibility_changed(visible, window, cx)
});
}
fn toggle_filtered_search_ranges(
&mut self,
enabled: Option<FilteredSearchRange>,
window: &mut Window,
cx: &mut Ap... |
rust_dataset_chunk_507517 | rust_dataset.txt | 507,517 | 512 | for managing the [`TrustedWorktrees`] data.
use std::{
borrow::Cow,
path::{Path, PathBuf},
sync::Arc,
};
use collections::{HashMap, HashSet};
use gpui::{
DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, ScrollHandle, Task, WeakEntity,
};
use project::{
WorktreeId,
trusted_worktree... |
rust_dataset_chunk_507518 | rust_dataset.txt | 507,518 | 512 | .values()
.map(|restricted_path| restricted_path.abs_path.clone())
.collect::<Vec<_>>();
WorkspaceDb::global(cx)
.keep_worktrees_restricted(abs_paths, self.remote_host.clone());
DismissDecision::Dismiss(true)
}
... |
rust_dataset_chunk_507519 | rust_dataset.txt | 507,519 | 512 | (Color::Warning))
.child(Label::new(header_label)),
)
.child(
div()
.size_full()
.vertical_scrollbar_for(&self.project_list_scroll_handle, window, cx)
... |
rust_dataset_chunk_507520 | rust_dataset.txt | 507,520 | 512 |
// grows downward without shifting the checkbox;
// the checkbox sits in a fixed-height box matching
// the input row.
h_flex()
.items_start()
... |
rust_dataset_chunk_507521 | rust_dataset.txt | 507,521 | 512 | .map(|kb| kb.size(rems_from_px(12_f32))),
)
.on_click(cx.listener(move |security_modal, _, _, cx| {
security_modal.trust_and_dismiss(cx);
cx.stop_propagation();
... |
rust_dataset_chunk_507522 | rust_dataset.txt | 507,522 | 512 | |= restricted_path.is_file;
!restricted_path.is_file
})
.filter_map(|restricted_path| path_style.parent(&restricted_path.abs_path))
.collect::<SmallVec<[_; 2]>>();
match available_parents.len() {
0 => {
if has_restricted_files {
... |
rust_dataset_chunk_507523 | rust_dataset.txt | 507,523 | 512 | => scope,
Err(error) => {
// Invalid path: flag the field and keep the modal open.
self.trust_path_input
.update(cx, |input, cx| input.set_error(Some(error), cx));
return;
}
};
if let Some((trusted_worktrees, w... |
rust_dataset_chunk_507524 | rust_dataset.txt | 507,524 | 512 | let only = projects.next()?;
projects.next().is_none().then_some(only)
}
pub fn refresh_restricted_paths(&mut self, cx: &mut Context<Self>) {
if let Some(trusted_worktrees) = TrustedWorktrees::try_get_global(cx) {
if let Some(worktree_store) = self.worktree_store.upgrade() {... |
rust_dataset_chunk_507525 | rust_dataset.txt | 507,525 | 512 | be relative to the home directory".into());
}
path_style.join(home_dir, Path::new(rest))
}
_ => PathBuf::from(trimmed),
};
if !path_style.is_absolute(&expanded) {
return Err("Enter an absolute folder path".into());
}
if !path_style.starts_with(project, e... |
rust_dataset_chunk_507526 | rust_dataset.txt | 507,526 | 512 | style).is_ok());
}
#[test]
fn rejects_non_ancestor_relative_or_empty() {
let project = Path::new("/Users/me/dev/delta/wt/t1");
let style = PathStyle::Unix;
assert!(validate_trust_scope("/Users/other", project, None, style).is_err());
assert!(validate_trust_scope("relative/p... |
rust_dataset_chunk_507527 | rust_dataset.txt | 507,527 | 512 | _err());
// A prefix that is not a component boundary is not an ancestor.
assert!(
validate_trust_scope(
r"C:\Users\me\dev\wt",
Path::new(r"C:\Users\me\dev\wt2"),
None,
style,
)
.is_err()
);
... |
rust_dataset_chunk_507528 | rust_dataset.txt | 507,528 | 512 | Some(2222)),
] {
let options = RemoteConnectionOptions::Ssh(SshConnectionOptions {
host: host.into(),
username: username.map(String::from),
port,
..SshConnectionOptions::default()
});
let RemoteConnectionOptions... |
rust_dataset_chunk_507529 | rust_dataset.txt | 507,529 | 512 | Option<SharedString> {
Some(format!("{}'s screen", self.user.username).into())
}
fn deactivated(&mut self, _window: &mut Window, cx: &mut Context<Self>) {
if let Some(nav_history) = self.nav_history.as_mut() {
nav_history.push::<()>(None, None, cx);
}
}
fn tab_icon... |
rust_dataset_chunk_507530 | rust_dataset.txt | 507,530 | 512 | ;
use theme::CLIENT_SIDE_DECORATION_ROUNDING;
use ui::{ContextMenu, Divider, IconPosition, Indicator, Tooltip, prelude::*, right_click_menu};
/// Describes how a status-bar item can be hidden by the user.
///
/// Every [`StatusItemView`] must either provide this (so that the user gets a
/// "Hide Button" entry in the ... |
rust_dataset_chunk_507531 | rust_dataset.txt | 507,531 | 512 | hide_setting(&self, cx: &App) -> Option<HideStatusItem>;
}
#[derive(Default)]
struct SidebarStatus {
open: bool,
side: SidebarSide,
has_notifications: bool,
show_toggle: bool,
}
impl SidebarStatus {
fn query(multi_workspace: &Option<WeakEntity<MultiWorkspace>>, cx: &App) -> Self {
multi_w... |
rust_dataset_chunk_507532 | rust_dataset.txt | 507,532 | 512 | _focus(true, window, cx);
cx.stop_propagation();
}
"left" => {
status_bar.move_item_focus(false, window, cx);
cx.stop_propagation();
}
_ => ... |
rust_dataset_chunk_507533 | rust_dataset.txt | 507,533 | 512 | _sidebar_toggle(sidebar, cx)),
)
.children(self.left_items.iter().enumerate().map(|(index, item)| {
render_hideable_item("status-bar-left", index, item.as_ref(), cx)
}))
}
fn render_right_tools(
&self,
sidebar: &SidebarStatus,
cx: &mut... |
rust_dataset_chunk_507534 | rust_dataset.txt | 507,534 | 512 | {
multi_workspace.update(cx, |multi_workspace, cx| {
multi_workspace.toggle_sidebar(window, cx);
});
}
})
});
h_flex()
.gap_0p5()
.when(on_right, |this| {
... |
rust_dataset_chunk_507535 | rust_dataset.txt | 507,535 | 512 | _multi_workspace(
&mut self,
multi_workspace: WeakEntity<MultiWorkspace>,
cx: &mut Context<Self>,
) {
self.multi_workspace = Some(multi_workspace);
cx.notify();
}
pub fn add_left_item<T>(&mut self, item: Entity<T>, window: &mut Window, cx: &mut Context<Self>)
whe... |
rust_dataset_chunk_507536 | rust_dataset.txt | 507,536 | 512 | so
/// arrows move between items and stop at the ends (ARIA toolbar semantics);
/// Tab is still used to leave the toolbar.
fn move_item_focus(&mut self, forward: bool, window: &mut Window, cx: &mut Context<Self>) {
let previous = window.focused(cx);
if forward {
window.focus_ne... |
rust_dataset_chunk_507537 | rust_dataset.txt | 507,537 | 512 | type TaskCompletionHandler = Box<dyn FnOnce(ScheduledTaskResult, &mut AsyncWindowContext)>;
impl Workspace {
pub fn can_schedule_tasks(&self, cx: &App) -> bool {
match self.project.read(cx).remote_connection_state(cx) {
None | Some(ConnectionState::Connected) => true,
Some(
... |
rust_dataset_chunk_507538 | rust_dataset.txt | 507,538 | 512 | : bool,
on_complete: Option<TaskCompletionHandler>,
window: &mut Window,
cx: &mut Context<Workspace>,
) {
let spawn_in_terminal = resolved_task.resolved.clone();
if !omit_history {
if let Some(debugger_provider) = self.debugger_provider.as_ref() {
... |
rust_dataset_chunk_507539 | rust_dataset.txt | 507,539 | 512 | save_for_task(
workspace: &WeakEntity<Self>,
save_strategy: SaveStrategy,
cx: &mut AsyncWindowContext,
) {
let save_action = match save_strategy {
SaveStrategy::All => {
let save_all = workspace.update_in(cx, |workspace, window, cx| {
... |
rust_dataset_chunk_507540 | rust_dataset.txt | 507,540 | 512 | let worktree_id = worktree.read(cx).id();
trusted_worktrees.update(cx, |trusted_worktrees, cx| {
trusted_worktrees.can_trust(&worktree_store, worktree_id, cx)
})
});
}
let worktree_tasks: Vec<(WorktreeId, TaskContext, Vec<T... |
rust_dataset_chunk_507541 | rust_dataset.txt | 507,541 | 512 | let status = workspace.update_in(cx, |workspace, window, cx| {
workspace.spawn_in_terminal(resolved.resolved, window, cx)
})?;
if let Some(result) = status.await {
match result {
... |
rust_dataset_chunk_507542 | rust_dataset.txt | 507,542 | 512 | (cx, |workspace, window, cx| {
workspace.schedule_resolved_task(
TaskSourceKind::UserInput,
fixture.task,
false,
window,
cx,
);
});
cx.executor().run_until_parked();
// The active item (fixtu... |
rust_dataset_chunk_507543 | rust_dataset.txt | 507,543 | 512 | Item>(cx);
});
let fs = FakeFs::new(cx.executor());
fs.insert_tree("/root", json!({ "file.txt": "dirty" }))
.await;
let project = Project::test(fs.clone(), ["/root".as_ref()], cx).await;
let (workspace, cx) =
cx.add_window_view(|window, cx| Workspace::test... |
rust_dataset_chunk_507544 | rust_dataset.txt | 507,544 | 512 | cx| {
cx.spawn_in(window, {
let workspace = workspace.clone();
async move |_this, cx| {
Workspace::save_for_task(&workspace, SaveStrategy::All, cx).await;
}
})
.detach();
});
cx.run_until_parked();
... |
rust_dataset_chunk_507545 | rust_dataset.txt | 507,545 | 512 | ::SpawnInTerminal,
_window: &mut ui::Window,
cx: &mut App,
) -> Task<Option<Result<ExitStatus>>> {
*self.dirty_before_spawn.lock() = Some(cx.read_entity(&self.item, |e, _| e.is_dirty));
Task::ready(Some(Ok(ExitStatus::default())))
}
}
}
--- FILE: zed... |
rust_dataset_chunk_507546 | rust_dataset.txt | 507,546 | 512 | IntoElement {
match page {
ThemePreviewPage::Overview => self.render_overview_page(window, cx).into_any_element(),
ThemePreviewPage::Typography => {
self.render_typography_page(window, cx).into_any_element()
}
}
}
}
impl EventEmitter<()> for Them... |
rust_dataset_chunk_507547 | rust_dataset.txt | 507,547 | 512 | child(Headline::new("Headline Sizes").size(HeadlineSize::Small).color(Color::Muted))
.child(Headline::new("XLarge Headline").size(HeadlineSize::XLarge))
.child(Headline::new("Large Headline").size(HeadlineSize::Large))
.child(Headline::... |
rust_dataset_chunk_507548 | rust_dataset.txt | 507,548 | 512 | ast(
"Ignored Text",
Color::Ignored.color(cx),
))
.color(Color::Ignored),
)
.child(
Label::new(l... |
rust_dataset_chunk_507549 | rust_dataset.txt | 507,549 | 512 | , name)| {
let id = ElementId::Name(format!("{:?}-preview", color).into());
div().size_8().flex_none().child(
ButtonLike::new(id)
.child(
div()
... |
rust_dataset_chunk_507550 | rust_dataset.txt | 507,550 | 512 | ("theme-preview-typography")
.overflow_scroll()
.size_full()
.child(v_flex()
.gap_4()
.child(Headline::new("Headline 1").size(HeadlineSize::XLarge))
.child(Label::new("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eius... |
rust_dataset_chunk_507551 | rust_dataset.txt | 507,551 | 512 | ::preview_bg(window, cx))
.children(ThemePreviewPage::iter().map(|p| {
Button::new(ElementId::Name(p.name().into()), p.name())
.on_click(cx.listener(move |this, _, window, cx| {
this.current_page = p;
cx.notify();
... |
rust_dataset_chunk_507552 | rust_dataset.txt | 507,552 | 512 | });
})
.detach();
}
pub trait ToastView: ManagedView {
fn action(&self) -> Option<ToastAction>;
fn auto_dismiss(&self) -> bool {
true
}
}
#[derive(Clone)]
pub struct ToastAction {
pub id: ElementId,
pub label: SharedString,
pub on_click: Option<Rc<dyn Fn(&mut Window, &mut App... |
rust_dataset_chunk_507553 | rust_dataset.txt | 507,553 | 512 | (cx).action();
let auto_dismiss = new_toast.read(cx).auto_dismiss();
let focus_handle = cx.focus_handle();
self.active_toast = Some(ActiveToast {
_subscriptions: [cx.subscribe(&new_toast, |this, _, _: &DismissEvent, cx| {
this.hide_toast(cx);
})],
... |
rust_dataset_chunk_507554 | rust_dataset.txt | 507,554 | 512 | .start_dismiss_timer(duration, cx);
}
/// Clears the dismiss timer if one exists
pub fn clear_dismiss_timer(&mut self, cx: &mut Context<Self>) {
self.dismiss_timer.take();
cx.notify();
}
}
impl Render for ToastLayer {
fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> ... |
rust_dataset_chunk_507555 | rust_dataset.txt | 507,555 | 512 | Location),
}
pub trait ToolbarItemView: Render + EventEmitter<ToolbarItemEvent> {
fn set_active_pane_item(
&mut self,
active_pane_item: Option<&dyn crate::ItemHandle>,
window: &mut Window,
cx: &mut Context<Self>,
) -> ToolbarItemLocation;
fn pane_focus_update(
&mut ... |
rust_dataset_chunk_507556 | rust_dataset.txt | 507,556 | 512 | {
self.items.iter().rev().filter_map(|(item, location)| {
if *location == ToolbarItemLocation::Secondary {
Some(item.as_ref())
} else {
None
}
})
}
}
impl Render for Toolbar {
fn render(&mut self, _window: &mut Window, cx: &mu... |
rust_dataset_chunk_507557 | rust_dataset.txt | 507,557 | 512 | &mut Window, cx: &mut Context<Self>)
where
T: 'static + ToolbarItemView,
{
let location = item.set_active_pane_item(self.active_item.as_deref(), window, cx);
cx.subscribe(&item, |this, item, event, cx| {
if let Some((_, current_location)) = this
.items
... |
rust_dataset_chunk_507558 | rust_dataset.txt | 507,558 | 512 | ViewHandle for Entity<T> {
fn id(&self) -> EntityId {
self.entity_id()
}
fn to_any(&self) -> AnyView {
self.clone().into()
}
fn set_active_pane_item(
&self,
active_pane_item: Option<&dyn ItemHandle>,
window: &mut Window,
cx: &mut App,
) -> Toolba... |
rust_dataset_chunk_507559 | rust_dataset.txt | 507,559 | 512 | title: SharedString,
}
impl SectionHeader {
fn new(title: impl Into<SharedString>) -> Self {
Self {
title: title.into(),
}
}
}
impl RenderOnce for SectionHeader {
fn render(self, _window: &mut Window, cx: &mut App) -> impl IntoElement {
h_flex()
.px_1()
... |
rust_dataset_chunk_507560 | rust_dataset.txt | 507,560 | 512 | , cx| {
self.focus_handle.dispatch_action(&*self.action, window, cx)
})
}
}
enum SectionVisibility {
Always,
}
impl SectionVisibility {
fn is_visible(&self) -> bool {
match self {
SectionVisibility::Always => true,
}
}
}
struct SectionEntry {
... |
rust_dataset_chunk_507561 | rust_dataset.txt | 507,561 | 512 | static str,
entries: [SectionEntry; COLS],
}
impl<const COLS: usize> Section<COLS> {
fn render(self, index_offset: usize, focus: &FocusHandle) -> impl IntoElement {
v_flex()
.min_w_full()
.child(SectionHeader::new(self.title))
.children(
self.entries
... |
rust_dataset_chunk_507562 | rust_dataset.txt | 507,562 | 512 | {
if let Some(recent_workspaces) = &self.recent_workspaces {
if let Some(workspace) = recent_workspaces.get(action.index) {
let is_local = matches!(workspace.location, SerializedWorkspaceLocation::Local);
if is_local {
let paths = workspace.paths... |
rust_dataset_chunk_507563 | rust_dataset.txt | 507,563 | 512 | 12_f32)),
)
.on_click(move |_, window, cx| {
focus.dispatch_action(&ToggleWorkspaceSidebar, window, cx);
focus.dispatch_action(&ToggleFocus, window, cx);
}),
)
}
fn render_recent_project_sect... |
rust_dataset_chunk_507564 | rust_dataset.txt | 507,564 | 512 | {
"Welcome to Zed"
};
h_flex()
.key_context("Welcome")
.track_focus(&self.focus_handle(cx))
.on_action(cx.listener(Self::select_previous))
.on_action(cx.listener(Self::select_next))
.on_action(cx.listener(Self::open_recent_project... |
rust_dataset_chunk_507565 | rust_dataset.txt | 507,565 | 512 | String {
"Welcome".into()
}
fn telemetry_event_text(&self) -> Option<&'static str> {
Some("New Welcome Page Opened")
}
fn show_toolbar(&self) -> bool {
false
}
fn to_item_events(event: &Self::Event, f: &mut dyn FnMut(crate::item::ItemEvent)) {
f(*event)
}
}... |
rust_dataset_chunk_507566 | rust_dataset.txt | 507,566 | 512 | use db::{
query,
sqlez::{domain::Domain, thread_safe_connection::ThreadSafeConnection},
sqlez_macros::sql,
};
pub struct WelcomePagesDb(ThreadSafeConnection);
impl Domain for WelcomePagesDb {
const NAME: &str = stringify!(WelcomePagesDb);
const MIGRATIONS: &[&str]... |
rust_dataset_chunk_507567 | rust_dataset.txt | 507,567 | 512 | ", "/home/user/api"]);
assert_eq!(project_name(&paths), "api, zed");
}
#[test]
fn test_project_name_root_path_filtered() {
// A bare root "/" has no file_name(), falls back to "Untitled"
let paths = PathList::new(&["/"]);
assert_eq!(project_name(&paths), "Untitled");
}
}... |
rust_dataset_chunk_507568 | rust_dataset.txt | 507,568 | 512 | }
impl ErrorAction {
pub fn new<A: Action + 'static>(label: impl Into<SharedString>, handler: A) -> Self {
Self {
label: label.into(),
icon: None,
tooltip: None,
handler: ErrorActionHandler::Action(Box::new(handler)),
}
}
/// Creates a dismis... |
rust_dataset_chunk_507569 | rust_dataset.txt | 507,569 | 512 | for String {
fn primary_message(&self) -> SharedString {
self.clone().into()
}
fn primary_action(&self) -> ErrorAction {
ErrorAction::dismiss()
}
fn severity(&self) -> ErrorSeverity {
ErrorSeverity::Critical
}
}
impl WorkspaceError for anyhow::Error {
fn primary_m... |
rust_dataset_chunk_507570 | rust_dataset.txt | 507,570 | 512 | sidebar_side_context_menu,
};
pub use path_list::{PathList, SerializedPathList};
pub use remote::RemoteConnectionIdentity;
pub use toast_layer::{ToastAction, ToastLayer, ToastView};
use agent_settings::AgentSettings;
use anyhow::{Context as _, Result, anyhow};
use client::{
ChannelId, Client, ErrorExt, Participan... |
rust_dataset_chunk_507571 | rust_dataset.txt | 507,571 | 512 | DockData, DockStructure, ItemId, MultiWorkspaceState, SerializedMultiWorkspace,
SerializedProjectGroup, SerializedWorkspaceLocation, SessionWorkspace,
},
read_serialized_multi_workspaces,
};
use persistence::{SerializedWindowBounds, model::SerializedWorkspace};
use postage::stream::Stream;
use project:... |
rust_dataset_chunk_507572 | rust_dataset.txt | 507,572 | 512 | StartupBehavior, StatusBarSettings, TabBarSettings, WorkspaceSettings,
closing_last_window_quits_app, observe_accessible_mode,
};
use zed_actions::{Spawn, feedback::FileBugReport, theme::ToggleMode};
use crate::{dock::PanelSizeState, item::ItemBufferKind, notifications::NotificationId};
use crate::{
persistenc... |
rust_dataset_chunk_507573 | rust_dataset.txt | 507,573 | 512 | self.remote_host.as_deref(),
"appName" => Some(self.app_name),
"branch" => self.branch.as_deref(),
// Unknown placeholders collapse like missing values so imported and
// native templates follow the same rendering rules.
_ => None,
}
}
}
fn parse... |
rust_dataset_chunk_507574 | rust_dataset.txt | 507,574 | 512 | _WINDOW_SIZE: LazyLock<Option<Size<Pixels>>> = LazyLock::new(|| {
env::var("ZED_WINDOW_SIZE")
.ok()
.as_deref()
.and_then(parse_pixel_size_env_var)
});
static ZED_WINDOW_POSITION: LazyLock<Option<Point<Pixels>>> = LazyLock::new(|| {
env::var("ZED_WINDOW_POSITION")
.ok()
... |
rust_dataset_chunk_507575 | rust_dataset.txt | 507,575 | 512 | last pane in the workspace.
ActivateLastPane,
/// Moves focus to the next major region of the window (editor, open
/// panels, status bar), cycling and wrapping around. Intended as a
/// discoverable, screen-reader-friendly way to navigate the window.
FocusNextPart,
/// ... |
rust_dataset_chunk_507576 | rust_dataset.txt | 507,576 | 512 | /// Formats and saves the current file, regardless of the format_on_save setting.
FormatAndSave,
/// Saves the current file with a new name.
SaveAs,
/// Saves without formatting.
SaveWithoutFormat,
/// Shuts down all debug adapters.
ShutdownDebugAdapters,
... |
rust_dataset_chunk_507577 | rust_dataset.txt | 507,577 | 512 | /// Moves an item to a pane in the specified direction.
#[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)]
#[action(namespace = workspace)]
#[serde(deny_unknown_fields)]
pub struct MoveItemToPaneInDirection {
#[serde(default = "default_right")]
pub direction: SplitDirection,
#[serde(default = "def... |
rust_dataset_chunk_507578 | rust_dataset.txt | 507,578 | 512 | pub close_pinned: bool,
}
/// Sends a sequence of keystrokes to the active element.
#[derive(Clone, Deserialize, PartialEq, JsonSchema, Action)]
#[action(namespace = workspace)]
pub struct SendKeystrokes(pub String);
actions!(
project_symbols,
[
/// Toggles the project symbols search.
#[actio... |
rust_dataset_chunk_507579 | rust_dataset.txt | 507,579 | 512 | .
#[serde(default)]
pub px: u32,
}
/// Decreases size of all currently visible docks uniformly, by a given amount of pixels.
#[derive(Clone, PartialEq, Deserialize, JsonSchema, Action)]
#[action(namespace = workspace)]
#[serde(deny_unknown_fields)]
pub struct DecreaseOpenDocksSize {
/// For 0px parameter, ... |
rust_dataset_chunk_507580 | rust_dataset.txt | 507,580 | 512 | M>(mut self, message: M, on_click: F) -> Self
where
M: Into<Cow<'static, str>>,
F: Fn(&mut Window, &mut App) + 'static,
{
self.on_click = Some((message.into(), Arc::new(on_click)));
self
}
pub fn autohide(mut self) -> Self {
self.autohide = true;
self
... |
rust_dataset_chunk_507581 | rust_dataset.txt | 507,581 | 512 | })
.detach();
}
impl PartialEq for Toast {
fn eq(&self, other: &Self) -> bool {
self.id == other.id
&& self.message == other.message
&& self.on_click.is_some() == other.on_click.is_some()
}
}
/// Opens a new terminal with the specified working directory.
#[derive(Debug... |
rust_dataset_chunk_507582 | rust_dataset.txt | 507,582 | 512 | } else {
OpenPathPromptMode::CurrentWindow
},
window,
cx,
);
});
})
.ok();
} else {
let task = Workspace::new_local(
Vec::new(),
... |
rust_dataset_chunk_507583 | rust_dataset.txt | 507,583 | 512 | Visible::None
};
workspace.open_paths(
paths,
OpenOptions {
visible: Some(visible),
..OpenOptions::default()
},
None,
... |
rust_dataset_chunk_507584 | rust_dataset.txt | 507,584 | 512 | PromptOptions {
files: true,
directories,
multiple: true,
prompt: None,
},
WorkspaceSettings::get_global(cx).default_open_behavior
== DefaultOpenBehavior::NewWindow,
cx,
... |
rust_dataset_chunk_507585 | rust_dataset.txt | 507,585 | 512 | project_item.read_with(cx, project::ProjectItem::entry_id);
let build_workspace_item = Box::new(
|pane: &mut Pane, window: &mut Window, cx: &mut Context<Pane>| {
Box::new(cx.new(|cx| {
... |
rust_dataset_chunk_507586 | rust_dataset.txt | 507,586 | 512 | window: &mut Window,
cx: &mut App,
) -> Option<Box<dyn ItemHandle>> {
let build = self
.build_project_item_fns_by_type
.get(&TypeId::of::<T>())?;
Some(build(item.into_any(), project, pane, window, cx))
}
}
type WorkspaceItemBuilder =
Box<dyn FnOnce(&mut Pane... |
rust_dataset_chunk_507587 | rust_dataset.txt | 507,587 | 512 | _state_proto)(workspace.clone(), view_id, &mut state, window, cx)
})
})
}
pub fn to_followable_view(
view: impl Into<AnyView>,
cx: &App,
) -> Option<Box<dyn FollowableItemHandle>> {
let this = cx.try_global::<Self>()?;
let view = view.into();
let ... |
rust_dataset_chunk_507588 | rust_dataset.txt | 507,588 | 512 | View,
cx: &App,
) -> Option<Box<dyn SerializableItemHandle>> {
let this = cx.try_global::<Self>()?;
let descriptor = this.descriptors_by_type.get(&view.entity_type())?;
Some((descriptor.view_to_serializable_item)(view))
}
fn descriptor(item_kind: &str, cx: &App) -> Option<Se... |
rust_dataset_chunk_507589 | rust_dataset.txt | 507,589 | 512 | PreviousWorkspaceState {
pub dock_structure: DockStructure,
pub open_file_paths: Vec<PathBuf>,
pub active_file_path: Option<PathBuf>,
pub focused_dock: Option<DockPosition>,
}
pub struct WorkspaceStore {
workspaces: HashSet<(gpui::AnyWindowHandle, WeakEntity<Workspace>)>,
client: Arc<Client>,
... |
rust_dataset_chunk_507590 | rust_dataset.txt | 507,590 | 512 | cx.new(|cx| AppSession::new(Session::test(), cx));
let user_store = cx.new(|cx| UserStore::new(client.clone(), cx));
let workspace_store = cx.new(|cx| WorkspaceStore::new(client.clone(), cx));
theme_settings::init(theme::LoadThemes::JustBase, cx);
client::init(&client, cx);
Ar... |
rust_dataset_chunk_507591 | rust_dataset.txt | 507,591 | 512 | UserSavedItem {
pane: WeakEntity<Pane>,
item: Box<dyn WeakItemHandle>,
save_intent: SaveIntent,
},
ContactRequestedJoin(u64),
WorkspaceCreated(WeakEntity<Workspace>),
OpenBundledFile {
text: Cow<'static, str>,
title: &'static str,
language: &'static st... |
rust_dataset_chunk_507592 | rust_dataset.txt | 507,592 | 512 | `Workspace` owns everybody's state and serves as a default, "global context",
/// that can be used to register a global action to be triggered from any place in the window.
pub struct Workspace {
weak_self: WeakEntity<Self>,
workspace_actions: Vec<Box<dyn Fn(Div, &Workspace, &mut Window, &mut Context<Self>) ->... |
rust_dataset_chunk_507593 | rust_dataset.txt | 507,593 | 512 | <()>>,
_schedule_serialize_workspace: Option<Task<()>>,
_serialize_workspace_task: Option<Task<()>>,
worktree_trust_prompt_check: Option<Task<()>>,
_schedule_serialize_ssh_paths: Option<Task<()>>,
pane_history_timestamp: Arc<AtomicUsize>,
bounds: Bounds<Pixels>,
pub centered_layout: bool,
... |
rust_dataset_chunk_507594 | rust_dataset.txt | 507,594 | 512 | Option<ViewId>,
items_by_leader_view_id: HashMap<ViewId, FollowerView>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AutoWatch {
Off,
Active { watched_peer: Option<PeerId> },
Paused,
}
impl AutoWatch {
pub fn enabled(&self) -> bool {
matches!(self, AutoWatch::Active { .. } | Au... |
rust_dataset_chunk_507595 | rust_dataset.txt | 507,595 | 512 | _trust_all(cx);
})
}
}
})
.detach();
}
cx.subscribe_in(&project, window, move |this, _, event, window, cx| {
match event {
project::Event::RemoteIdChanged(_) => {
this.upd... |
rust_dataset_chunk_507596 | rust_dataset.txt | 507,596 | 512 | (
NotificationId::named(notification_id.clone()),
cx,
|cx| {
let mut notification = MessageNotification::new(message.clone(), cx);
if let Some(link) = link {
notification = notificatio... |
rust_dataset_chunk_507597 | rust_dataset.txt | 507,597 | 512 | )));
center_pane.set_should_display_welcome_page(true);
center_pane
});
cx.subscribe_in(¢er_pane, window, Self::handle_pane_event)
.detach();
window.focus(¢er_pane.focus_handle(cx), cx);
cx.emit(Event::PaneAdded(center_pane.clone()));
... |
rust_dataset_chunk_507598 | rust_dataset.txt | 507,598 | 512 | left_dock_buttons = cx.new(|cx| PanelButtons::new(left_dock.clone(), cx));
let bottom_dock_buttons = cx.new(|cx| PanelButtons::new(bottom_dock.clone(), cx));
let right_dock_buttons = cx.new(|cx| PanelButtons::new(right_dock.clone(), cx));
let multi_workspace = window
.root::<MultiWo... |
rust_dataset_chunk_507599 | rust_dataset.txt | 507,599 | 512 | |this, _, event, window, cx| match event {
GitStoreEvent::ActiveRepositoryChanged(_)
| GitStoreEvent::RepositoryUpdated(
_,
RepositoryEvent::HeadChanged | RepositoryEvent::BranchListChanged,
true,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.