mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Merge #5215
5215: Cleanup more completion tests r=matklad a=matklad bors r+ Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
fe16e1da69
3 changed files with 177 additions and 331 deletions
|
@ -1,6 +1,7 @@
|
||||||
//! FIXME: write short doc here
|
//! FIXME: write short doc here
|
||||||
|
|
||||||
use ra_syntax::{ast, SyntaxKind};
|
use ra_syntax::{ast, SyntaxKind};
|
||||||
|
use test_utils::mark;
|
||||||
|
|
||||||
use crate::completion::{
|
use crate::completion::{
|
||||||
CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions,
|
CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions,
|
||||||
|
@ -38,6 +39,7 @@ pub(super) fn complete_use_tree_keyword(acc: &mut Completions, ctx: &CompletionC
|
||||||
|
|
||||||
pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionContext) {
|
pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionContext) {
|
||||||
if ctx.token.kind() == SyntaxKind::COMMENT {
|
if ctx.token.kind() == SyntaxKind::COMMENT {
|
||||||
|
mark::hit!(no_keyword_completion_in_comments);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,6 +182,7 @@ mod tests {
|
||||||
test_utils::{check_edit, completion_list},
|
test_utils::{check_edit, completion_list},
|
||||||
CompletionKind,
|
CompletionKind,
|
||||||
};
|
};
|
||||||
|
use test_utils::mark;
|
||||||
|
|
||||||
fn check(ra_fixture: &str, expect: Expect) {
|
fn check(ra_fixture: &str, expect: Expect) {
|
||||||
let actual = completion_list(ra_fixture, CompletionKind::Keyword);
|
let actual = completion_list(ra_fixture, CompletionKind::Keyword);
|
||||||
|
@ -459,4 +462,32 @@ fn quux() -> i32 {
|
||||||
"#]],
|
"#]],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn no_keyword_completion_in_comments() {
|
||||||
|
mark::check!(no_keyword_completion_in_comments);
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
fn test() {
|
||||||
|
let x = 2; // A comment<|>
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
expect![[""]],
|
||||||
|
);
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
/*
|
||||||
|
Some multi-line comment<|>
|
||||||
|
*/
|
||||||
|
"#,
|
||||||
|
expect![[""]],
|
||||||
|
);
|
||||||
|
check(
|
||||||
|
r#"
|
||||||
|
/// Some doc comment
|
||||||
|
/// let test<|> = 1
|
||||||
|
"#,
|
||||||
|
expect![[""]],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -383,12 +383,14 @@ impl Builder {
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
if ctx.use_item_syntax.is_some() || ctx.is_call {
|
if ctx.use_item_syntax.is_some() || ctx.is_call {
|
||||||
|
mark::hit!(no_parens_in_use_item);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't add parentheses if the expected type is some function reference.
|
// Don't add parentheses if the expected type is some function reference.
|
||||||
if let Some(ty) = &ctx.expected_type {
|
if let Some(ty) = &ctx.expected_type {
|
||||||
if ty.is_fn() {
|
if ty.is_fn() {
|
||||||
|
mark::hit!(no_call_parens_if_fn_ptr_needed);
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -413,7 +415,10 @@ impl Builder {
|
||||||
.sep_by(", ");
|
.sep_by(", ");
|
||||||
format!("{}({})$0", name, function_params_snippet)
|
format!("{}({})$0", name, function_params_snippet)
|
||||||
}
|
}
|
||||||
_ => format!("{}($0)", name),
|
_ => {
|
||||||
|
mark::hit!(suppress_arg_snippets);
|
||||||
|
format!("{}($0)", name)
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
(snippet, format!("{}(…)", name))
|
(snippet, format!("{}(…)", name))
|
||||||
|
@ -460,7 +465,7 @@ mod tests {
|
||||||
use test_utils::mark;
|
use test_utils::mark;
|
||||||
|
|
||||||
use crate::completion::{
|
use crate::completion::{
|
||||||
test_utils::{check_edit, do_completion, do_completion_with_options},
|
test_utils::{check_edit, check_edit_with_config, do_completion},
|
||||||
CompletionConfig, CompletionItem, CompletionKind,
|
CompletionConfig, CompletionItem, CompletionKind,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -468,13 +473,6 @@ mod tests {
|
||||||
do_completion(ra_fixture, CompletionKind::Reference)
|
do_completion(ra_fixture, CompletionKind::Reference)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn do_reference_completion_with_options(
|
|
||||||
ra_fixture: &str,
|
|
||||||
options: CompletionConfig,
|
|
||||||
) -> Vec<CompletionItem> {
|
|
||||||
do_completion_with_options(ra_fixture, CompletionKind::Reference, &options)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn enum_detail_includes_names_for_record() {
|
fn enum_detail_includes_names_for_record() {
|
||||||
assert_debug_snapshot!(
|
assert_debug_snapshot!(
|
||||||
|
@ -647,6 +645,7 @@ fn no_args() {}
|
||||||
fn main() { no_args()$0 }
|
fn main() { no_args()$0 }
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
check_edit(
|
check_edit(
|
||||||
"with_args",
|
"with_args",
|
||||||
r#"
|
r#"
|
||||||
|
@ -658,6 +657,7 @@ fn with_args(x: i32, y: String) {}
|
||||||
fn main() { with_args(${1:x}, ${2:y})$0 }
|
fn main() { with_args(${1:x}, ${2:y})$0 }
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
check_edit(
|
check_edit(
|
||||||
"foo",
|
"foo",
|
||||||
r#"
|
r#"
|
||||||
|
@ -675,6 +675,45 @@ impl S {
|
||||||
fn bar(s: &S) { s.foo()$0 }
|
fn bar(s: &S) { s.foo()$0 }
|
||||||
"#,
|
"#,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
check_edit(
|
||||||
|
"foo",
|
||||||
|
r#"
|
||||||
|
struct S {}
|
||||||
|
impl S {
|
||||||
|
fn foo(&self, x: i32) {}
|
||||||
|
}
|
||||||
|
fn bar(s: &S) {
|
||||||
|
s.f<|>
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
r#"
|
||||||
|
struct S {}
|
||||||
|
impl S {
|
||||||
|
fn foo(&self, x: i32) {}
|
||||||
|
}
|
||||||
|
fn bar(s: &S) {
|
||||||
|
s.foo(${1:x})$0
|
||||||
|
}
|
||||||
|
"#,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn suppress_arg_snippets() {
|
||||||
|
mark::check!(suppress_arg_snippets);
|
||||||
|
check_edit_with_config(
|
||||||
|
"with_args",
|
||||||
|
r#"
|
||||||
|
fn with_args(x: i32, y: String) {}
|
||||||
|
fn main() { with_<|> }
|
||||||
|
"#,
|
||||||
|
r#"
|
||||||
|
fn with_args(x: i32, y: String) {}
|
||||||
|
fn main() { with_args($0) }
|
||||||
|
"#,
|
||||||
|
&CompletionConfig { add_call_argument_snippets: false, ..CompletionConfig::default() },
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -694,58 +733,26 @@ fn main() { foo(${1:foo}, ${2:bar}, ${3:ho_ge_})$0 }
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn inserts_parens_for_tuple_enums() {
|
fn inserts_parens_for_tuple_enums() {
|
||||||
assert_debug_snapshot!(
|
check_edit(
|
||||||
do_reference_completion(
|
"Some",
|
||||||
r"
|
r#"
|
||||||
enum Option<T> { Some(T), None }
|
enum Option<T> { Some(T), None }
|
||||||
use Option::*;
|
use Option::*;
|
||||||
fn main() -> Option<i32> {
|
fn main() -> Option<i32> {
|
||||||
Som<|>
|
Som<|>
|
||||||
}
|
}
|
||||||
"
|
"#,
|
||||||
),
|
r#"
|
||||||
@r###"
|
enum Option<T> { Some(T), None }
|
||||||
[
|
use Option::*;
|
||||||
CompletionItem {
|
fn main() -> Option<i32> {
|
||||||
label: "None",
|
Some($0)
|
||||||
source_range: 79..82,
|
}
|
||||||
delete: 79..82,
|
"#,
|
||||||
insert: "None",
|
|
||||||
kind: EnumVariant,
|
|
||||||
detail: "()",
|
|
||||||
},
|
|
||||||
CompletionItem {
|
|
||||||
label: "Option",
|
|
||||||
source_range: 79..82,
|
|
||||||
delete: 79..82,
|
|
||||||
insert: "Option",
|
|
||||||
kind: Enum,
|
|
||||||
},
|
|
||||||
CompletionItem {
|
|
||||||
label: "Some(…)",
|
|
||||||
source_range: 79..82,
|
|
||||||
delete: 79..82,
|
|
||||||
insert: "Some($0)",
|
|
||||||
kind: EnumVariant,
|
|
||||||
lookup: "Some",
|
|
||||||
detail: "(T)",
|
|
||||||
trigger_call_info: true,
|
|
||||||
},
|
|
||||||
CompletionItem {
|
|
||||||
label: "main()",
|
|
||||||
source_range: 79..82,
|
|
||||||
delete: 79..82,
|
|
||||||
insert: "main()$0",
|
|
||||||
kind: Function,
|
|
||||||
lookup: "main",
|
|
||||||
detail: "fn main() -> Option<i32>",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
"###
|
|
||||||
);
|
);
|
||||||
assert_debug_snapshot!(
|
check_edit(
|
||||||
do_reference_completion(
|
"Some",
|
||||||
r"
|
r#"
|
||||||
enum Option<T> { Some(T), None }
|
enum Option<T> { Some(T), None }
|
||||||
use Option::*;
|
use Option::*;
|
||||||
fn main(value: Option<i32>) {
|
fn main(value: Option<i32>) {
|
||||||
|
@ -753,235 +760,84 @@ fn main() { foo(${1:foo}, ${2:bar}, ${3:ho_ge_})$0 }
|
||||||
Som<|>
|
Som<|>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"
|
"#,
|
||||||
),
|
r#"
|
||||||
@r###"
|
enum Option<T> { Some(T), None }
|
||||||
[
|
use Option::*;
|
||||||
CompletionItem {
|
fn main(value: Option<i32>) {
|
||||||
label: "None",
|
match value {
|
||||||
source_range: 104..107,
|
Some($0)
|
||||||
delete: 104..107,
|
}
|
||||||
insert: "None",
|
}
|
||||||
kind: EnumVariant,
|
"#,
|
||||||
detail: "()",
|
|
||||||
},
|
|
||||||
CompletionItem {
|
|
||||||
label: "Option",
|
|
||||||
source_range: 104..107,
|
|
||||||
delete: 104..107,
|
|
||||||
insert: "Option",
|
|
||||||
kind: Enum,
|
|
||||||
},
|
|
||||||
CompletionItem {
|
|
||||||
label: "Some(…)",
|
|
||||||
source_range: 104..107,
|
|
||||||
delete: 104..107,
|
|
||||||
insert: "Some($0)",
|
|
||||||
kind: EnumVariant,
|
|
||||||
lookup: "Some",
|
|
||||||
detail: "(T)",
|
|
||||||
trigger_call_info: true,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
"###
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_call_parens_if_fn_ptr_needed() {
|
fn no_call_parens_if_fn_ptr_needed() {
|
||||||
assert_debug_snapshot!(
|
mark::check!(no_call_parens_if_fn_ptr_needed);
|
||||||
do_reference_completion(
|
check_edit(
|
||||||
r"
|
"foo",
|
||||||
fn somefn(with: u8, a: u8, lot: u8, of: u8, args: u8) {}
|
r#"
|
||||||
|
fn foo(foo: u8, bar: u8) {}
|
||||||
struct ManualVtable {
|
struct ManualVtable { f: fn(u8, u8) }
|
||||||
method: fn(u8, u8, u8, u8, u8),
|
|
||||||
}
|
|
||||||
|
|
||||||
fn main() -> ManualVtable {
|
fn main() -> ManualVtable {
|
||||||
ManualVtable {
|
ManualVtable { f: f<|> }
|
||||||
method: some<|>
|
|
||||||
}
|
}
|
||||||
|
"#,
|
||||||
|
r#"
|
||||||
|
fn foo(foo: u8, bar: u8) {}
|
||||||
|
struct ManualVtable { f: fn(u8, u8) }
|
||||||
|
|
||||||
|
fn main() -> ManualVtable {
|
||||||
|
ManualVtable { f: foo }
|
||||||
}
|
}
|
||||||
"
|
"#,
|
||||||
),
|
|
||||||
@r###"
|
|
||||||
[
|
|
||||||
CompletionItem {
|
|
||||||
label: "ManualVtable",
|
|
||||||
source_range: 182..186,
|
|
||||||
delete: 182..186,
|
|
||||||
insert: "ManualVtable",
|
|
||||||
kind: Struct,
|
|
||||||
},
|
|
||||||
CompletionItem {
|
|
||||||
label: "main",
|
|
||||||
source_range: 182..186,
|
|
||||||
delete: 182..186,
|
|
||||||
insert: "main",
|
|
||||||
kind: Function,
|
|
||||||
detail: "fn main() -> ManualVtable",
|
|
||||||
},
|
|
||||||
CompletionItem {
|
|
||||||
label: "somefn",
|
|
||||||
source_range: 182..186,
|
|
||||||
delete: 182..186,
|
|
||||||
insert: "somefn",
|
|
||||||
kind: Function,
|
|
||||||
detail: "fn somefn(with: u8, a: u8, lot: u8, of: u8, args: u8)",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
"###
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn arg_snippets_for_method_call() {
|
fn no_parens_in_use_item() {
|
||||||
assert_debug_snapshot!(
|
mark::check!(no_parens_in_use_item);
|
||||||
do_reference_completion(
|
check_edit(
|
||||||
r"
|
"foo",
|
||||||
struct S {}
|
r#"
|
||||||
impl S {
|
|
||||||
fn foo(&self, x: i32) {}
|
|
||||||
}
|
|
||||||
fn bar(s: &S) {
|
|
||||||
s.f<|>
|
|
||||||
}
|
|
||||||
"
|
|
||||||
),
|
|
||||||
@r###"
|
|
||||||
[
|
|
||||||
CompletionItem {
|
|
||||||
label: "foo(…)",
|
|
||||||
source_range: 74..75,
|
|
||||||
delete: 74..75,
|
|
||||||
insert: "foo(${1:x})$0",
|
|
||||||
kind: Method,
|
|
||||||
lookup: "foo",
|
|
||||||
detail: "fn foo(&self, x: i32)",
|
|
||||||
trigger_call_info: true,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
"###
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn no_arg_snippets_for_method_call() {
|
|
||||||
assert_debug_snapshot!(
|
|
||||||
do_reference_completion_with_options(
|
|
||||||
r"
|
|
||||||
struct S {}
|
|
||||||
impl S {
|
|
||||||
fn foo(&self, x: i32) {}
|
|
||||||
}
|
|
||||||
fn bar(s: &S) {
|
|
||||||
s.f<|>
|
|
||||||
}
|
|
||||||
",
|
|
||||||
CompletionConfig {
|
|
||||||
add_call_argument_snippets: false,
|
|
||||||
.. Default::default()
|
|
||||||
}
|
|
||||||
),
|
|
||||||
@r###"
|
|
||||||
[
|
|
||||||
CompletionItem {
|
|
||||||
label: "foo(…)",
|
|
||||||
source_range: 74..75,
|
|
||||||
delete: 74..75,
|
|
||||||
insert: "foo($0)",
|
|
||||||
kind: Method,
|
|
||||||
lookup: "foo",
|
|
||||||
detail: "fn foo(&self, x: i32)",
|
|
||||||
trigger_call_info: true,
|
|
||||||
},
|
|
||||||
]
|
|
||||||
"###
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn dont_render_function_parens_in_use_item() {
|
|
||||||
assert_debug_snapshot!(
|
|
||||||
do_reference_completion(
|
|
||||||
"
|
|
||||||
//- /lib.rs
|
|
||||||
mod m { pub fn foo() {} }
|
mod m { pub fn foo() {} }
|
||||||
use crate::m::f<|>;
|
use crate::m::f<|>;
|
||||||
"
|
"#,
|
||||||
),
|
r#"
|
||||||
@r###"
|
mod m { pub fn foo() {} }
|
||||||
[
|
use crate::m::foo;
|
||||||
CompletionItem {
|
"#,
|
||||||
label: "foo",
|
|
||||||
source_range: 40..41,
|
|
||||||
delete: 40..41,
|
|
||||||
insert: "foo",
|
|
||||||
kind: Function,
|
|
||||||
detail: "pub fn foo()",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
"###
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn dont_render_function_parens_if_already_call() {
|
fn no_parens_in_call() {
|
||||||
assert_debug_snapshot!(
|
check_edit(
|
||||||
do_reference_completion(
|
"foo",
|
||||||
"
|
r#"
|
||||||
//- /lib.rs
|
fn foo(x: i32) {}
|
||||||
fn frobnicate() {}
|
fn main() { f<|>(); }
|
||||||
fn main() {
|
"#,
|
||||||
frob<|>();
|
r#"
|
||||||
}
|
fn foo(x: i32) {}
|
||||||
"
|
fn main() { foo(); }
|
||||||
),
|
"#,
|
||||||
@r###"
|
|
||||||
[
|
|
||||||
CompletionItem {
|
|
||||||
label: "frobnicate",
|
|
||||||
source_range: 35..39,
|
|
||||||
delete: 35..39,
|
|
||||||
insert: "frobnicate",
|
|
||||||
kind: Function,
|
|
||||||
detail: "fn frobnicate()",
|
|
||||||
},
|
|
||||||
CompletionItem {
|
|
||||||
label: "main",
|
|
||||||
source_range: 35..39,
|
|
||||||
delete: 35..39,
|
|
||||||
insert: "main",
|
|
||||||
kind: Function,
|
|
||||||
detail: "fn main()",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
"###
|
|
||||||
);
|
);
|
||||||
assert_debug_snapshot!(
|
check_edit(
|
||||||
do_reference_completion(
|
"foo",
|
||||||
"
|
r#"
|
||||||
//- /lib.rs
|
struct Foo;
|
||||||
struct Foo {}
|
impl Foo { fn foo(&self){} }
|
||||||
impl Foo { fn new() -> Foo {} }
|
fn f(foo: &Foo) { foo.f<|>(); }
|
||||||
fn main() {
|
"#,
|
||||||
Foo::ne<|>();
|
r#"
|
||||||
}
|
struct Foo;
|
||||||
"
|
impl Foo { fn foo(&self){} }
|
||||||
),
|
fn f(foo: &Foo) { foo.foo(); }
|
||||||
@r###"
|
"#,
|
||||||
[
|
|
||||||
CompletionItem {
|
|
||||||
label: "new",
|
|
||||||
source_range: 67..69,
|
|
||||||
delete: 67..69,
|
|
||||||
insert: "new",
|
|
||||||
kind: Function,
|
|
||||||
detail: "fn new() -> Foo",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
"###
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1450,54 +1306,4 @@ fn main() { foo(${1:foo}, ${2:bar}, ${3:ho_ge_})$0 }
|
||||||
"###
|
"###
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn no_keyword_autocompletion_on_line_comments() {
|
|
||||||
assert_debug_snapshot!(
|
|
||||||
do_completion(
|
|
||||||
r"
|
|
||||||
fn test() {
|
|
||||||
let x = 2; // A comment<|>
|
|
||||||
}
|
|
||||||
",
|
|
||||||
CompletionKind::Keyword
|
|
||||||
),
|
|
||||||
@r###"
|
|
||||||
[]
|
|
||||||
"###
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn no_keyword_autocompletion_on_multi_line_comments() {
|
|
||||||
assert_debug_snapshot!(
|
|
||||||
do_completion(
|
|
||||||
r"
|
|
||||||
/*
|
|
||||||
Some multi-line comment<|>
|
|
||||||
*/
|
|
||||||
",
|
|
||||||
CompletionKind::Keyword
|
|
||||||
),
|
|
||||||
@r###"
|
|
||||||
[]
|
|
||||||
"###
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn no_keyword_autocompletion_on_doc_comments() {
|
|
||||||
assert_debug_snapshot!(
|
|
||||||
do_completion(
|
|
||||||
r"
|
|
||||||
/// Some doc comment
|
|
||||||
/// let test<|> = 1
|
|
||||||
",
|
|
||||||
CompletionKind::Keyword
|
|
||||||
),
|
|
||||||
@r###"
|
|
||||||
[]
|
|
||||||
"###
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,10 +57,19 @@ pub(crate) fn completion_list_with_options(
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn check_edit(what: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
|
pub(crate) fn check_edit(what: &str, ra_fixture_before: &str, ra_fixture_after: &str) {
|
||||||
|
check_edit_with_config(what, ra_fixture_before, ra_fixture_after, &CompletionConfig::default())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn check_edit_with_config(
|
||||||
|
what: &str,
|
||||||
|
ra_fixture_before: &str,
|
||||||
|
ra_fixture_after: &str,
|
||||||
|
config: &CompletionConfig,
|
||||||
|
) {
|
||||||
let ra_fixture_after = trim_indent(ra_fixture_after);
|
let ra_fixture_after = trim_indent(ra_fixture_after);
|
||||||
let (analysis, position) = analysis_and_position(ra_fixture_before);
|
let (analysis, position) = analysis_and_position(ra_fixture_before);
|
||||||
let completions: Vec<CompletionItem> =
|
let completions: Vec<CompletionItem> =
|
||||||
analysis.completions(&CompletionConfig::default(), position).unwrap().unwrap().into();
|
analysis.completions(config, position).unwrap().unwrap().into();
|
||||||
let (completion,) = completions
|
let (completion,) = completions
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|it| it.lookup() == what)
|
.filter(|it| it.lookup() == what)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue