Move the edit tool's hot-path diffing operations from JS to native Rust: - `normalizeForFuzzyMatch`: single-pass Unicode normalization (smart quotes, dashes, special spaces, trailing whitespace) - `fuzzyFindText`: exact-then-fuzzy substring search with UTF-16 index conversion for JS compatibility - `generateDiff`: unified diff generation using the `similar` crate (Myers' algorithm with optimizations) The Rust module at `native/crates/engine/src/diff.rs` exposes three napi functions. The TypeScript wrapper at `packages/native/src/diff/` follows the existing module pattern. `edit-diff.ts` now delegates to native implementations while keeping line-ending handling and file I/O in JS. 18 tests covering normalization, fuzzy matching (including UTF-16 index correctness with emoji/surrogate pairs), and diff generation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| ast | ||
| engine | ||
| grep | ||