Remove filtered completion list usage in completion tests
This commit is contained in:
parent
142b6dc650
commit
722489e3ff
@ -99,13 +99,10 @@ fn complete_methods(
|
||||
mod tests {
|
||||
use expect_test::{expect, Expect};
|
||||
|
||||
use crate::{
|
||||
tests::{check_edit, filtered_completion_list},
|
||||
CompletionKind,
|
||||
};
|
||||
use crate::tests::{check_edit, completion_list_no_kw};
|
||||
|
||||
fn check(ra_fixture: &str, expect: Expect) {
|
||||
let actual = filtered_completion_list(ra_fixture, CompletionKind::Reference);
|
||||
let actual = completion_list_no_kw(ra_fixture);
|
||||
expect.assert_eq(&actual);
|
||||
}
|
||||
|
||||
@ -122,6 +119,18 @@ fn foo(s: S) { s.$0 }
|
||||
expect![[r#"
|
||||
fd foo u32
|
||||
me bar() 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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -138,6 +147,18 @@ impl S {
|
||||
expect![[r#"
|
||||
fd the_field (u32,)
|
||||
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
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
@ -154,6 +175,18 @@ impl A {
|
||||
expect![[r#"
|
||||
fd the_field (u32, i32)
|
||||
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
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
@ -166,7 +199,18 @@ impl A {
|
||||
struct A { the_field: u32 }
|
||||
fn foo(a: A) { a.$0() }
|
||||
"#,
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
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)
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
@ -191,6 +235,18 @@ fn foo(a: lib::m::A) { a.$0 }
|
||||
fd pub_field u32
|
||||
fd crate_field u32
|
||||
fd super_field u32
|
||||
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
|
||||
"#]],
|
||||
);
|
||||
|
||||
@ -210,6 +266,18 @@ fn foo(a: lib::m::A) { a.$0 }
|
||||
"#,
|
||||
expect![[r#"
|
||||
fd pub_field u32
|
||||
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
|
||||
"#]],
|
||||
);
|
||||
|
||||
@ -226,7 +294,19 @@ pub mod m {
|
||||
fn foo(a: lib::m::A) { a.$0 }
|
||||
"#,
|
||||
expect![[r#"
|
||||
fd 1 f64
|
||||
fd 1 f64
|
||||
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
|
||||
"#]],
|
||||
);
|
||||
|
||||
@ -248,6 +328,18 @@ fn foo(a: lib::A) { a.$0 }
|
||||
me private_method() fn(&self)
|
||||
me crate_method() fn(&self)
|
||||
me pub_method() 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
|
||||
"#]],
|
||||
);
|
||||
check(
|
||||
@ -266,6 +358,18 @@ fn foo(a: lib::A) { a.$0 }
|
||||
"#,
|
||||
expect![[r#"
|
||||
me pub_method() 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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -293,6 +397,18 @@ impl A {
|
||||
expect![[r#"
|
||||
fd pub_field u32
|
||||
me pub_method() 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
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
@ -307,6 +423,18 @@ fn foo(u: U) { u.$0 }
|
||||
expect![[r#"
|
||||
fd field u8
|
||||
fd other u16
|
||||
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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -326,6 +454,18 @@ fn foo(a: A<u32>) { a.$0 }
|
||||
"#,
|
||||
expect![[r#"
|
||||
me the_method() 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
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
@ -341,6 +481,18 @@ fn foo(a: A) { a.$0 }
|
||||
"#,
|
||||
expect![[r#"
|
||||
me the_method() (as Trait) 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
|
||||
"#]],
|
||||
);
|
||||
check_edit(
|
||||
@ -371,6 +523,18 @@ fn foo(a: &A) { a.$0 }
|
||||
",
|
||||
expect![[r#"
|
||||
me the_method() (as Trait) 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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -389,6 +553,18 @@ fn foo(a: A) { a.$0 }
|
||||
",
|
||||
expect![[r#"
|
||||
me the_method() (as Trait) 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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -405,7 +581,20 @@ fn foo(a: A) {
|
||||
a.$0
|
||||
}
|
||||
"#,
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
@ -419,8 +608,20 @@ fn foo() {
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
fd 0 i32
|
||||
fd 1 f64
|
||||
fd 0 i32
|
||||
fd 1 f64
|
||||
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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -436,8 +637,20 @@ fn foo() {
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
fd 0 i32
|
||||
fd 1 f64
|
||||
fd 0 i32
|
||||
fd 1 f64
|
||||
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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -460,6 +673,18 @@ impl T {
|
||||
"#,
|
||||
expect![[r#"
|
||||
me blah() 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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -475,6 +700,18 @@ const X: u32 = {
|
||||
"#,
|
||||
expect![[r#"
|
||||
fd the_field u32
|
||||
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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -491,6 +728,16 @@ fn foo(a: A) {
|
||||
"#,
|
||||
expect![[r#"
|
||||
fd the_field u32
|
||||
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)
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -508,6 +755,16 @@ fn foo(a: A) {
|
||||
"#,
|
||||
expect![[r#"
|
||||
fd the_field u32
|
||||
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)
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -524,6 +781,16 @@ fn foo(a: A) {
|
||||
"#,
|
||||
expect![[r#"
|
||||
fd the_field u32
|
||||
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)
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -550,6 +817,16 @@ fn foo(a: A) {
|
||||
"#,
|
||||
expect![[r#"
|
||||
fd the_field u32
|
||||
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)
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -569,6 +846,18 @@ fn foo() {
|
||||
"#,
|
||||
expect![[r#"
|
||||
me the_method() 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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -584,6 +873,18 @@ fn main() { make_s!().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
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
@ -612,6 +913,18 @@ mod foo {
|
||||
"#,
|
||||
expect![[r#"
|
||||
me private() 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
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -639,6 +952,16 @@ impl S {
|
||||
"#,
|
||||
expect![[r#"
|
||||
me foo() fn(&self) -> &[u8]
|
||||
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)
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -654,6 +977,7 @@ impl Foo { fn foo(&self) { $0 } }"#,
|
||||
lc self &Foo
|
||||
sp Self
|
||||
st Foo
|
||||
bt u32
|
||||
fd self.field i32
|
||||
me self.foo() fn(&self)
|
||||
"#]],
|
||||
@ -667,6 +991,7 @@ impl Foo { fn foo(&mut self) { $0 } }"#,
|
||||
lc self &mut Foo
|
||||
sp Self
|
||||
st Foo
|
||||
bt u32
|
||||
fd self.0 i32
|
||||
me self.foo() fn(&mut self)
|
||||
"#]],
|
||||
@ -694,6 +1019,16 @@ fn f() {
|
||||
"#,
|
||||
expect![[r#"
|
||||
me method() 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)
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
@ -716,6 +1051,18 @@ fn main() {
|
||||
"#,
|
||||
expect![[r#"
|
||||
me into_iter() (as IntoIterator) fn(self) -> <Self as IntoIterator>::IntoIter
|
||||
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
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -181,115 +181,15 @@ fn add_keyword(ctx: &CompletionContext, acc: &mut Completions, kw: &str, snippet
|
||||
mod tests {
|
||||
use expect_test::{expect, Expect};
|
||||
|
||||
use crate::{
|
||||
tests::{check_edit, filtered_completion_list},
|
||||
CompletionKind,
|
||||
};
|
||||
use crate::tests::{check_edit, completion_list};
|
||||
|
||||
fn check(ra_fixture: &str, expect: Expect) {
|
||||
let actual = filtered_completion_list(ra_fixture, CompletionKind::Keyword);
|
||||
let actual = completion_list(ra_fixture);
|
||||
expect.assert_eq(&actual)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_keywords_in_function() {
|
||||
check(
|
||||
r"fn quux() { $0 }",
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
kw impl
|
||||
kw extern
|
||||
kw use
|
||||
kw trait
|
||||
kw static
|
||||
kw mod
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw let
|
||||
kw return
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_keywords_inside_block() {
|
||||
check(
|
||||
r"fn quux() { if true { $0 } }",
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
kw impl
|
||||
kw extern
|
||||
kw use
|
||||
kw trait
|
||||
kw static
|
||||
kw mod
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw let
|
||||
kw return
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_keywords_after_if() {
|
||||
check(
|
||||
r#"fn quux() { if true { () } $0 }"#,
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
kw impl
|
||||
kw extern
|
||||
kw use
|
||||
kw trait
|
||||
kw static
|
||||
kw mod
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw let
|
||||
kw else
|
||||
kw else if
|
||||
kw return
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
"#]],
|
||||
);
|
||||
fn test_else_edit_after_if() {
|
||||
check_edit(
|
||||
"else",
|
||||
r#"fn quux() { if true { () } $0 }"#,
|
||||
@ -299,68 +199,6 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_keywords_in_match_arm() {
|
||||
check(
|
||||
r#"
|
||||
fn quux() -> i32 {
|
||||
match () { () => $0 }
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw return
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_keywords_in_loop() {
|
||||
check(
|
||||
r"fn my() { loop { $0 } }",
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
kw impl
|
||||
kw extern
|
||||
kw use
|
||||
kw trait
|
||||
kw static
|
||||
kw mod
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw let
|
||||
kw continue
|
||||
kw break
|
||||
kw return
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_keywords_after_unsafe_in_block_expr() {
|
||||
check(
|
||||
@ -369,38 +207,12 @@ fn quux() -> i32 {
|
||||
kw fn
|
||||
kw trait
|
||||
kw impl
|
||||
sn pd
|
||||
sn ppd
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_keyword_completion_in_comments() {
|
||||
cov_mark::check!(no_keyword_completion_in_comments);
|
||||
check(
|
||||
r#"
|
||||
fn test() {
|
||||
let x = 2; // A comment$0
|
||||
}
|
||||
"#,
|
||||
expect![[""]],
|
||||
);
|
||||
check(
|
||||
r#"
|
||||
/*
|
||||
Some multi-line comment$0
|
||||
*/
|
||||
"#,
|
||||
expect![[""]],
|
||||
);
|
||||
check(
|
||||
r#"
|
||||
/// Some doc comment
|
||||
/// let test$0 = 1
|
||||
"#,
|
||||
expect![[""]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_completion_await_impls_future() {
|
||||
check(
|
||||
@ -413,6 +225,18 @@ fn foo(a: A) { a.$0 }
|
||||
"#,
|
||||
expect![[r#"
|
||||
kw await expr.await
|
||||
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
|
||||
"#]],
|
||||
);
|
||||
|
||||
@ -427,83 +251,22 @@ fn foo() {
|
||||
"#,
|
||||
expect![[r#"
|
||||
kw await expr.await
|
||||
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 after_let() {
|
||||
check(
|
||||
r#"fn main() { let _ = $0 }"#,
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw return
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn skip_struct_initializer() {
|
||||
cov_mark::check!(no_keyword_completion_in_record_lit);
|
||||
check(
|
||||
r#"
|
||||
struct Foo {
|
||||
pub f: i32,
|
||||
}
|
||||
fn foo() {
|
||||
Foo {
|
||||
$0
|
||||
}
|
||||
}
|
||||
"#,
|
||||
expect![[r#""#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn struct_initializer_field_expr() {
|
||||
check(
|
||||
r#"
|
||||
struct Foo {
|
||||
pub f: i32,
|
||||
}
|
||||
fn foo() {
|
||||
Foo {
|
||||
f: $0
|
||||
}
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw return
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn let_semi() {
|
||||
cov_mark::check!(let_semi);
|
||||
|
@ -141,9 +141,10 @@ fn module_chain_to_containing_module_file(
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::tests::completion_list;
|
||||
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);
|
||||
|
@ -270,12 +270,12 @@ mod tests {
|
||||
use expect_test::{expect, Expect};
|
||||
|
||||
use crate::{
|
||||
tests::{check_edit, check_edit_with_config, filtered_completion_list, TEST_CONFIG},
|
||||
CompletionConfig, CompletionKind, Snippet,
|
||||
tests::{check_edit, check_edit_with_config, completion_list, TEST_CONFIG},
|
||||
CompletionConfig, Snippet,
|
||||
};
|
||||
|
||||
fn check(ra_fixture: &str, expect: Expect) {
|
||||
let actual = filtered_completion_list(ra_fixture, CompletionKind::Postfix);
|
||||
let actual = completion_list(ra_fixture);
|
||||
expect.assert_eq(&actual)
|
||||
}
|
||||
|
||||
|
@ -250,13 +250,10 @@ fn add_enum_variants(acc: &mut Completions, ctx: &CompletionContext, e: hir::Enu
|
||||
mod tests {
|
||||
use expect_test::{expect, Expect};
|
||||
|
||||
use crate::{
|
||||
tests::{check_edit, filtered_completion_list},
|
||||
CompletionKind,
|
||||
};
|
||||
use crate::tests::{check_edit, completion_list_no_kw};
|
||||
|
||||
fn check(ra_fixture: &str, expect: Expect) {
|
||||
let actual = filtered_completion_list(ra_fixture, CompletionKind::Reference);
|
||||
let actual = completion_list_no_kw(ra_fixture);
|
||||
expect.assert_eq(&actual);
|
||||
}
|
||||
|
||||
|
@ -290,13 +290,10 @@ fn replacement_range(ctx: &CompletionContext, item: &SyntaxNode) -> TextRange {
|
||||
mod tests {
|
||||
use expect_test::{expect, Expect};
|
||||
|
||||
use crate::{
|
||||
tests::{check_edit, filtered_completion_list},
|
||||
CompletionKind,
|
||||
};
|
||||
use crate::tests::{check_edit, completion_list_no_kw};
|
||||
|
||||
fn check(ra_fixture: &str, expect: Expect) {
|
||||
let actual = filtered_completion_list(ra_fixture, CompletionKind::Magic);
|
||||
let actual = completion_list_no_kw(ra_fixture);
|
||||
expect.assert_eq(&actual)
|
||||
}
|
||||
|
||||
@ -313,7 +310,12 @@ impl Test for T {
|
||||
}
|
||||
}
|
||||
",
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
sp Self
|
||||
tt Test
|
||||
st T
|
||||
bt u32
|
||||
"#]],
|
||||
);
|
||||
|
||||
check(
|
||||
@ -356,7 +358,23 @@ impl Test for T {
|
||||
}
|
||||
}
|
||||
",
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
sn if if expr {}
|
||||
sn while while expr {}
|
||||
sn not !expr
|
||||
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
|
||||
"#]],
|
||||
);
|
||||
|
||||
check(
|
||||
@ -368,7 +386,10 @@ impl Test for T {
|
||||
fn test(t$0)
|
||||
}
|
||||
",
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
sp Self
|
||||
st T
|
||||
"#]],
|
||||
);
|
||||
|
||||
check(
|
||||
@ -380,7 +401,10 @@ impl Test for T {
|
||||
fn test(f: fn $0)
|
||||
}
|
||||
",
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
sp Self
|
||||
st T
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
@ -395,7 +419,7 @@ impl Test for T {
|
||||
const TEST: fn $0
|
||||
}
|
||||
",
|
||||
expect![[""]],
|
||||
expect![[r#""#]],
|
||||
);
|
||||
|
||||
check(
|
||||
@ -407,7 +431,12 @@ impl Test for T {
|
||||
const TEST: T$0
|
||||
}
|
||||
",
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
sp Self
|
||||
tt Test
|
||||
st T
|
||||
bt u32
|
||||
"#]],
|
||||
);
|
||||
|
||||
check(
|
||||
@ -419,7 +448,12 @@ impl Test for T {
|
||||
const TEST: u32 = f$0
|
||||
}
|
||||
",
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
sp Self
|
||||
tt Test
|
||||
st T
|
||||
bt u32
|
||||
"#]],
|
||||
);
|
||||
|
||||
check(
|
||||
@ -433,7 +467,12 @@ impl Test for T {
|
||||
};
|
||||
}
|
||||
",
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
sp Self
|
||||
tt Test
|
||||
st T
|
||||
bt u32
|
||||
"#]],
|
||||
);
|
||||
|
||||
check(
|
||||
@ -476,7 +515,12 @@ impl Test for T {
|
||||
type Test = T$0;
|
||||
}
|
||||
",
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
sp Self
|
||||
tt Test
|
||||
st T
|
||||
bt u32
|
||||
"#]],
|
||||
);
|
||||
|
||||
check(
|
||||
@ -488,7 +532,12 @@ impl Test for T {
|
||||
type Test = fn $0;
|
||||
}
|
||||
",
|
||||
expect![[""]],
|
||||
expect![[r#"
|
||||
sp Self
|
||||
tt Test
|
||||
st T
|
||||
bt u32
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -117,24 +117,15 @@ pub(crate) fn complete_unqualified_path(acc: &mut Completions, ctx: &CompletionC
|
||||
mod tests {
|
||||
use expect_test::{expect, Expect};
|
||||
|
||||
use crate::{
|
||||
tests::{check_edit, filtered_completion_list_with_config, TEST_CONFIG},
|
||||
CompletionConfig, CompletionKind,
|
||||
};
|
||||
use crate::tests::{check_edit, completion_list_no_kw};
|
||||
|
||||
fn check(ra_fixture: &str, expect: Expect) {
|
||||
check_with_config(TEST_CONFIG, ra_fixture, expect);
|
||||
}
|
||||
|
||||
fn check_with_config(config: CompletionConfig, ra_fixture: &str, expect: Expect) {
|
||||
let actual =
|
||||
filtered_completion_list_with_config(config, ra_fixture, CompletionKind::Reference);
|
||||
let actual = completion_list_no_kw(ra_fixture);
|
||||
expect.assert_eq(&actual)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completes_if_prefix_is_keyword() {
|
||||
cov_mark::check!(completes_if_prefix_is_keyword);
|
||||
check_edit(
|
||||
"wherewolf",
|
||||
r#"
|
||||
@ -188,6 +179,7 @@ pub mod prelude {
|
||||
"#,
|
||||
expect![[r#"
|
||||
md std
|
||||
bt u32
|
||||
st Option
|
||||
"#]],
|
||||
);
|
||||
@ -217,6 +209,7 @@ mod macros {
|
||||
fn f() fn()
|
||||
ma concat!(…) #[macro_export] macro_rules! concat
|
||||
md std
|
||||
bt u32
|
||||
"##]],
|
||||
);
|
||||
}
|
||||
@ -245,6 +238,7 @@ pub mod prelude {
|
||||
expect![[r#"
|
||||
md std
|
||||
md core
|
||||
bt u32
|
||||
st String
|
||||
"#]],
|
||||
);
|
||||
@ -273,6 +267,7 @@ pub mod prelude {
|
||||
expect![[r#"
|
||||
fn f() fn()
|
||||
md std
|
||||
bt u32
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
@ -134,7 +134,6 @@ impl<'a> CompletionContext<'a> {
|
||||
// check kind of macro-expanded token, but use range of original token
|
||||
let kind = self.token.kind();
|
||||
if kind == IDENT || kind == LIFETIME_IDENT || kind == UNDERSCORE || kind.is_keyword() {
|
||||
cov_mark::hit!(completes_if_prefix_is_keyword);
|
||||
self.original_token.text_range()
|
||||
} else if kind == CHAR {
|
||||
// assume we are completing a lifetime but the user has only typed the '
|
||||
|
@ -20,6 +20,7 @@ mod record;
|
||||
mod type_pos;
|
||||
mod use_tree;
|
||||
mod visibility;
|
||||
mod flyimport;
|
||||
|
||||
use std::mem;
|
||||
|
||||
@ -77,10 +78,18 @@ pub(crate) const TEST_CONFIG: CompletionConfig = CompletionConfig {
|
||||
};
|
||||
|
||||
pub(crate) fn completion_list(ra_fixture: &str) -> String {
|
||||
completion_list_with_config(TEST_CONFIG, ra_fixture)
|
||||
completion_list_with_config(TEST_CONFIG, ra_fixture, true)
|
||||
}
|
||||
|
||||
fn completion_list_with_config(config: CompletionConfig, ra_fixture: &str) -> String {
|
||||
pub(crate) fn completion_list_no_kw(ra_fixture: &str) -> String {
|
||||
completion_list_with_config(TEST_CONFIG, ra_fixture, false)
|
||||
}
|
||||
|
||||
fn completion_list_with_config(
|
||||
config: CompletionConfig,
|
||||
ra_fixture: &str,
|
||||
include_keywords: bool,
|
||||
) -> String {
|
||||
// filter out all but one builtintype completion for smaller test outputs
|
||||
let items = get_all_items(config, ra_fixture);
|
||||
let mut bt_seen = false;
|
||||
@ -89,6 +98,8 @@ fn completion_list_with_config(config: CompletionConfig, ra_fixture: &str) -> St
|
||||
.filter(|it| {
|
||||
it.completion_kind != CompletionKind::BuiltinType || !mem::replace(&mut bt_seen, true)
|
||||
})
|
||||
.filter(|it| include_keywords || it.completion_kind != CompletionKind::Keyword)
|
||||
.filter(|it| include_keywords || it.completion_kind != CompletionKind::Snippet)
|
||||
.collect();
|
||||
render_completion_list(items)
|
||||
}
|
||||
@ -120,20 +131,6 @@ pub(crate) fn do_completion_with_config(
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub(crate) fn filtered_completion_list(code: &str, kind: CompletionKind) -> String {
|
||||
filtered_completion_list_with_config(TEST_CONFIG, code, kind)
|
||||
}
|
||||
|
||||
pub(crate) fn filtered_completion_list_with_config(
|
||||
config: CompletionConfig,
|
||||
code: &str,
|
||||
kind: CompletionKind,
|
||||
) -> String {
|
||||
let kind_completions: Vec<CompletionItem> =
|
||||
get_all_items(config, code).into_iter().filter(|c| c.completion_kind == kind).collect();
|
||||
render_completion_list(kind_completions)
|
||||
}
|
||||
|
||||
fn render_completion_list(completions: Vec<CompletionItem>) -> String {
|
||||
fn monospace_width(s: &str) -> usize {
|
||||
s.chars().count()
|
||||
@ -254,3 +251,37 @@ fn foo() {
|
||||
"#,
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn no_completions_in_comments() {
|
||||
cov_mark::check!(no_keyword_completion_in_comments);
|
||||
assert_eq!(
|
||||
completion_list(
|
||||
r#"
|
||||
fn test() {
|
||||
let x = 2; // A comment$0
|
||||
}
|
||||
"#,
|
||||
),
|
||||
String::new(),
|
||||
);
|
||||
assert_eq!(
|
||||
completion_list(
|
||||
r#"
|
||||
/*
|
||||
Some multi-line comment$0
|
||||
*/
|
||||
"#,
|
||||
),
|
||||
String::new(),
|
||||
);
|
||||
assert_eq!(
|
||||
completion_list(
|
||||
r#"
|
||||
/// Some doc comment
|
||||
/// let test$0 = 1
|
||||
"#,
|
||||
),
|
||||
String::new(),
|
||||
);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ fn func(param0 @ (param1, param2): (i32, i32)) {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completes_all_the_things() {
|
||||
fn completes_all_the_things_in_fn_body() {
|
||||
cov_mark::check!(unqualified_skip_lifetime_completion);
|
||||
check(
|
||||
r#"
|
||||
@ -206,6 +206,223 @@ impl Unit {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn complete_in_block() {
|
||||
check_empty(
|
||||
r#"
|
||||
fn foo() {
|
||||
if true {
|
||||
$0
|
||||
}
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
kw impl
|
||||
kw extern
|
||||
kw use
|
||||
kw trait
|
||||
kw static
|
||||
kw mod
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw let
|
||||
kw return
|
||||
sn pd
|
||||
sn ppd
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
fn foo() fn()
|
||||
bt u32
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn complete_after_if_expr() {
|
||||
check_empty(
|
||||
r#"
|
||||
fn foo() {
|
||||
if true {}
|
||||
$0
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
kw impl
|
||||
kw extern
|
||||
kw use
|
||||
kw trait
|
||||
kw static
|
||||
kw mod
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw let
|
||||
kw else
|
||||
kw else if
|
||||
kw return
|
||||
sn pd
|
||||
sn ppd
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
fn foo() fn()
|
||||
bt u32
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn complete_in_match_arm() {
|
||||
check_empty(
|
||||
r#"
|
||||
fn foo() {
|
||||
match () {
|
||||
() => $0
|
||||
}
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw return
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
fn foo() fn()
|
||||
bt u32
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completes_in_loop_ctx() {
|
||||
check_empty(
|
||||
r"fn my() { loop { $0 } }",
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw fn
|
||||
kw const
|
||||
kw type
|
||||
kw impl
|
||||
kw extern
|
||||
kw use
|
||||
kw trait
|
||||
kw static
|
||||
kw mod
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw let
|
||||
kw continue
|
||||
kw break
|
||||
kw return
|
||||
sn pd
|
||||
sn ppd
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
fn my() fn()
|
||||
bt u32
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completes_in_let_initializer() {
|
||||
check_empty(
|
||||
r#"fn main() { let _ = $0 }"#,
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw return
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
fn main() fn()
|
||||
bt u32
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn struct_initializer_field_expr() {
|
||||
check_empty(
|
||||
r#"
|
||||
struct Foo {
|
||||
pub f: i32,
|
||||
}
|
||||
fn foo() {
|
||||
Foo {
|
||||
f: $0
|
||||
}
|
||||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
kw unsafe
|
||||
kw match
|
||||
kw while
|
||||
kw while let
|
||||
kw loop
|
||||
kw if
|
||||
kw if let
|
||||
kw for
|
||||
kw true
|
||||
kw false
|
||||
kw return
|
||||
kw self
|
||||
kw super
|
||||
kw crate
|
||||
st Foo
|
||||
fn foo() fn()
|
||||
bt u32
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn shadowing_shows_single_completion() {
|
||||
cov_mark::check!(shadowing_shows_single_completion);
|
||||
|
1014
crates/ide_completion/src/tests/flyimport.rs
Normal file
1014
crates/ide_completion/src/tests/flyimport.rs
Normal file
File diff suppressed because it is too large
Load Diff
@ -9,6 +9,7 @@ fn check(ra_fixture: &str, expect: Expect) {
|
||||
|
||||
#[test]
|
||||
fn without_default_impl() {
|
||||
cov_mark::check!(no_keyword_completion_in_record_lit);
|
||||
check(
|
||||
r#"
|
||||
struct Struct { foo: u32, bar: usize }
|
||||
|
@ -313,6 +313,7 @@ fn check_dbg(path: &Path, text: &str) {
|
||||
"handlers/remove_dbg.rs",
|
||||
// We have .dbg postfix
|
||||
"ide_completion/src/completions/postfix.rs",
|
||||
"ide_completion/src/completions/keyword.rs",
|
||||
"ide_completion/src/tests/proc_macros.rs",
|
||||
// The documentation in string literals may contain anything for its own purposes
|
||||
"ide_completion/src/lib.rs",
|
||||
|
Loading…
x
Reference in New Issue
Block a user