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_507400 | rust_dataset.txt | 507,400 | 512 | b {
WindowBounds::Windowed(bounds) => {
let origin = bounds.origin;
let size = bounds.size;
WindowBoundsJson::Windowed {
x: f32::from(origin.x).round() as i32,
y: f32::from(origin.y).round() as i32,
... |
rust_dataset_chunk_507401 | rust_dataset.txt | 507,401 | 512 | (width as f32), px(height as f32)),
}),
}
}
}
fn read_multi_workspace_state(window_id: WindowId, cx: &App) -> model::MultiWorkspaceState {
let kvp = KeyValueStore::global(cx);
kvp.scoped("multi_workspace_state")
.read(&window_id.as_u64().to_string())
.log_err()
.... |
rust_dataset_chunk_507402 | rust_dataset.txt | 507,402 | 512 | scratch/empty workspace isn't
// restored as the focused window. Only if none have paths do we
// fall back to the first entry.
.or_else(|| group.iter().position(|ws| !ws.paths.is_empty()))
.or(Some(0))
.and_then(|index| group.into_iter().... |
rust_dataset_chunk_507403 | rust_dataset.txt | 507,403 | 512 | <str>>,
pub state: BreakpointState,
}
/// Wrapper for DB type of a breakpoint
struct BreakpointStateWrapper<'a>(Cow<'a, BreakpointState>);
impl From<BreakpointState> for BreakpointStateWrapper<'static> {
fn from(kind: BreakpointState) -> Self {
BreakpointStateWrapper(Cow::Owned(kind))
}
}
impl St... |
rust_dataset_chunk_507404 | rust_dataset.txt | 507,404 | 512 | {start_index}"))?
as u32;
let (message, next_index) = Option::<String>::column(statement, start_index + 1)?;
let (condition, next_index) = Option::<String>::column(statement, next_index)?;
let (hit_condition, next_index) = Option::<String>::column(statement, next_index)?;
le... |
rust_dataset_chunk_507405 | rust_dataset.txt | 507,405 | 512 | timestamp TEXT DEFAULT CURRENT_TIMESTAMP NOT NULL,
FOREIGN KEY(dock_pane) REFERENCES panes(pane_id)
) STRICT;
CREATE TABLE pane_groups(
group_id INTEGER PRIMARY KEY,
workspace_id INTEGER NOT NULL,
parent_group_id INTEGER, // NULL ... |
rust_dataset_chunk_507406 | rust_dataset.txt | 507,406 | 512 | Preserving so users can downgrade Zed.
dock_anchor TEXT, // Deprecated. Preserving so users can downgrade Zed.
dock_pane INTEGER, // Deprecated. Preserving so users can downgrade Zed.
left_sidebar_open INTEGER, // Boolean
timestamp TEXT DEFAULT CURRENT_T... |
rust_dataset_chunk_507407 | rust_dataset.txt | 507,407 | 512 | );
ALTER TABLE workspaces DROP COLUMN remote_project_id;
ALTER TABLE workspaces ADD COLUMN dev_server_project_id INTEGER;
),
sql!(
ALTER TABLE workspaces ADD COLUMN local_paths_order BLOB;
),
sql!(
ALTER TABLE workspaces ADD COL... |
rust_dataset_chunk_507408 | rust_dataset.txt | 507,408 | 512 | )) STRICT;
INSERT INTO toolchains2
SELECT * FROM toolchains;
DROP TABLE toolchains;
ALTER TABLE toolchains2 RENAME TO toolchains;
),
sql!(
CREATE TABLE ssh_connections (
id INTEGER PRIMARY KEY,
host TEXT NOT ... |
rust_dataset_chunk_507409 | rust_dataset.txt | 507,409 | 512 | _panel,
workspaces.bottom_dock_visible,
workspaces.bottom_dock_active_panel,
workspaces.left_dock_zoom,
workspaces.right_dock_zoom,
workspaces.bottom_dock_zoom,
workspaces.fullscreen,
workspaces.centered_layo... |
rust_dataset_chunk_507410 | rust_dataset.txt | 507,410 | 512 | ssh" as kind,
host,
port,
user,
NULL as distro
FROM ssh_connections;
INSERT
INTO workspaces_2
SELECT
workspace_id,
paths,
paths_order,
ssh_conn... |
rust_dataset_chunk_507411 | rust_dataset.txt | 507,411 | 512 | izing the workspace paths, so if no `\n` is
// found, we know we have a single worktree.
SELECT toolchains.workspace_id, paths, language_name, name, path, raw_json, relative_worktree_path FROM toolchains INNER JOIN workspaces ON toolchains.workspace_id = workspaces.workspace_id AND instr... |
rust_dataset_chunk_507412 | rust_dataset.txt | 507,412 | 512 | NOT NULL,
position INTEGER NOT NULL,
PRIMARY KEY (workspace_id, path),
FOREIGN KEY(workspace_id) REFERENCES workspaces(workspace_id)
ON DELETE CASCADE
ON UPDATE CASCADE
) STRICT;
),
sql!(
ALTER TABLE... |
rust_dataset_chunk_507413 | rust_dataset.txt | 507,413 | 512 | for the
/// passed roots is stored, returns none.
pub(crate) fn workspace_for_roots<P: AsRef<Path>>(
&self,
worktree_roots: &[P],
) -> Option<SerializedWorkspace> {
self.workspace_for_roots_internal(worktree_roots, None)
}
pub fn has_workspace_for_roots<P: AsRef<Path>>(&sel... |
rust_dataset_chunk_507414 | rust_dataset.txt | 507,414 | 512 | ock_active_panel,
left_dock_zoom,
right_dock_visible,
right_dock_active_panel,
right_dock_zoom,
bottom_dock_visible,
bottom_dock_active_panel,
bottom_dock_zoom,
... |
rust_dataset_chunk_507415 | rust_dataset.txt | 507,415 | 512 | ListColumns>,
Option<SerializedWindowBounds>,
Option<Uuid>,
Option<bool>,
DockStructure,
Option<u64>,
Option<i32>,
Option<String>,
) = self
.select_row_bound(sql! {
SELECT
paths,
... |
rust_dataset_chunk_507416 | rust_dataset.txt | 507,416 | 512 | recent_navigation_history(&self, workspace_id: WorkspaceId) -> Vec<PathBuf> {
self.select_bound(sql!(
SELECT path
FROM recent_navigation_history
WHERE workspace_id = ?
ORDER BY position
))
.and_then(|mut statement| statement(workspace_id))
... |
rust_dataset_chunk_507417 | rust_dataset.txt | 507,417 | 512 | : breakpoint.message,
condition: breakpoint.condition,
hit_condition: breakpoint.hit_condition,
state: breakpoint.state,
});
}
for (path, bps) in map.iter() {
log::info!(
... |
rust_dataset_chunk_507418 | rust_dataset.txt | 507,418 | 512 | _worktree_path != String::default()
{
ToolchainScope::Subproject(
Arc::from(worktree_root_path.as_ref()),
relative_path.into(),
)
} else {
ToolchainScope::Project
}... |
rust_dataset_chunk_507419 | rust_dataset.txt | 507,419 | 512 | ::from(bp.state);
match conn.exec_bound(sql!(
INSERT INTO breakpoints (workspace_id, path, breakpoint_location, log_message, condition, hit_condition, state)
VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7);))?
((
... |
rust_dataset_chunk_507420 | rust_dataset.txt | 507,420 | 512 | exist.
if !paths.paths.is_empty() {
conn.exec_bound(sql!(
DELETE
FROM workspaces
WHERE
workspace_id != ?1 AND
paths IS ?2 AND
re... |
rust_dataset_chunk_507421 | rust_dataset.txt | 507,421 | 512 | ?;
conn.exec_bound(sql!(
DELETE FROM recent_navigation_history WHERE workspace_id = ?;
))?(workspace.id)
.context("Clearing recent navigation history")?;
let mut insert_recent_path = conn.exec_bound(sql!(
INSERT IN... |
rust_dataset_chunk_507422 | rust_dataset.txt | 507,422 | 512 | remote_env = serde_json::to_string(&options.remote_env).ok();
}
#[cfg(any(test, feature = "test-support"))]
RemoteConnectionOptions::Mock(options) => {
kind = RemoteConnectionKind::Ssh;
host = Some(format!("mock-{}", options.id).into())... |
rust_dataset_chunk_507423 | rust_dataset.txt | 507,423 | 512 | WorkspaceId> {
INSERT INTO workspaces DEFAULT VALUES RETURNING workspace_id
}
}
fn recent_workspaces(
&self,
) -> Result<
Vec<(
WorkspaceId,
PathList,
Option<PathList>,
Option<RemoteConnectionId>,
Option<String>... |
rust_dataset_chunk_507424 | rust_dataset.txt | 507,424 | 512 | ?1
ORDER BY timestamp DESC
}
}
query! {
pub fn breakpoints_for_file(workspace_id: WorkspaceId, file_path: &Path) -> Result<Vec<Breakpoint>> {
SELECT breakpoint_location
FROM breakpoints
WHERE workspace_id= ?1 AND path = ?2
}
}
q... |
rust_dataset_chunk_507425 | rust_dataset.txt | 507,425 | 512 | ) -> Option<RemoteConnectionOptions> {
match RemoteConnectionKind::deserialize(&kind)? {
RemoteConnectionKind::Wsl => Some(RemoteConnectionOptions::Wsl(WslConnectionOptions {
distro_name: distro?,
user: user,
})),
RemoteConnectionKind::Ssh => ... |
rust_dataset_chunk_507426 | rust_dataset.txt | 507,426 | 512 | paths.clone(),
identity_paths: identity_paths_hint.unwrap_or(paths),
path_style,
timestamp,
});
}
continue;
}
if paths.paths().is_empty() || contains_wsl_path(&paths) {
... |
rust_dataset_chunk_507427 | rust_dataset.txt | 507,427 | 512 | _ids
.iter()
.copied()
.map(|workspace_id| self.delete_workspace_by_id(workspace_id)),
)
.await;
Ok(workspace_ids)
}
// Deletes workspace rows that can no longer be restored from. Remote workspaces whose
// connection was removed, and... |
rust_dataset_chunk_507428 | rust_dataset.txt | 507,428 | 512 | : &dyn Fs) -> Result<Option<RecentWorkspace>> {
Ok(self.recent_project_workspaces(fs).await?.into_iter().next())
}
// Returns the locations of the workspaces that were still opened when the last
// session was closed (i.e. when Zed was quit).
// If `last_session_window_order` is provided, the r... |
rust_dataset_chunk_507429 | rust_dataset.txt | 507,429 | 512 | WorkspaceId);
type GroupOrPane = (
Option<GroupId>,
Option<SerializedAxis>,
Option<PaneId>,
Option<bool>,
Option<usize>,
Option<String>,
);
self.select_bound::<GroupKey, GroupOrPane>(sql!(
SELECT group_id, axis,... |
rust_dataset_chunk_507430 | rust_dataset.txt | 507,430 | 512 | collect::<Result<_>>()
}
fn save_pane_group(
conn: &Connection,
workspace_id: WorkspaceId,
pane_group: &SerializedPaneGroup,
parent: Option<(GroupId, usize)>,
) -> Result<()> {
if parent.is_none() {
log::debug!("Saving a pane group for workspace {workspac... |
rust_dataset_chunk_507431 | rust_dataset.txt | 507,431 | 512 | items")?;
Ok(pane_id)
}
fn get_items(&self, pane_id: PaneId) -> Result<Vec<SerializedItem>> {
self.select_bound(sql!(
SELECT kind, item_id, active, preview FROM items
WHERE pane_id = ?
ORDER BY position
))?(pane_id)
}
fn save_items(
... |
rust_dataset_chunk_507432 | rust_dataset.txt | 507,432 | 512 | query! {
pub(crate) async fn set_session_binding(workspace_id: WorkspaceId, session_id: Option<String>, window_id: Option<u64>) -> Result<()> {
UPDATE workspaces
SET session_id = ?2, window_id = ?3
WHERE workspace_id = ?1
}
}
pub(crate) async fn toolchain... |
rust_dataset_chunk_507433 | rust_dataset.txt | 507,433 | 512 | = ?7
))
.context("Preparing insertion")?;
insert((
workspace_id,
worktree_root_path.to_string_lossy().into_owned(),
relative_worktree_path.as_unix_str(),
toolchain.language_name.as_ref(),
toolch... |
rust_dataset_chunk_507434 | rust_dataset.txt | 507,434 | 512 | map(|abs_path| abs_path.as_ref()),
next_index,
)?;
next_index =
statement.bind(&remote_identity_columns(host.as_ref()), next_index)?;
}
statement.exec()
})
.await
.... |
rust_dataset_chunk_507435 | rust_dataset.txt | 507,435 | 512 | ::<(&Path, RemoteIdentityColumns)>(sql!(
INSERT INTO restricted_worktrees(absolute_path, connection_kind, host, user, port)
VALUES (?, ?, ?, ?, ?)
))?;
for abs_path in &abs_paths {
if !is_worktree... |
rust_dataset_chunk_507436 | rust_dataset.txt | 507,436 | 512 | ConnectionIdentity::Mock { id }));
}
let host = Cow::Owned(host?);
let user = user.map(Cow::Owned);
let identity = match RemoteConnectionKind::deserialize(&kind)? {
RemoteConnectionKind::Ssh => RemoteConnectionIdentity::Ssh {
host,
username: user,
port,
... |
rust_dataset_chunk_507437 | rust_dataset.txt | 507,437 | 512 | List {
let resolved_identity_paths = if contains_wsl_path(paths) {
None
} else {
resolve_local_workspace_identity(fs, paths, identity_paths_hint.as_ref()).await
};
resolved_identity_paths
.or(identity_paths_hint)
.unwrap_or_else(|| paths.clone())
}
async fn resolve_local... |
rust_dataset_chunk_507438 | rust_dataset.txt | 507,438 | 512 | workspace;
}
} else {
indices_by_key.insert(key, result.len());
result.push(workspace);
}
}
result
}
pub fn delete_unloaded_items(
alive_items: Vec<ItemId>,
workspace_id: WorkspaceId,
table: &'static str,
db: &ThreadSafeConnection,
cx: &... |
rust_dataset_chunk_507439 | rust_dataset.txt | 507,439 | 512 | };
use util::path;
/// Creates a unique directory in a FakeFs, returning the path.
/// Uses a UUID suffix to avoid collisions with other tests sharing the global DB.
async fn unique_test_dir(fs: &fs::FakeFs, prefix: &str) -> PathBuf {
let dir = PathBuf::from(format!("/test-dirs/{}-{}", prefix, ... |
rust_dataset_chunk_507440 | rust_dataset.txt | 507,440 | 512 | workspace ---
multi_workspace.update_in(cx, |mw, _window, cx| {
let active = mw.workspace().clone();
let ws = mw
.workspaces()
.find(|ws| *ws != &active)
.expect("should have a non-active workspace");
mw.remove([ws.clone()], Re... |
rust_dataset_chunk_507441 | rust_dataset.txt | 507,441 | 512 | ::Local,
center_group: Default::default(),
window_bounds: Default::default(),
display: Default::default(),
docks: Default::default(),
centered_layout: false,
bookmarks: Default::default(),
breakpoints: {
let mut map = co... |
rust_dataset_chunk_507442 | rust_dataset.txt | 507,442 | 512 | _eq!(loaded_breakpoints[0].condition, breakpoint.condition);
assert_eq!(
loaded_breakpoints[0].hit_condition,
breakpoint.hit_condition
);
assert_eq!(loaded_breakpoints[0].state, breakpoint.state);
assert_eq!(loaded_breakpoints[0].path, Arc::from(path));
/... |
rust_dataset_chunk_507443 | rust_dataset.txt | 507,443 | 512 | [4].state, hit_condition_breakpoint.state);
assert_eq!(loaded_breakpoints[4].path, Arc::from(path));
}
#[gpui::test]
async fn test_remove_last_breakpoint() {
zlog::init_test();
let db = WorkspaceDb::open_test_db("test_remove_last_breakpoint").await;
let id = db.next_id().aw... |
rust_dataset_chunk_507444 | rust_dataset.txt | 507,444 | 512 | ].path, Arc::from(singular_path));
let workspace_without_breakpoint = SerializedWorkspace {
id,
paths: PathList::new(&["/tmp"]),
identity_paths: None,
location: SerializedWorkspaceLocation::Local,
center_group: Default::default(),
window_b... |
rust_dataset_chunk_507445 | rust_dataset.txt | 507,445 | 512 | -1");
}
#[gpui::test]
async fn test_restricted_worktrees_are_scoped_to_path_and_connection() {
let db = WorkspaceDb::open_test_db("test_restricted_worktrees").await;
let path = Path::new("/project");
let other_path = Path::new("/other");
let ssh =
|username: Opti... |
rust_dataset_chunk_507446 | rust_dataset.txt | 507,446 | 512 | FROM restricted_worktrees))
.unwrap()()
.unwrap(),
Some(3)
);
db.clear_restricted_worktrees().await.unwrap();
assert_eq!(
db.select_row::<i64>(sql!(SELECT COUNT(*) FROM restricted_worktrees))
.unwrap()()
.unwrap(),... |
rust_dataset_chunk_507447 | rust_dataset.txt | 507,447 | 512 | ();
let migrated_rows = connection
.select::<(
String,
Option<String>,
Option<String>,
Option<String>,
Option<u16>,
)>(
"SELECT absolute_path, connection_kind, host, user, port
... |
rust_dataset_chunk_507448 | rust_dataset.txt | 507,448 | 512 | ed("user")),
}),
Some(RemoteConnectionIdentity::Docker {
container_id: Cow::Borrowed("server"),
remote_user: Cow::Borrowed("user"),
}),
Some(RemoteConnectionIdentity::Mock { id: 7 }),
];
let trusted_paths = connections
... |
rust_dataset_chunk_507449 | rust_dataset.txt | 507,449 | 512 | declined_path, false), (other_path, true)] {
assert_eq!(
db.has_undecided_restricted_worktrees(Vec::from([Arc::from(path)]), None)
.await
.unwrap(),
expected_undecided,
"{path:?}"
);
}
}
#[gp... |
rust_dataset_chunk_507450 | rust_dataset.txt | 507,450 | 512 | , display_uuid, Some(new_state.clone()))
.await
.unwrap();
assert_eq!(
db.native_window_state(id).unwrap(),
Some((Some(display_uuid), Some(new_state)))
);
db.set_window_open_status(id, window_bounds, display_uuid, None)
.await
... |
rust_dataset_chunk_507451 | rust_dataset.txt | 507,451 | 512 | (),
};
db.save_workspace(workspace_1.clone()).await;
db.write(|conn| {
conn.exec_bound(sql!(INSERT INTO test_table(text, workspace_id) VALUES (?, ?)))
.unwrap()(("test-text-1", 1))
.unwrap();
})
.await;
db.save_workspace(workspac... |
rust_dataset_chunk_507452 | rust_dataset.txt | 507,452 | 512 | ,
)),
SerializedPaneGroup::Pane(SerializedPane::new(
vec![
SerializedItem::new("Terminal", 7, true, false),
SerializedItem::new("Terminal", 8, false, false),
... |
rust_dataset_chunk_507453 | rust_dataset.txt | 507,453 | 512 | ").await;
// The recent-workspaces list only includes local workspaces whose paths exist.
fs.insert_tree("/path-style/local", json!({})).await;
fs.insert_tree("/path-style/remote", json!({})).await;
let local_paths = [Path::new("/path-style/local")];
let remote_paths = [Path::n... |
rust_dataset_chunk_507454 | rust_dataset.txt | 507,454 | 512 | await;
let workspace_id = WorkspaceId(1);
// The recent-workspaces list only includes local workspaces whose paths exist.
fs.insert_tree("/legacy/path-style", json!({})).await;
let mut workspace = workspace_with(
1,
&[Path::new("/legacy/path-style")],
... |
rust_dataset_chunk_507455 | rust_dataset.txt | 507,455 | 512 | (),
breakpoints: Default::default(),
display: Default::default(),
docks: Default::default(),
centered_layout: false,
session_id: None,
window_id: Some(1),
user_toolchains: Default::default(),
recent_navigation_history: Defau... |
rust_dataset_chunk_507456 | rust_dataset.txt | 507,456 | 512 | display: Default::default(),
docks: Default::default(),
centered_layout: false,
session_id: None,
window_id: Some(3),
user_toolchains: Default::default(),
recent_navigation_history: Default::default(),
path_style: PathStyle:... |
rust_dataset_chunk_507457 | rust_dataset.txt | 507,457 | 512 | user_toolchains: Default::default(),
recent_navigation_history: Default::default(),
path_style: PathStyle::local(),
};
let workspace_3 = SerializedWorkspace {
id: WorkspaceId(3),
paths: PathList::new(&["/tmp3"]),
identity_paths: No... |
rust_dataset_chunk_507458 | rust_dataset.txt | 507,458 | 512 | path_style: PathStyle::local(),
};
let workspace_6 = SerializedWorkspace {
id: WorkspaceId(6),
paths: PathList::new(&["/tmp6c", "/tmp6b", "/tmp6a"]),
identity_paths: None,
location: SerializedWorkspaceLocation::Local,
center_group:... |
rust_dataset_chunk_507459 | rust_dataset.txt | 507,459 | 512 | List::new(&["/tmp3"]));
assert_eq!(locations[1].2, Some(30));
let locations = db.session_workspaces("session-id-3".to_owned()).unwrap();
assert_eq!(locations.len(), 1);
assert_eq!(locations[0].0, WorkspaceId(6));
assert_eq!(
locations[0].1,
PathList::new(... |
rust_dataset_chunk_507460 | rust_dataset.txt | 507,460 | 512 | dir3.path()], 8),
(4, vec![dir4.path()], 2),
(5, vec![dir1.path(), dir2.path(), dir3.path()], 3),
(6, vec![dir4.path(), dir3.path(), dir2.path()], 4),
]
.into_iter()
.map(|(id, paths, window_id)| SerializedWorkspace {
id: WorkspaceId(id),
... |
rust_dataset_chunk_507461 | rust_dataset.txt | 507,461 | 512 | WorkspaceId(1),
location: SerializedWorkspaceLocation::Local,
paths: PathList::new(&[dir1.path()]),
window_id: Some(WindowId::from(9u64)),
},
SessionWorkspace {
workspace_id: WorkspaceId(5),
... |
rust_dataset_chunk_507462 | rust_dataset.txt | 507,462 | 512 | sh(
SshConnectionOptions {
host: host.into(),
..Default::default()
},
)),
center_group: empty_pane_group(),
window_bounds: Default::default(),
display: Default::default(),
docks: Default::... |
rust_dataset_chunk_507463 | rust_dataset.txt | 507,463 | 512 | : refs/heads/feature\n",
"delta": { "copy-baseline": "" },
"objects": { "info": { "alternates": {} } },
},
},
},
"worktrees": {
... |
rust_dataset_chunk_507464 | rust_dataset.txt | 507,464 | 512 | !("/root/repo/.delta/worktrees/unmarked/repo"));
let unmarked_clone_path = Path::new(path!("/root/repo/.delta/clones/unmarked/repo.git"));
let unreadable_checkout_path =
Path::new(path!("/root/repo/.delta/worktrees/unreadable/repo"));
let independent_path = Path::new(path!("/root/ind... |
rust_dataset_chunk_507465 | rust_dataset.txt | 507,465 | 512 | | paths.into_iter().map(Path::to_path_buf).collect::<Vec<_>>())
);
}
#[gpui::test]
async fn test_scratch_only_workspace_restores_from_last_session(cx: &mut gpui::TestAppContext) {
let fs = fs::FakeFs::new(cx.executor());
let db =
WorkspaceDb::open_test_db("test_scratch_o... |
rust_dataset_chunk_507466 | rust_dataset.txt | 507,466 | 512 | :00".to_owned())
.await
.unwrap();
db.garbage_collect_workspaces(fs.as_ref(), "current", None)
.await
.unwrap();
assert!(
db.workspace_for_id(WorkspaceId(1)).is_none(),
"stale empty workspace older than the retention window must be... |
rust_dataset_chunk_507467 | rust_dataset.txt | 507,467 | 512 | "2000-01-01 00:00:00".to_owned())
.await
.unwrap();
}
db.garbage_collect_workspaces(fs.as_ref(), "current", Some("last"))
.await
.unwrap();
assert!(
db.workspace_for_id(WorkspaceId(1)).is_some(),
"GC must not dele... |
rust_dataset_chunk_507468 | rust_dataset.txt | 507,468 | 512 | restore"
);
}
#[gpui::test]
async fn test_last_session_workspace_locations_remote(cx: &mut gpui::TestAppContext) {
let fs = fs::FakeFs::new(cx.executor());
let db =
WorkspaceDb::open_test_db("test_serializing_workspaces_last_session_workspaces_remote")
.... |
rust_dataset_chunk_507469 | rust_dataset.txt | 507,469 | 512 | from(9), // Bottom
]));
let have = db
.last_session_workspace_locations("one-session", stack, fs.as_ref())
.await
.unwrap();
assert_eq!(have.len(), 4);
assert_eq!(
have[0],
SessionWorkspace {
workspace_id: Works... |
rust_dataset_chunk_507470 | rust_dataset.txt | 507,470 | 512 | assert_eq!(connection_id, same_connection);
// Test with different parameters
let host2 = "otherexample.com".to_string();
let port2 = None;
let user2 = Some("otheruser".to_string());
let different_connection = db
.get_or_create_remote_connection(RemoteConnectionOpt... |
rust_dataset_chunk_507471 | rust_dataset.txt | 507,471 | 512 | }
let stored_connections = db.remote_connections().unwrap();
assert_eq!(
stored_connections,
[
(
ids[0],
RemoteConnectionOptions::Ssh(SshConnectionOptions {
host: "example.com".into(),
... |
rust_dataset_chunk_507472 | rust_dataset.txt | 507,472 | 512 | ;
let new_workspace = db.workspace_for_roots(&["/tmp"]).unwrap();
assert_eq!(workspace.center_group, new_workspace.center_group);
}
#[gpui::test]
async fn test_cleanup_panes() {
zlog::init_test();
let db = WorkspaceDb::open_test_db("test_cleanup_panes").await;
le... |
rust_dataset_chunk_507473 | rust_dataset.txt | 507,473 | 512 | ("test_empty_workspace_window_bounds").await;
let id = db.next_id().await.unwrap();
// Create a workspace with empty paths (empty workspace)
let empty_paths: &[&str] = &[];
let display_uuid = Uuid::new_v4();
let window_bounds = SerializedWindowBounds(WindowBounds::Windowed(Bound... |
rust_dataset_chunk_507474 | rust_dataset.txt | 507,474 | 512 | 3").unwrap();
let dir4 = tempfile::TempDir::with_prefix("dir4").unwrap();
let dir5 = tempfile::TempDir::with_prefix("dir5").unwrap();
let fs = fs::FakeFs::new(cx.executor());
fs.insert_tree(dir1.path(), json!({})).await;
fs.insert_tree(dir2.path(), json!({})).await;
fs.i... |
rust_dataset_chunk_507475 | rust_dataset.txt | 507,475 | 512 | ())
.await
.unwrap();
// All 5 workspaces should be returned with their window_ids.
assert_eq!(locations.len(), 5);
// Every entry should have a window_id so the caller can group them.
for session_workspace in &locations {
assert!(
se... |
rust_dataset_chunk_507476 | rust_dataset.txt | 507,476 | 512 | WindowId::from(20u64);
let kvp = cx.update(|cx| KeyValueStore::global(cx));
write_multi_workspace_state(
&kvp,
window_10,
MultiWorkspaceState {
active_workspace_id: Some(WorkspaceId(2)),
project_groups: vec![],
sideba... |
rust_dataset_chunk_507477 | rust_dataset.txt | 507,477 | 512 | closed.
let group_20 = &results[1];
assert_eq!(group_20.active_workspace.workspace_id, WorkspaceId(3));
assert_eq!(group_20.state.active_workspace_id, Some(WorkspaceId(3)));
assert_eq!(group_20.state.sidebar_open, false);
// Orphan: no active_workspace_id, falls back to first w... |
rust_dataset_chunk_507478 | rust_dataset.txt | 507,478 | 512 | crate::tests::init_test(cx);
cx.update(crate::register_serializable_item::<TestItem>);
let fs = fs::FakeFs::new(cx.executor());
fs.insert_tree(
path!("/project"),
json!({ "saved.rs": "one\ntwo\n", "added.rs": "one\ntwo\n" }),
)
.await;
let projec... |
rust_dataset_chunk_507479 | rust_dataset.txt | 507,479 | 512 | breakpoint = |row, path: &Arc<Path>| SourceBreakpoint {
row,
path: path.clone(),
message: None,
condition: None,
hit_condition: None,
state: BreakpointState::Enabled,
};
let saved_docks = DockStructure {
left: DockData ... |
rust_dataset_chunk_507480 | rust_dataset.txt | 507,480 | 512 | : SerializedAxis(Axis::Horizontal),
children: vec![
SerializedPaneGroup::Pane(SerializedPane::new(
vec![SerializedItem::new(
"TestItem",
added_item_id + 1,
... |
rust_dataset_chunk_507481 | rust_dataset.txt | 507,481 | 512 | ) {
crate::tests::init_test(cx);
let fs = fs::FakeFs::new(cx.executor());
fs.insert_tree(path!("/project"), json!({ "saved.rs": "one\ntwo\n" }))
.await;
let project = Project::test(fs.clone(), [path!("/project").as_ref()], cx).await;
let (multi_workspace, cx) =
... |
rust_dataset_chunk_507482 | rust_dataset.txt | 507,482 | 512 | .borrow();
breakpoints_when_the_tabs_were_in_place.replace(Some(
restoring_from
.as_ref()
.map(|restoring_from| restoring_from.breakpoints.clone()),
));
}
... |
rust_dataset_chunk_507483 | rust_dataset.txt | 507,483 | 512 | _layout: false,
bookmarks: Default::default(),
breakpoints: Default::default(),
session_id: None,
window_id: None,
user_toolchains: Default::default(),
recent_navigation_history: Default::default(),
path_style: PathStyle::local(),
... |
rust_dataset_chunk_507484 | rust_dataset.txt | 507,484 | 512 | "the debounced serialization must not have fired yet"
);
cx.update(|cx| cx.shutdown());
let serialized_paths = db
.workspace_for_id(workspace_id)
.expect("the workspace row should still exist after shutdown")
.paths;
assert_eq!(
serializ... |
rust_dataset_chunk_507485 | rust_dataset.txt | 507,485 | 512 | serialized.is_some(),
"Newly created workspace should be fully serialized in the DB after database_id assignment"
);
}
#[gpui::test]
async fn test_remove_workspace_clears_session_binding(cx: &mut gpui::TestAppContext) {
crate::tests::init_test(cx);
let fs = fs::FakeFs:... |
rust_dataset_chunk_507486 | rust_dataset.txt | 507,486 | 512 | ).is_some(),
"Workspace2 should exist in DB before removal"
);
// Remove workspace at index 1 (the second workspace).
multi_workspace.update_in(cx, |mw, window, cx| {
let ws = mw.workspaces().nth(1).unwrap().clone();
mw.remove([ws], RemovalIntent::CloseProjec... |
rust_dataset_chunk_507487 | rust_dataset.txt | 507,487 | 512 | cx| {
mw.open_sidebar(cx);
});
multi_workspace.update_in(cx, |mw, _, cx| {
mw.workspace().update(cx, |ws, _cx| {
ws.set_database_id(ws1_id);
});
});
multi_workspace.update_in(cx, |mw, window, cx| {
let workspace = cx.new(... |
rust_dataset_chunk_507488 | rust_dataset.txt | 507,488 | 512 | });
cx.run_until_parked();
// The removed workspace should NOT appear in session restoration.
let locations = db
.last_session_workspace_locations(session_id, None, fs.as_ref())
.await
.unwrap();
let restored_ids: Vec<WorkspaceId> = locations.iter(... |
rust_dataset_chunk_507489 | rust_dataset.txt | 507,489 | 512 | None,
location: SerializedWorkspaceLocation::Local,
center_group: Default::default(),
window_bounds: Default::default(),
display: Default::default(),
docks: Default::default(),
centered_layout: false,
session_id: Some(session_id.clone(... |
rust_dataset_chunk_507490 | rust_dataset.txt | 507,490 | 512 | task should have cleared the session binding"
);
}
#[gpui::test]
async fn test_close_window_quit_app_preserves_all_sidebar_workspaces(
cx: &mut gpui::TestAppContext,
) {
crate::tests::init_test(cx);
cx.update_global::<settings::SettingsStore, ()>(|store, cx| {
... |
rust_dataset_chunk_507491 | rust_dataset.txt | 507,491 | 512 | _window(&crate::CloseWindow, window, cx);
});
cx.run_until_parked();
let mut restored_ids = db
.last_session_workspace_locations(&session_id, None, fs.as_ref())
.await
.unwrap()
.into_iter()
.map(|workspace| workspace.workspace_id)
... |
rust_dataset_chunk_507492 | rust_dataset.txt | 507,492 | 512 | , |mw, window, cx| {
mw.activate(workspace2.clone(), None, window, cx);
});
cx.run_until_parked();
multi_workspace.update_in(cx, |mw, window, cx| {
mw.close_window(&crate::CloseWindow, window, cx);
});
cx.run_until_parked();
let restored_ids = db... |
rust_dataset_chunk_507493 | rust_dataset.txt | 507,493 | 512 | real DB ID, \
even when the workspace was created via create_workspace (where the ID \
is assigned asynchronously after construction)."
);
}
#[gpui::test]
async fn test_flush_serialization_writes_bounds(cx: &mut gpui::TestAppContext) {
crate::tests::init_test(cx);... |
rust_dataset_chunk_507494 | rust_dataset.txt | 507,494 | 512 | | {
multi_workspace.workspace().update(cx, |workspace, _| {
workspace.set_database_id(workspace_id);
workspace.session_id()
})
})
.unwrap();
multi_workspace
.update_in(cx, |multi_workspace, window, cx| {... |
rust_dataset_chunk_507495 | rust_dataset.txt | 507,495 | 512 | , window, cx| {
multi_workspace.workspace().update(cx, |workspace, cx| {
workspace.flush_serialization(window, cx)
})
})
.await;
assert_eq!(
db.workspace_for_id(workspace_id).unwrap().paths,
PathList::default()
... |
rust_dataset_chunk_507496 | rust_dataset.txt | 507,496 | 512 | (WorkspaceId(1), PathList::new(&["/repo"]), t0, fs.as_ref())
.await,
local_recent_workspace(
WorkspaceId(2),
PathList::new(&["/worktree"]),
t1,
fs.as_ref(),
)
.await,
local_recent_workspace(
... |
rust_dataset_chunk_507497 | rust_dataset.txt | 507,497 | 512 | }
}
}),
)
.await;
// Linked worktree whose commondir resolves to a bare repo (/foo/.bare)
fs.insert_tree(
"/foo/my-feature",
json!({
".git": "gitdir: /foo/.bare/worktrees/my-feature",
"src": { "main.rs"... |
rust_dataset_chunk_507498 | rust_dataset.txt | 507,498 | 512 | TestAppContext,
) {
let fs = fs::FakeFs::new(cx.executor());
fs.insert_tree(
"/the-project",
json!({
".git": "gitdir: ./.bare\n",
".bare": {
"worktrees": {
"feature-a": {
... |
rust_dataset_chunk_507499 | rust_dataset.txt | 507,499 | 512 | )
.await;
fs.insert_tree(
"/the-project/feature-a",
json!({
".git": "gitdir: ../.bare/worktrees/feature-a\n",
"src": { "lib.rs": "" }
}),
)
.await;
db.save_workspace(workspace_with(
1,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.