mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Don't complete paths after attributes
This commit is contained in:
parent
9ea6ee6b27
commit
11115ebad8
7 changed files with 151 additions and 163 deletions
|
@ -9,6 +9,64 @@ fn in_mod_item_list() {
|
|||
$0
|
||||
}
|
||||
"#,
|
||||
expect![[r##"
|
||||
kw pub(crate)
|
||||
kw pub
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
kw impl
|
||||
kw extern
|
||||
kw use
|
||||
kw trait
|
||||
kw static
|
||||
kw mod
|
||||
kw enum
|
||||
kw struct
|
||||
kw union
|
||||
sn tmod (Test module)
|
||||
sn tfn (Test function)
|
||||
sn macro_rules
|
||||
ma foo!(…) #[macro_export] macro_rules! foo
|
||||
"##]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn in_source_file_item_list() {
|
||||
check(
|
||||
r#"$0"#,
|
||||
expect![[r##"
|
||||
kw pub(crate)
|
||||
kw pub
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
kw impl
|
||||
kw extern
|
||||
kw use
|
||||
kw trait
|
||||
kw static
|
||||
kw mod
|
||||
kw enum
|
||||
kw struct
|
||||
kw union
|
||||
sn tmod (Test module)
|
||||
sn tfn (Test function)
|
||||
sn macro_rules
|
||||
md bar
|
||||
ma foo!(…) #[macro_export] macro_rules! foo
|
||||
ma foo!(…) #[macro_export] macro_rules! foo
|
||||
"##]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn in_item_list_after_attr() {
|
||||
check(
|
||||
r#"#[attr] $0"#,
|
||||
expect![[r#"
|
||||
kw pub(crate)
|
||||
kw pub
|
||||
|
@ -32,56 +90,10 @@ fn in_mod_item_list() {
|
|||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn in_source_file_item_list() {
|
||||
check(
|
||||
r#"
|
||||
enum Enum { Variant }
|
||||
struct MyStruct {}
|
||||
#[macro_export]
|
||||
macro_rules! foo {}
|
||||
mod bar {}
|
||||
const CONST: () = ();
|
||||
|
||||
$0"#,
|
||||
expect![[r##"
|
||||
kw pub(crate)
|
||||
kw pub
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
kw impl
|
||||
kw extern
|
||||
kw use
|
||||
kw trait
|
||||
kw static
|
||||
kw mod
|
||||
kw enum
|
||||
kw struct
|
||||
kw union
|
||||
sn tmod (Test module)
|
||||
sn tfn (Test function)
|
||||
sn macro_rules
|
||||
md bar
|
||||
ma foo!(…) #[macro_export] macro_rules! foo
|
||||
ma foo!(…) #[macro_export] macro_rules! foo
|
||||
"##]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn in_qualified_path() {
|
||||
check(
|
||||
r#"
|
||||
enum Enum { Variant }
|
||||
struct MyStruct {}
|
||||
#[macro_export]
|
||||
macro_rules! foo {}
|
||||
mod bar {}
|
||||
const CONST: () = ();
|
||||
|
||||
crate::$0"#,
|
||||
r#"crate::$0"#,
|
||||
expect![[r##"
|
||||
kw pub(crate)
|
||||
kw pub
|
||||
|
@ -98,11 +110,8 @@ crate::$0"#,
|
|||
kw enum
|
||||
kw struct
|
||||
kw union
|
||||
sn tmod (Test module)
|
||||
sn tfn (Test function)
|
||||
sn macro_rules
|
||||
md bar
|
||||
ma foo!(…) #[macro_export] macro_rules! foo
|
||||
ma foo!(…) #[macro_export] macro_rules! foo
|
||||
"##]],
|
||||
)
|
||||
}
|
||||
|
@ -110,15 +119,7 @@ crate::$0"#,
|
|||
#[test]
|
||||
fn after_unsafe_token() {
|
||||
check(
|
||||
r#"
|
||||
enum Enum { Variant }
|
||||
struct MyStruct {}
|
||||
#[macro_export]
|
||||
macro_rules! foo {}
|
||||
mod bar {}
|
||||
const CONST: () = ();
|
||||
|
||||
unsafe $0"#,
|
||||
r#"unsafe $0"#,
|
||||
expect![[r#"
|
||||
kw fn
|
||||
kw trait
|
||||
|
@ -130,15 +131,7 @@ unsafe $0"#,
|
|||
#[test]
|
||||
fn after_visibility() {
|
||||
check(
|
||||
r#"
|
||||
enum Enum { Variant }
|
||||
struct MyStruct {}
|
||||
#[macro_export]
|
||||
macro_rules! foo {}
|
||||
mod bar {}
|
||||
const CONST: () = ();
|
||||
|
||||
pub $0"#,
|
||||
r#"pub $0"#,
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw fn
|
||||
|
@ -154,3 +147,69 @@ pub $0"#,
|
|||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn after_visibility_unsafe() {
|
||||
// FIXME this shouldn't show `impl`
|
||||
check(
|
||||
r#"pub unsafe $0"#,
|
||||
expect![[r#"
|
||||
kw fn
|
||||
kw trait
|
||||
kw impl
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn in_impl_assoc_item_list() {
|
||||
check(
|
||||
r#"impl Struct {
|
||||
$0
|
||||
}"#,
|
||||
expect![[r##"
|
||||
kw pub(crate)
|
||||
kw pub
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
md bar
|
||||
ma foo!(…) #[macro_export] macro_rules! foo
|
||||
ma foo!(…) #[macro_export] macro_rules! foo
|
||||
"##]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn in_impl_assoc_item_list_after_attr() {
|
||||
check(
|
||||
r#"impl Struct {
|
||||
#[attr] $0
|
||||
}"#,
|
||||
expect![[r#"
|
||||
kw pub(crate)
|
||||
kw pub
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn in_trait_assoc_item_list() {
|
||||
check(
|
||||
r"trait Foo { $0 }",
|
||||
expect![[r##"
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
md bar
|
||||
ma foo!(…) #[macro_export] macro_rules! foo
|
||||
ma foo!(…) #[macro_export] macro_rules! foo
|
||||
"##]],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue