Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
ep: Make `tree-sitter` dependency optional in `edit_prediction_metrics` (#57829)
Ben Kunklea65e677376f2
diff --git a/crates/edit_prediction/Cargo.toml b/crates/edit_prediction/Cargo.tomlindex 9e4805938f2..ea11fac3cd9 100644--- a/crates/edit_prediction/Cargo.toml+++ b/crates/edit_prediction/Cargo.toml@@ -31,7 +31,7 @@ credentials_provider.workspace = truedb.workspace = trueedit_prediction_types.workspace = trueedit_prediction_context.workspace = true-edit_prediction_metrics.workspace = true+edit_prediction_metrics = { workspace = true, features = ["tree-sitter"] }feature_flags.workspace = truefs.workspace = truefutures.workspace = truediff --git a/crates/edit_prediction_cli/Cargo.toml b/crates/edit_prediction_cli/Cargo.tomlindex 97db020a552..81e91fa262d 100644--- a/crates/edit_prediction_cli/Cargo.toml+++ b/crates/edit_prediction_cli/Cargo.toml@@ -61,7 +61,7 @@ terminal_view.workspace = trueutil.workspace = truewatch.workspace = trueedit_prediction = { workspace = true, features = ["cli-support"] }-edit_prediction_metrics.workspace = true+edit_prediction_metrics = { workspace = true, features = ["tree-sitter"] }telemetry_events.workspace = truewasmtime.workspace = truezeta_prompt.workspace = truediff --git a/crates/edit_prediction_metrics/Cargo.toml b/crates/edit_prediction_metrics/Cargo.tomlindex ba4990d9381..080c3a60b2c 100644--- a/crates/edit_prediction_metrics/Cargo.toml+++ b/crates/edit_prediction_metrics/Cargo.toml@@ -11,12 +11,15 @@ workspace = true[lib]path = "src/edit_prediction_metrics.rs"+[features]+tree-sitter = ["dep:tree-sitter"]+[dependencies]imara-diff.workspace = trueserde.workspace = trueserde_json = "1.0"similar = "2.7.0"-tree-sitter.workspace = true+tree-sitter = { workspace = true, optional = true }zeta_prompt.workspace = true[dev-dependencies]diff --git a/crates/edit_prediction_metrics/src/edit_prediction_metrics.rs b/crates/edit_prediction_metrics/src/edit_prediction_metrics.rsindex 74ad639b7e9..81a37148c79 100644--- a/crates/edit_prediction_metrics/src/edit_prediction_metrics.rs+++ b/crates/edit_prediction_metrics/src/edit_prediction_metrics.rs@@ -4,6 +4,7 @@ mod prediction_score;mod reversal;mod summary;mod tokenize;+#[cfg(feature = "tree-sitter")]mod tree_sitter;pub use kept_rate::AnnotatedToken;@@ -30,4 +31,5 @@ pub use prediction_score::{};pub use reversal::compute_prediction_reversal_ratio_from_history;pub use summary::{PredictionSummaryInput, QaSummaryData, SummaryJson, compute_summary};+#[cfg(feature = "tree-sitter")]pub use tree_sitter::count_tree_sitter_errors;