Remove is_fake field on DebugAdapterBinary instead always use fake adapter for test mode/feature
This commit is contained in:
@@ -100,9 +100,6 @@ pub struct DebugAdapterBinary {
|
||||
pub envs: Option<HashMap<String, String>>,
|
||||
pub cwd: Option<PathBuf>,
|
||||
pub connection: Option<TcpArguments>,
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
// todo(debugger) Find a way to remove this. It's a hack for FakeTransport
|
||||
pub is_fake: bool,
|
||||
}
|
||||
|
||||
pub struct AdapterVersion {
|
||||
@@ -333,7 +330,6 @@ impl DebugAdapter for FakeAdapter {
|
||||
command: "command".into(),
|
||||
arguments: None,
|
||||
connection: None,
|
||||
is_fake: true,
|
||||
envs: None,
|
||||
cwd: None,
|
||||
})
|
||||
|
||||
@@ -106,8 +106,6 @@ impl DebugAdapterClient {
|
||||
port: tcp_transport.port,
|
||||
timeout: Some(tcp_transport.timeout),
|
||||
}),
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
is_fake: binary.is_fake,
|
||||
},
|
||||
_ => self.binary.clone(),
|
||||
};
|
||||
@@ -321,7 +319,6 @@ mod tests {
|
||||
arguments: Default::default(),
|
||||
envs: Default::default(),
|
||||
connection: None,
|
||||
is_fake: true,
|
||||
cwd: None,
|
||||
},
|
||||
Box::new(|_, _| panic!("Did not expect to hit this code path")),
|
||||
@@ -389,7 +386,6 @@ mod tests {
|
||||
arguments: Default::default(),
|
||||
envs: Default::default(),
|
||||
connection: None,
|
||||
is_fake: true,
|
||||
cwd: None,
|
||||
},
|
||||
Box::new({
|
||||
@@ -439,7 +435,6 @@ mod tests {
|
||||
arguments: Default::default(),
|
||||
envs: Default::default(),
|
||||
connection: None,
|
||||
is_fake: true,
|
||||
cwd: None,
|
||||
},
|
||||
Box::new({
|
||||
|
||||
@@ -76,11 +76,9 @@ pub enum Transport {
|
||||
impl Transport {
|
||||
async fn start(binary: &DebugAdapterBinary, cx: AsyncApp) -> Result<(TransportPipe, Self)> {
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
if binary.is_fake {
|
||||
return FakeTransport::start(cx)
|
||||
.await
|
||||
.map(|(transports, fake)| (transports, Self::Fake(fake)));
|
||||
}
|
||||
return FakeTransport::start(cx)
|
||||
.await
|
||||
.map(|(transports, fake)| (transports, Self::Fake(fake)));
|
||||
|
||||
if binary.connection.is_some() {
|
||||
TcpTransport::start(binary, cx)
|
||||
|
||||
@@ -50,8 +50,6 @@ impl DebugAdapter for CustomDebugAdapter {
|
||||
.map(|args| args.iter().map(OsString::from).collect()),
|
||||
cwd: config.cwd.clone(),
|
||||
envs: self.custom_args.envs.clone(),
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
is_fake: false,
|
||||
connection,
|
||||
};
|
||||
Ok(ret)
|
||||
|
||||
@@ -51,8 +51,6 @@ impl DebugAdapter for GdbDebugAdapter {
|
||||
arguments: Some(vec!["-i=dap".into()]),
|
||||
envs: None,
|
||||
cwd: config.cwd.clone(),
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
is_fake: false,
|
||||
connection: None,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -87,8 +87,6 @@ impl DebugAdapter for GoDebugAdapter {
|
||||
port: self.port,
|
||||
timeout: self.timeout,
|
||||
}),
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
is_fake: false,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -94,8 +94,6 @@ impl DebugAdapter for JsDebugAdapter {
|
||||
]),
|
||||
cwd: config.cwd.clone(),
|
||||
envs: None,
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
is_fake: false,
|
||||
connection: Some(adapters::TcpArguments {
|
||||
host: self.host,
|
||||
port: self.port,
|
||||
|
||||
@@ -55,8 +55,6 @@ impl DebugAdapter for LldbDebugAdapter {
|
||||
envs: None,
|
||||
cwd: config.cwd.clone(),
|
||||
connection: None,
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
is_fake: false,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -91,12 +91,10 @@ impl DebugAdapter for PhpDebugAdapter {
|
||||
connection: Some(TcpArguments {
|
||||
port: self.port,
|
||||
host: self.host,
|
||||
timeout: None,
|
||||
timeout: self.timeout,
|
||||
}),
|
||||
cwd: config.cwd.clone(),
|
||||
envs: None,
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
is_fake: false,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -128,8 +128,6 @@ impl DebugAdapter for PythonDebugAdapter {
|
||||
}),
|
||||
cwd: config.cwd.clone(),
|
||||
envs: None,
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
is_fake: false,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user