@@ -92,10 +92,6 @@ const KEYMAP_MIGRATION_TRANSFORMATION_PATTERNS: MigrationPatterns = &[
92
92
) ,
93
93
( ACTION_STRING_PATTERN , rename_string_action) ,
94
94
( CONTEXT_PREDICATE_PATTERN , rename_context_key) ,
95
- (
96
- ACTION_STRING_OF_ARRAY_PATTERN ,
97
- replace_first_string_of_array,
98
- ) ,
99
95
] ;
100
96
101
97
static KEYMAP_MIGRATION_TRANSFORMATION_QUERY : LazyLock < Query > = LazyLock :: new ( || {
@@ -269,51 +265,6 @@ static TRANSFORM_ARRAY: LazyLock<HashMap<(&str, &str), &str>> = LazyLock::new(||
269
265
] )
270
266
} ) ;
271
267
272
- const ACTION_STRING_OF_ARRAY_PATTERN : & str = r#"(document
273
- (array
274
- (object
275
- (pair
276
- key: (string (string_content) @name)
277
- value: (
278
- (object
279
- (pair
280
- key: (string)
281
- value: ((array
282
- . (string (string_content) @action_name)
283
- )
284
- )
285
- )
286
- )
287
- )
288
- )
289
- )
290
- )
291
- (#eq? @name "bindings")
292
- )"# ;
293
-
294
- // ["editor::GoToPrevHunk", { "center_cursor": true }] -> ["editor::GoToPreviousHunk", { "center_cursor": true }]
295
- fn replace_first_string_of_array (
296
- contents : & str ,
297
- mat : & QueryMatch ,
298
- query : & Query ,
299
- ) -> Option < ( Range < usize > , String ) > {
300
- let action_name_ix = query. capture_index_for_name ( "action_name" ) ?;
301
- let action_name = contents. get (
302
- mat. nodes_for_capture_index ( action_name_ix)
303
- . next ( ) ?
304
- . byte_range ( ) ,
305
- ) ?;
306
- let replacement = STRING_OF_ARRAY_REPLACE . get ( action_name) ?;
307
- let range_to_replace = mat
308
- . nodes_for_capture_index ( action_name_ix)
309
- . next ( ) ?
310
- . byte_range ( ) ;
311
- Some ( ( range_to_replace, replacement. to_string ( ) ) )
312
- }
313
-
314
- static STRING_OF_ARRAY_REPLACE : LazyLock < HashMap < & str , & str > > =
315
- LazyLock :: new ( || HashMap :: from_iter ( [ ( "editor::GoToPrevHunk" , "editor::GoToPreviousHunk" ) ] ) ) ;
316
-
317
268
const ACTION_ARGUMENT_OBJECT_PATTERN : & str = r#"(document
318
269
(array
319
270
(object
@@ -485,6 +436,7 @@ static STRING_REPLACE: LazyLock<HashMap<&str, &str>> = LazyLock::new(|| {
485
436
( "pane::ActivatePrevItem" , "pane::ActivatePreviousItem" ) ,
486
437
( "vim::MoveToPrev" , "vim::MoveToPrevious" ) ,
487
438
( "vim::MoveToPrevMatch" , "vim::MoveToPreviousMatch" ) ,
439
+ ( "editor::GoToPrevHunk" , "editor::GoToPreviousHunk" ) ,
488
440
] )
489
441
} ) ;
490
442
@@ -926,36 +878,6 @@ mod tests {
926
878
)
927
879
}
928
880
929
- #[ test]
930
- fn test_string_of_array_replace ( ) {
931
- assert_migrate_keymap (
932
- r#"
933
- [
934
- {
935
- "bindings": {
936
- "ctrl-p": ["editor::GoToPrevHunk", { "center_cursor": true }],
937
- "ctrl-q": ["editor::GoToPrevHunk"],
938
- "ctrl-q": "editor::GoToPrevHunk", // should remain same
939
- }
940
- }
941
- ]
942
- "# ,
943
- Some (
944
- r#"
945
- [
946
- {
947
- "bindings": {
948
- "ctrl-p": ["editor::GoToPreviousHunk", { "center_cursor": true }],
949
- "ctrl-q": ["editor::GoToPreviousHunk"],
950
- "ctrl-q": "editor::GoToPrevHunk", // should remain same
951
- }
952
- }
953
- ]
954
- "# ,
955
- ) ,
956
- )
957
- }
958
-
959
881
#[ test]
960
882
fn test_action_argument_snake_case ( ) {
961
883
// First performs transformations, then replacements
0 commit comments