mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Speculatively expand attributes in completions
This commit is contained in:
parent
c3eb646487
commit
2b907652ee
7 changed files with 238 additions and 66 deletions
75
crates/ide_completion/src/tests/proc_macros.rs
Normal file
75
crates/ide_completion/src/tests/proc_macros.rs
Normal file
|
@ -0,0 +1,75 @@
|
|||
//! Completion tests for expressions.
|
||||
use expect_test::{expect, Expect};
|
||||
|
||||
use crate::tests::completion_list;
|
||||
|
||||
fn check(ra_fixture: &str, expect: Expect) {
|
||||
let actual = completion_list(ra_fixture);
|
||||
expect.assert_eq(&actual)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn complete_dot_in_attr() {
|
||||
check(
|
||||
r#"
|
||||
//- proc_macros: identity
|
||||
pub struct Foo;
|
||||
impl Foo {
|
||||
fn foo(&self) {}
|
||||
}
|
||||
|
||||
#[proc_macros::identity]
|
||||
fn main() {
|
||||
Foo.$0
|
||||
}
|
||||
"#,
|
||||
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_attr2() {
|
||||
check(
|
||||
r#"
|
||||
//- proc_macros: identity
|
||||
pub struct Foo;
|
||||
impl Foo {
|
||||
fn foo(&self) {}
|
||||
}
|
||||
|
||||
#[proc_macros::identity]
|
||||
fn main() {
|
||||
Foo.f$0
|
||||
}
|
||||
"#,
|
||||
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