Refactor prettier (#17977)

In preparation for making formatting work on ssh remotes

Release Notes:

- N/A

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Conrad Irwin 2024-09-17 16:37:56 -06:00 committed by GitHub
parent db18f7a2b0
commit 8e45bf71ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 911 additions and 705 deletions

View file

@ -462,3 +462,52 @@ impl NodeRuntime for FakeNodeRuntime {
unreachable!("Should not install packages {packages:?}")
}
}
// TODO: Remove this when headless binary can run node
pub struct DummyNodeRuntime;
impl DummyNodeRuntime {
pub fn new() -> Arc<dyn NodeRuntime> {
Arc::new(Self)
}
}
#[async_trait::async_trait]
impl NodeRuntime for DummyNodeRuntime {
async fn binary_path(&self) -> anyhow::Result<PathBuf> {
anyhow::bail!("Dummy Node Runtime")
}
async fn node_environment_path(&self) -> anyhow::Result<OsString> {
anyhow::bail!("Dummy node runtime")
}
async fn run_npm_subcommand(
&self,
_: Option<&Path>,
_subcommand: &str,
_args: &[&str],
) -> anyhow::Result<Output> {
anyhow::bail!("Dummy node runtime")
}
async fn npm_package_latest_version(&self, _name: &str) -> anyhow::Result<String> {
anyhow::bail!("Dummy node runtime")
}
async fn npm_package_installed_version(
&self,
_local_package_directory: &Path,
_name: &str,
) -> Result<Option<String>> {
anyhow::bail!("Dummy node runtime")
}
async fn npm_install_packages(
&self,
_: &Path,
_packages: &[(&str, &str)],
) -> anyhow::Result<()> {
anyhow::bail!("Dummy node runtime")
}
}