Allow opening the FS root dir as a remote project (#30190)

### Todo

* [x] Allow opening `ssh://username@host:/` from the CLI
* [x] Allow selecting `/` in the `open path` picker
* [x] Allow selecting the home directory in the `open path` picker

Release Notes:

- Changed the initial state of the SSH project picker to show the full
path to your home directory on the remote machine, instead of `~`.
- Added the ability to open `/` as a project folder over SSH

---------

Co-authored-by: Agus Zubiaga <hi@aguz.me>
This commit is contained in:
Max Brunsfeld 2025-05-07 16:50:57 -07:00 committed by GitHub
parent 6ac2f4e6a5
commit 37010aac6b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 98 additions and 54 deletions

View file

@ -530,8 +530,8 @@ pub async fn derive_paths_with_position(
#[cfg(test)]
mod tests {
use std::sync::Arc;
use super::*;
use crate::zed::{open_listener::open_local_workspace, tests::init_test};
use cli::{
CliResponse,
ipc::{self},
@ -539,10 +539,33 @@ mod tests {
use editor::Editor;
use gpui::TestAppContext;
use serde_json::json;
use std::sync::Arc;
use util::path;
use workspace::{AppState, Workspace};
use crate::zed::{open_listener::open_local_workspace, tests::init_test};
#[gpui::test]
fn test_parse_ssh_url(cx: &mut TestAppContext) {
let _app_state = init_test(cx);
cx.update(|cx| {
SshSettings::register(cx);
});
let request =
cx.update(|cx| OpenRequest::parse(vec!["ssh://me@localhost:/".into()], cx).unwrap());
assert_eq!(
request.ssh_connection.unwrap(),
SshConnectionOptions {
host: "localhost".into(),
username: Some("me".into()),
port: None,
password: None,
args: None,
port_forwards: None,
nickname: None,
upload_binary_over_ssh: false,
}
);
assert_eq!(request.open_paths, vec!["/"]);
}
#[gpui::test]
async fn test_open_workspace_with_directory(cx: &mut TestAppContext) {