Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Improve scoring

Antonio Scandurracbf716005496
diff --git a/crates/ai/src/streaming_diff.rs b/crates/ai/src/streaming_diff.rs
index 1e5189d4d88..5425b75bbe8 100644
--- a/crates/ai/src/streaming_diff.rs
+++ b/crates/ai/src/streaming_diff.rs
@@ -83,8 +83,8 @@ pub struct StreamingDiff {
impl StreamingDiff {
const INSERTION_SCORE: f64 = -1.;
const DELETION_SCORE: f64 = -5.;
- const EQUALITY_BASE: f64 = 2.;
- const MAX_EQUALITY_EXPONENT: i32 = 32;
+ const EQUALITY_BASE: f64 = 1.4;
+ const MAX_EQUALITY_EXPONENT: i32 = 64;
pub fn new(old: String) -> Self {
let old = old.chars().collect::<Vec<_>>();
@@ -120,7 +120,7 @@ impl StreamingDiff {
if self.old[i - 1] == ' ' {
self.scores.get(i - 1, j - 1)
} else {
- let exponent = cmp::min(equal_run as i32 / 3, Self::MAX_EQUALITY_EXPONENT);
+ let exponent = cmp::min(equal_run as i32, Self::MAX_EQUALITY_EXPONENT);
self.scores.get(i - 1, j - 1) + Self::EQUALITY_BASE.powi(exponent)
}
} else {