mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Downmap the token in attribute inputs when expanding speculatively
This commit is contained in:
parent
2b907652ee
commit
aa1b36dc6d
4 changed files with 154 additions and 21 deletions
|
@ -73,3 +73,73 @@ fn main() {
|
|||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn complete_dot_in_attr_input() {
|
||||
check(
|
||||
r#"
|
||||
//- proc_macros: input_replace
|
||||
pub struct Foo;
|
||||
impl Foo {
|
||||
fn foo(&self) {}
|
||||
}
|
||||
|
||||
#[proc_macros::input_replace(
|
||||
fn suprise() {
|
||||
Foo.$0
|
||||
}
|
||||
)]
|
||||
fn main() {}
|
||||
"#,
|
||||
expect![[r#"
|
||||
me foo() fn(&self)
|
||||
sn ref &expr
|
||||
sn refm &mut expr
|
||||
sn match match expr {}
|
||||
sn box Box::new(expr)
|
||||
sn ok Ok(expr)
|
||||
sn err Err(expr)
|
||||
sn some Some(expr)
|
||||
sn dbg dbg!(expr)
|
||||
sn dbgr dbg!(&expr)
|
||||
sn call function(expr)
|
||||
sn let let
|
||||
sn letm let mut
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn complete_dot_in_attr_input2() {
|
||||
check(
|
||||
r#"
|
||||
//- proc_macros: input_replace
|
||||
pub struct Foo;
|
||||
impl Foo {
|
||||
fn foo(&self) {}
|
||||
}
|
||||
|
||||
#[proc_macros::input_replace(
|
||||
fn suprise() {
|
||||
Foo.f$0
|
||||
}
|
||||
)]
|
||||
fn main() {}
|
||||
"#,
|
||||
expect![[r#"
|
||||
me foo() fn(&self)
|
||||
sn ref &expr
|
||||
sn refm &mut expr
|
||||
sn match match expr {}
|
||||
sn box Box::new(expr)
|
||||
sn ok Ok(expr)
|
||||
sn err Err(expr)
|
||||
sn some Some(expr)
|
||||
sn dbg dbg!(expr)
|
||||
sn dbgr dbg!(&expr)
|
||||
sn call function(expr)
|
||||
sn let let
|
||||
sn letm let mut
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue