From f3ccd152e99d6bccfec58275c0b3b2ec3ffd5bdd Mon Sep 17 00:00:00 2001 From: Dhruv Manilawala Date: Fri, 5 Jul 2024 11:58:35 +0530 Subject: [PATCH] Revert "Remove `--preview` as a required argument for `ruff server` (#12053)" (#12196) This reverts commit b28dc9ac14dd83175e65ed40c54ca65665c2dea5. We're not ready to stabilize the server yet. There's some pending work for the VS Code extension and documentation improvements. This change is to unblock Ruff release. --- crates/ruff/src/commands/server.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crates/ruff/src/commands/server.rs b/crates/ruff/src/commands/server.rs index ef7b8a42e9f33..d35b2c1ce46f6 100644 --- a/crates/ruff/src/commands/server.rs +++ b/crates/ruff/src/commands/server.rs @@ -4,7 +4,12 @@ use crate::ExitStatus; use anyhow::Result; use ruff_server::Server; -pub(crate) fn run_server(_preview: bool, worker_threads: NonZeroUsize) -> Result { +pub(crate) fn run_server(preview: bool, worker_threads: NonZeroUsize) -> Result { + if !preview { + tracing::error!("--preview needs to be provided as a command line argument while the server is still unstable.\nFor example: `ruff server --preview`"); + return Ok(ExitStatus::Error); + } + let server = Server::new(worker_threads)?; server.run().map(|()| ExitStatus::Success)