Add initial support for WSL (#37035)
Closes #36188 ## Todo * [x] CLI * [x] terminals * [x] tasks ## For future PRs * debugging * UI for opening WSL projects * fixing workspace state restoration Release Notes: - Windows alpha: Zed now supports editing folders in WSL. --------- Co-authored-by: Junkui Zhang <364772080@qq.com>
This commit is contained in:
co-authored by
Junkui Zhang
parent
1c2e2a00fe
commit
f78f3e7729
@@ -12,7 +12,7 @@ use db::sqlez::{
|
||||
use gpui::{AsyncWindowContext, Entity, WeakEntity};
|
||||
|
||||
use project::{Project, debugger::breakpoint_store::SourceBreakpoint};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use remote::RemoteConnectionOptions;
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
path::{Path, PathBuf},
|
||||
@@ -24,19 +24,18 @@ use uuid::Uuid;
|
||||
#[derive(
|
||||
Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, serde::Serialize, serde::Deserialize,
|
||||
)]
|
||||
pub(crate) struct SshConnectionId(pub u64);
|
||||
pub(crate) struct RemoteConnectionId(pub u64);
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Deserialize, Serialize)]
|
||||
pub struct SerializedSshConnection {
|
||||
pub host: String,
|
||||
pub port: Option<u16>,
|
||||
pub user: Option<String>,
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub(crate) enum RemoteConnectionKind {
|
||||
Ssh,
|
||||
Wsl,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone)]
|
||||
pub enum SerializedWorkspaceLocation {
|
||||
Local,
|
||||
Ssh(SerializedSshConnection),
|
||||
Remote(RemoteConnectionOptions),
|
||||
}
|
||||
|
||||
impl SerializedWorkspaceLocation {
|
||||
@@ -68,6 +67,23 @@ pub struct DockStructure {
|
||||
pub(crate) bottom: DockData,
|
||||
}
|
||||
|
||||
impl RemoteConnectionKind {
|
||||
pub(crate) fn serialize(&self) -> &'static str {
|
||||
match self {
|
||||
RemoteConnectionKind::Ssh => "ssh",
|
||||
RemoteConnectionKind::Wsl => "wsl",
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn deserialize(text: &str) -> Option<Self> {
|
||||
match text {
|
||||
"ssh" => Some(Self::Ssh),
|
||||
"wsl" => Some(Self::Wsl),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Column for DockStructure {
|
||||
fn column(statement: &mut Statement, start_index: i32) -> Result<(Self, i32)> {
|
||||
let (left, next_index) = DockData::column(statement, start_index)?;
|
||||
|
||||
Reference in New Issue
Block a user