aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorLukas Wirth <[email protected]>2020-09-02 18:34:01 +0100
committerLukas Wirth <[email protected]>2020-09-03 17:36:07 +0100
commit07ff9eeca8136563e7d1c09ec82cff9a67ed975a (patch)
tree624b8a2c1caf3bc48833905c30e804267da4ae71 /crates
parent74186d3ae7265b691f00b562f802ed5bdcda5c89 (diff)
Use mark to check that paths that are too long will not be merged
Diffstat (limited to 'crates')
-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,