File tree Expand file tree Collapse file tree 1 file changed +33
-3
lines changed
src/tools/rust-analyzer/crates/ide-completion/src/completions/item_list Expand file tree Collapse file tree 1 file changed +33
-3
lines changed Original file line number Diff line number Diff line change @@ -133,8 +133,11 @@ pub(crate) fn complete_trait_impl_item_by_name(
133133 acc,
134134 ctx,
135135 ImplCompletionKind :: All ,
136- match name_ref {
137- Some ( name) => name. syntax ( ) . text_range ( ) ,
136+ match name_ref
137+ . as_ref ( )
138+ . and_then ( |name| ctx. sema . original_syntax_node_rooted ( name. syntax ( ) ) )
139+ {
140+ Some ( name) => name. text_range ( ) ,
138141 None => ctx. source_range ( ) ,
139142 } ,
140143 impl_,
@@ -516,7 +519,7 @@ fn function_declaration(
516519mod tests {
517520 use expect_test:: expect;
518521
519- use crate :: tests:: { check_edit, check_no_kw} ;
522+ use crate :: tests:: { check , check_edit, check_no_kw} ;
520523
521524 #[ test]
522525 fn no_completion_inside_fn ( ) {
@@ -1639,4 +1642,31 @@ impl DesugaredAsyncTrait for () {
16391642"# ,
16401643 ) ;
16411644 }
1645+
1646+ #[ test]
1647+ fn within_attr_macro ( ) {
1648+ check (
1649+ r#"
1650+ //- proc_macros: identity
1651+ trait Trait {
1652+ fn foo(&self) {}
1653+ fn bar(&self) {}
1654+ fn baz(&self) {}
1655+ }
1656+
1657+ #[proc_macros::identity]
1658+ impl Trait for () {
1659+ f$0
1660+ }
1661+ "# ,
1662+ expect ! [ [ r#"
1663+ me fn bar(..)
1664+ me fn baz(..)
1665+ me fn foo(..)
1666+ md proc_macros
1667+ kw crate::
1668+ kw self::
1669+ "# ] ] ,
1670+ ) ;
1671+ }
16421672}
You can’t perform that action at this time.
0 commit comments