From 43afa68dab929d0d0e99eb97204d24a7ca5cd397 Mon Sep 17 00:00:00 2001 From: Michael Sloan Date: Mon, 10 Feb 2025 13:01:10 -0700 Subject: [PATCH] Make migration notification not display if some bug causes no changes (#24578) When working on #24442, I did a project wide replacement of `AcceptInlineCompletion` with `AcceptEditPrediction`, as I was updating the branch to mmain and that rename had happened. This also replaced it in the migrator, causing the migration notification to always pop up on keymap changes. Checking if the migration actually changes the text makes it behave better if this variety of bug happens in the future. Release Notes: - N/A --- Cargo.lock | 1 + crates/migrator/Cargo.toml | 1 + crates/migrator/src/migrator.rs | 16 ++++++++++++---- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c5b0bd3c77e9895d699e77c92d813d578930cbd0..4c9bf2c525cd50e00f700d1fa6eb979496f1c1d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7878,6 +7878,7 @@ version = "0.1.0" dependencies = [ "collections", "convert_case 0.7.1", + "log", "pretty_assertions", "streaming-iterator", "tree-sitter", diff --git a/crates/migrator/Cargo.toml b/crates/migrator/Cargo.toml index 11126016a6a1d41830a6ad046d2ff446b9d5c172..865f4278fe5b94def083f25c09b1b32cd5fa6f03 100644 --- a/crates/migrator/Cargo.toml +++ b/crates/migrator/Cargo.toml @@ -15,6 +15,7 @@ doctest = false [dependencies] collections.workspace = true convert_case.workspace = true +log.workspace = true streaming-iterator.workspace = true tree-sitter-json.workspace = true tree-sitter.workspace = true diff --git a/crates/migrator/src/migrator.rs b/crates/migrator/src/migrator.rs index e50b7020173512d7f5f7eb338ecece77ad632f4e..72016ecdfeead3ce63da034b75108fbde1107c3c 100644 --- a/crates/migrator/src/migrator.rs +++ b/crates/migrator/src/migrator.rs @@ -29,11 +29,19 @@ fn migrate(text: &str, patterns: MigrationPatterns, query: &Query) -> Option