File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed
crates/ide_completion/src Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -285,6 +285,7 @@ fn maximize_name_ref(name_ref: &ast::NameRef) -> SyntaxNode {
285285}
286286
287287fn find_node_with_range < N : AstNode > ( syntax : & SyntaxNode , range : TextRange ) -> Option < N > {
288+ let range = syntax. text_range ( ) . intersect ( range) ?;
288289 syntax. covering_element ( range) . ancestors ( ) . find_map ( N :: cast)
289290}
290291
Original file line number Diff line number Diff line change @@ -75,13 +75,13 @@ pub(crate) const TEST_CONFIG: CompletionConfig = CompletionConfig {
7575 } ,
7676} ;
7777
78- pub ( crate ) fn completion_list ( code : & str ) -> String {
79- completion_list_with_config ( TEST_CONFIG , code )
78+ pub ( crate ) fn completion_list ( ra_fixture : & str ) -> String {
79+ completion_list_with_config ( TEST_CONFIG , ra_fixture )
8080}
8181
82- fn completion_list_with_config ( config : CompletionConfig , code : & str ) -> String {
82+ fn completion_list_with_config ( config : CompletionConfig , ra_fixture : & str ) -> String {
8383 // filter out all but one builtintype completion for smaller test outputs
84- let items = get_all_items ( config, code ) ;
84+ let items = get_all_items ( config, ra_fixture ) ;
8585 let mut bt_seen = false ;
8686 let items = items
8787 . into_iter ( )
@@ -227,3 +227,26 @@ fn test_no_completions_required() {
227227 cov_mark:: check!( no_completion_required) ;
228228 check_no_completion ( r#"fn foo() { for i i$0 }"# ) ;
229229}
230+
231+ #[ test]
232+ fn regression_10042 ( ) {
233+ completion_list (
234+ r#"
235+ macro_rules! preset {
236+ ($($x:ident)&&*) => {
237+ {
238+ let mut v = Vec::new();
239+ $(
240+ v.push($x.into());
241+ )*
242+ v
243+ }
244+ };
245+ }
246+
247+ fn foo() {
248+ preset!(foo$0);
249+ }
250+ "# ,
251+ ) ;
252+ }
You can’t perform that action at this time.
0 commit comments