mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Fix cfg completions not working
This commit is contained in:
parent
ca6ddd8ea3
commit
853f8a21f7
4 changed files with 98 additions and 33 deletions
|
@ -66,11 +66,6 @@ struct Foo;
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn inside_nested_attr() {
|
||||
check(r#"#[cfg($0)]"#, expect![[]])
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn with_existing_attr() {
|
||||
check(
|
||||
|
@ -635,6 +630,32 @@ struct Foo;
|
|||
mod cfg {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn inside_cfg() {
|
||||
check(
|
||||
r#"
|
||||
//- /main.rs cfg:test,dbg=false,opt_level=2
|
||||
#[cfg($0)]
|
||||
"#,
|
||||
expect![[r#"
|
||||
ba dbg
|
||||
ba opt_level
|
||||
ba test
|
||||
"#]],
|
||||
);
|
||||
check(
|
||||
r#"
|
||||
//- /main.rs cfg:test,dbg=false,opt_level=2
|
||||
#[cfg(b$0)]
|
||||
"#,
|
||||
expect![[r#"
|
||||
ba dbg
|
||||
ba opt_level
|
||||
ba test
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn cfg_target_endian() {
|
||||
check(
|
||||
|
@ -644,6 +665,13 @@ mod cfg {
|
|||
ba little
|
||||
"#]],
|
||||
);
|
||||
check(
|
||||
r#"#[cfg(target_endian = b$0"#,
|
||||
expect![[r#"
|
||||
ba big
|
||||
ba little
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue