Skip to content

Commit

Permalink
SSH remoting: terminal & tasks (zed-industries#15321)
Browse files Browse the repository at this point in the history
This also rolls back the `TerminalWorkDir` abstraction I added for the
original remoting, and tidies up the terminal creation code to be clear
about whether we're creating a task *or* a terminal. The previous logic
was a little muddy because it assumed we could be doing both at the same
time (which was not true).

Release Notes:

- remoting alpha: Removed the ability to specify `gh cs ssh` or `gcloud
compute ssh` etc. See https://zed.dev/docs/remote-development for
alternatives.
- remoting alpha: Added support for terminal and tasks to new
experimental ssh remoting
  • Loading branch information
ConradIrwin authored Jul 29, 2024
1 parent 26d0a33 commit 583b623
Show file tree
Hide file tree
Showing 10 changed files with 406 additions and 456 deletions.
3 changes: 2 additions & 1 deletion crates/project/src/prettier_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,8 @@ impl Project {
buffer: &Model<Buffer>,
cx: &mut ModelContext<Self>,
) -> Task<Option<(Option<PathBuf>, PrettierTask)>> {
if !self.is_local() {
// todo(ssh remote): prettier support
if self.is_remote() || self.ssh_session.is_some() {
return Task::ready(None);
}
let buffer = buffer.read(cx);
Expand Down
13 changes: 8 additions & 5 deletions crates/project/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1914,6 +1914,13 @@ impl Project {
}
}

pub fn is_ssh(&self) -> bool {
match &self.client_state {
ProjectClientState::Local | ProjectClientState::Shared { .. } => true,
ProjectClientState::Remote { .. } => false,
}
}

pub fn is_remote(&self) -> bool {
!self.is_local()
}
Expand Down Expand Up @@ -7687,11 +7694,7 @@ impl Project {
) -> Option<(Model<Worktree>, PathBuf)> {
self.worktree_store.read_with(cx, |worktree_store, cx| {
for tree in worktree_store.worktrees() {
if let Some(relative_path) = tree
.read(cx)
.as_local()
.and_then(|t| abs_path.strip_prefix(t.abs_path()).ok())
{
if let Ok(relative_path) = abs_path.strip_prefix(tree.read(cx).abs_path()) {
return Some((tree.clone(), relative_path.into()));
}
}
Expand Down
Loading

0 comments on commit 583b623

Please sign in to comment.