aboutsummaryrefslogtreecommitdiff
path: root/crates/assists
diff options
context:
space:
mode:
Diffstat (limited to 'crates/assists')
-rw-r--r--crates/assists/src/utils/insert_use.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/crates/assists/src/utils/insert_use.rs b/crates/assists/src/utils/insert_use.rs
index dbe2dfdcb..8842068e6 100644
--- a/crates/assists/src/utils/insert_use.rs
+++ b/crates/assists/src/utils/insert_use.rs
@@ -10,6 +10,7 @@ use syntax::{
10}; 10};
11 11
12use crate::assist_context::AssistContext; 12use crate::assist_context::AssistContext;
13use test_utils::mark;
13 14
14/// Determines the containing syntax node in which to insert a `use` statement affecting `position`. 15/// Determines the containing syntax node in which to insert a `use` statement affecting `position`.
15pub(crate) fn find_insert_use_container( 16pub(crate) fn find_insert_use_container(
@@ -126,6 +127,7 @@ pub fn try_merge_trees(
126 if merge_behaviour == MergeBehaviour::Last 127 if merge_behaviour == MergeBehaviour::Last
127 && (use_tree_list_is_nested(&lhs_tl) || use_tree_list_is_nested(&rhs_tl)) 128 && (use_tree_list_is_nested(&lhs_tl) || use_tree_list_is_nested(&rhs_tl))
128 { 129 {
130 mark::hit!(test_last_merge_too_long);
129 return None; 131 return None;
130 } 132 }
131 133
@@ -586,6 +588,17 @@ use std::io;",
586 ) 588 )
587 } 589 }
588 590
591 #[test]
592 fn merge_last_too_long() {
593 mark::check!(test_last_merge_too_long);
594 check_last(
595 "foo::bar",
596 r"use foo::bar::baz::Qux;",
597 r"use foo::bar::baz::Qux;
598use foo::bar;",
599 );
600 }
601
589 fn check( 602 fn check(
590 path: &str, 603 path: &str,
591 ra_fixture_before: &str, 604 ra_fixture_before: &str,