mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Remove vertical ellipses from tests in complete_scope.rs
This commit is contained in:
parent
5c4df97996
commit
46c07ed578
1 changed files with 225 additions and 243 deletions
|
@ -131,51 +131,49 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_bindings_from_let() {
|
fn completes_bindings_from_let() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(
|
do_reference_completion(
|
||||||
r"
|
r"
|
||||||
fn quux(x: i32) {
|
fn quux(x: i32) {
|
||||||
let y = 92;
|
let y = 92;
|
||||||
1 + <|>;
|
1 + <|>;
|
||||||
let z = ();
|
let z = ();
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
@r###"
|
@r###"[
|
||||||
⋮[
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "quux",
|
||||||
⋮ label: "quux",
|
source_range: [91; 91),
|
||||||
⋮ source_range: [91; 91),
|
delete: [91; 91),
|
||||||
⋮ delete: [91; 91),
|
insert: "quux($0)",
|
||||||
⋮ insert: "quux($0)",
|
kind: Function,
|
||||||
⋮ kind: Function,
|
detail: "fn quux(x: i32)",
|
||||||
⋮ detail: "fn quux(x: i32)",
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "x",
|
||||||
⋮ label: "x",
|
source_range: [91; 91),
|
||||||
⋮ source_range: [91; 91),
|
delete: [91; 91),
|
||||||
⋮ delete: [91; 91),
|
insert: "x",
|
||||||
⋮ insert: "x",
|
kind: Binding,
|
||||||
⋮ kind: Binding,
|
detail: "i32",
|
||||||
⋮ detail: "i32",
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "y",
|
||||||
⋮ label: "y",
|
source_range: [91; 91),
|
||||||
⋮ source_range: [91; 91),
|
delete: [91; 91),
|
||||||
⋮ delete: [91; 91),
|
insert: "y",
|
||||||
⋮ insert: "y",
|
kind: Binding,
|
||||||
⋮ kind: Binding,
|
detail: "i32",
|
||||||
⋮ detail: "i32",
|
},
|
||||||
⋮ },
|
]"###
|
||||||
⋮]
|
);
|
||||||
"###
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_bindings_from_if_let() {
|
fn completes_bindings_from_if_let() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(
|
do_reference_completion(
|
||||||
r"
|
r"
|
||||||
fn quux() {
|
fn quux() {
|
||||||
if let Some(x) = foo() {
|
if let Some(x) = foo() {
|
||||||
let y = 92;
|
let y = 92;
|
||||||
|
@ -186,188 +184,178 @@ mod tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
@r###"
|
@r###"[
|
||||||
⋮[
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "a",
|
||||||
⋮ label: "a",
|
source_range: [242; 242),
|
||||||
⋮ source_range: [242; 242),
|
delete: [242; 242),
|
||||||
⋮ delete: [242; 242),
|
insert: "a",
|
||||||
⋮ insert: "a",
|
kind: Binding,
|
||||||
⋮ kind: Binding,
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "b",
|
||||||
⋮ label: "b",
|
source_range: [242; 242),
|
||||||
⋮ source_range: [242; 242),
|
delete: [242; 242),
|
||||||
⋮ delete: [242; 242),
|
insert: "b",
|
||||||
⋮ insert: "b",
|
kind: Binding,
|
||||||
⋮ kind: Binding,
|
detail: "i32",
|
||||||
⋮ detail: "i32",
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "quux",
|
||||||
⋮ label: "quux",
|
source_range: [242; 242),
|
||||||
⋮ source_range: [242; 242),
|
delete: [242; 242),
|
||||||
⋮ delete: [242; 242),
|
insert: "quux()$0",
|
||||||
⋮ insert: "quux()$0",
|
kind: Function,
|
||||||
⋮ kind: Function,
|
detail: "fn quux()",
|
||||||
⋮ detail: "fn quux()",
|
},
|
||||||
⋮ },
|
]"###
|
||||||
⋮]
|
);
|
||||||
"###
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_bindings_from_for() {
|
fn completes_bindings_from_for() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(
|
do_reference_completion(
|
||||||
r"
|
r"
|
||||||
fn quux() {
|
fn quux() {
|
||||||
for x in &[1, 2, 3] {
|
for x in &[1, 2, 3] {
|
||||||
<|>
|
<|>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
@r###"
|
@r###"[
|
||||||
⋮[
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "quux",
|
||||||
⋮ label: "quux",
|
source_range: [95; 95),
|
||||||
⋮ source_range: [95; 95),
|
delete: [95; 95),
|
||||||
⋮ delete: [95; 95),
|
insert: "quux()$0",
|
||||||
⋮ insert: "quux()$0",
|
kind: Function,
|
||||||
⋮ kind: Function,
|
detail: "fn quux()",
|
||||||
⋮ detail: "fn quux()",
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "x",
|
||||||
⋮ label: "x",
|
source_range: [95; 95),
|
||||||
⋮ source_range: [95; 95),
|
delete: [95; 95),
|
||||||
⋮ delete: [95; 95),
|
insert: "x",
|
||||||
⋮ insert: "x",
|
kind: Binding,
|
||||||
⋮ kind: Binding,
|
},
|
||||||
⋮ },
|
]"###
|
||||||
⋮]
|
);
|
||||||
"###
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_generic_params() {
|
fn completes_generic_params() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(
|
do_reference_completion(
|
||||||
r"
|
r"
|
||||||
fn quux<T>() {
|
fn quux<T>() {
|
||||||
<|>
|
<|>
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
@r###"
|
@r###"[
|
||||||
⋮[
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "T",
|
||||||
⋮ label: "T",
|
source_range: [52; 52),
|
||||||
⋮ source_range: [52; 52),
|
delete: [52; 52),
|
||||||
⋮ delete: [52; 52),
|
insert: "T",
|
||||||
⋮ insert: "T",
|
kind: TypeParam,
|
||||||
⋮ kind: TypeParam,
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "quux",
|
||||||
⋮ label: "quux",
|
source_range: [52; 52),
|
||||||
⋮ source_range: [52; 52),
|
delete: [52; 52),
|
||||||
⋮ delete: [52; 52),
|
insert: "quux()$0",
|
||||||
⋮ insert: "quux()$0",
|
kind: Function,
|
||||||
⋮ kind: Function,
|
detail: "fn quux<T>()",
|
||||||
⋮ detail: "fn quux<T>()",
|
},
|
||||||
⋮ },
|
]"###
|
||||||
⋮]
|
);
|
||||||
"###
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_generic_params_in_struct() {
|
fn completes_generic_params_in_struct() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(
|
do_reference_completion(
|
||||||
r"
|
r"
|
||||||
struct X<T> {
|
struct X<T> {
|
||||||
x: <|>
|
x: <|>
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
@r###"
|
@r###"[
|
||||||
⋮[
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "T",
|
||||||
⋮ label: "T",
|
source_range: [54; 54),
|
||||||
⋮ source_range: [54; 54),
|
delete: [54; 54),
|
||||||
⋮ delete: [54; 54),
|
insert: "T",
|
||||||
⋮ insert: "T",
|
kind: TypeParam,
|
||||||
⋮ kind: TypeParam,
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "X",
|
||||||
⋮ label: "X",
|
source_range: [54; 54),
|
||||||
⋮ source_range: [54; 54),
|
delete: [54; 54),
|
||||||
⋮ delete: [54; 54),
|
insert: "X",
|
||||||
⋮ insert: "X",
|
kind: Struct,
|
||||||
⋮ kind: Struct,
|
},
|
||||||
⋮ },
|
]"###
|
||||||
⋮]
|
);
|
||||||
"###
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_module_items() {
|
fn completes_module_items() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(
|
do_reference_completion(
|
||||||
r"
|
r"
|
||||||
struct Foo;
|
struct Foo;
|
||||||
enum Baz {}
|
enum Baz {}
|
||||||
fn quux() {
|
fn quux() {
|
||||||
<|>
|
<|>
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
@r###"
|
@r###"[
|
||||||
⋮[
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "Baz",
|
||||||
⋮ label: "Baz",
|
source_range: [105; 105),
|
||||||
⋮ source_range: [105; 105),
|
delete: [105; 105),
|
||||||
⋮ delete: [105; 105),
|
insert: "Baz",
|
||||||
⋮ insert: "Baz",
|
kind: Enum,
|
||||||
⋮ kind: Enum,
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "Foo",
|
||||||
⋮ label: "Foo",
|
source_range: [105; 105),
|
||||||
⋮ source_range: [105; 105),
|
delete: [105; 105),
|
||||||
⋮ delete: [105; 105),
|
insert: "Foo",
|
||||||
⋮ insert: "Foo",
|
kind: Struct,
|
||||||
⋮ kind: Struct,
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "quux",
|
||||||
⋮ label: "quux",
|
source_range: [105; 105),
|
||||||
⋮ source_range: [105; 105),
|
delete: [105; 105),
|
||||||
⋮ delete: [105; 105),
|
insert: "quux()$0",
|
||||||
⋮ insert: "quux()$0",
|
kind: Function,
|
||||||
⋮ kind: Function,
|
detail: "fn quux()",
|
||||||
⋮ detail: "fn quux()",
|
},
|
||||||
⋮ },
|
]"###
|
||||||
⋮]
|
|
||||||
"###
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_extern_prelude() {
|
fn completes_extern_prelude() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(
|
do_reference_completion(
|
||||||
r"
|
r"
|
||||||
//- /lib.rs
|
//- /lib.rs
|
||||||
use <|>;
|
use <|>;
|
||||||
|
|
||||||
//- /other_crate/lib.rs
|
//- /other_crate/lib.rs
|
||||||
// nothing here
|
// nothing here
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
@r#"[
|
@r#"[
|
||||||
CompletionItem {
|
CompletionItem {
|
||||||
label: "other_crate",
|
label: "other_crate",
|
||||||
source_range: [4; 4),
|
source_range: [4; 4),
|
||||||
|
@ -376,79 +364,75 @@ mod tests {
|
||||||
kind: Module,
|
kind: Module,
|
||||||
},
|
},
|
||||||
]"#
|
]"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_module_items_in_nested_modules() {
|
fn completes_module_items_in_nested_modules() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(
|
do_reference_completion(
|
||||||
r"
|
r"
|
||||||
struct Foo;
|
struct Foo;
|
||||||
mod m {
|
mod m {
|
||||||
struct Bar;
|
struct Bar;
|
||||||
fn quux() { <|> }
|
fn quux() { <|> }
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
@r###"
|
@r###"[
|
||||||
⋮[
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "Bar",
|
||||||
⋮ label: "Bar",
|
source_range: [117; 117),
|
||||||
⋮ source_range: [117; 117),
|
delete: [117; 117),
|
||||||
⋮ delete: [117; 117),
|
insert: "Bar",
|
||||||
⋮ insert: "Bar",
|
kind: Struct,
|
||||||
⋮ kind: Struct,
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "quux",
|
||||||
⋮ label: "quux",
|
source_range: [117; 117),
|
||||||
⋮ source_range: [117; 117),
|
delete: [117; 117),
|
||||||
⋮ delete: [117; 117),
|
insert: "quux()$0",
|
||||||
⋮ insert: "quux()$0",
|
kind: Function,
|
||||||
⋮ kind: Function,
|
detail: "fn quux()",
|
||||||
⋮ detail: "fn quux()",
|
},
|
||||||
⋮ },
|
]"###
|
||||||
⋮]
|
);
|
||||||
"###
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_return_type() {
|
fn completes_return_type() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(
|
do_reference_completion(
|
||||||
r"
|
r"
|
||||||
struct Foo;
|
struct Foo;
|
||||||
fn x() -> <|>
|
fn x() -> <|>
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
@r###"
|
@r###"[
|
||||||
⋮[
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "Foo",
|
||||||
⋮ label: "Foo",
|
source_range: [55; 55),
|
||||||
⋮ source_range: [55; 55),
|
delete: [55; 55),
|
||||||
⋮ delete: [55; 55),
|
insert: "Foo",
|
||||||
⋮ insert: "Foo",
|
kind: Struct,
|
||||||
⋮ kind: Struct,
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "x",
|
||||||
⋮ label: "x",
|
source_range: [55; 55),
|
||||||
⋮ source_range: [55; 55),
|
delete: [55; 55),
|
||||||
⋮ delete: [55; 55),
|
insert: "x()$0",
|
||||||
⋮ insert: "x()$0",
|
kind: Function,
|
||||||
⋮ kind: Function,
|
detail: "fn x()",
|
||||||
⋮ detail: "fn x()",
|
},
|
||||||
⋮ },
|
]"###
|
||||||
⋮]
|
);
|
||||||
"###
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn dont_show_both_completions_for_shadowing() {
|
fn dont_show_both_completions_for_shadowing() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(
|
do_reference_completion(
|
||||||
r"
|
r"
|
||||||
fn foo() {
|
fn foo() {
|
||||||
let bar = 92;
|
let bar = 92;
|
||||||
{
|
{
|
||||||
|
@ -457,35 +441,33 @@ mod tests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
@r###"
|
@r###"[
|
||||||
⋮[
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "bar",
|
||||||
⋮ label: "bar",
|
source_range: [146; 146),
|
||||||
⋮ source_range: [146; 146),
|
delete: [146; 146),
|
||||||
⋮ delete: [146; 146),
|
insert: "bar",
|
||||||
⋮ insert: "bar",
|
kind: Binding,
|
||||||
⋮ kind: Binding,
|
detail: "i32",
|
||||||
⋮ detail: "i32",
|
},
|
||||||
⋮ },
|
CompletionItem {
|
||||||
⋮ CompletionItem {
|
label: "foo",
|
||||||
⋮ label: "foo",
|
source_range: [146; 146),
|
||||||
⋮ source_range: [146; 146),
|
delete: [146; 146),
|
||||||
⋮ delete: [146; 146),
|
insert: "foo()$0",
|
||||||
⋮ insert: "foo()$0",
|
kind: Function,
|
||||||
⋮ kind: Function,
|
detail: "fn foo()",
|
||||||
⋮ detail: "fn foo()",
|
},
|
||||||
⋮ },
|
]"###
|
||||||
⋮]
|
);
|
||||||
"###
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_self_in_methods() {
|
fn completes_self_in_methods() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(r"impl S { fn foo(&self) { <|> } }"),
|
do_reference_completion(r"impl S { fn foo(&self) { <|> } }"),
|
||||||
@r#"[
|
@r#"[
|
||||||
CompletionItem {
|
CompletionItem {
|
||||||
label: "Self",
|
label: "Self",
|
||||||
source_range: [25; 25),
|
source_range: [25; 25),
|
||||||
|
@ -502,14 +484,14 @@ mod tests {
|
||||||
detail: "&{unknown}",
|
detail: "&{unknown}",
|
||||||
},
|
},
|
||||||
]"#
|
]"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn completes_prelude() {
|
fn completes_prelude() {
|
||||||
assert_debug_snapshot_matches!(
|
assert_debug_snapshot_matches!(
|
||||||
do_reference_completion(
|
do_reference_completion(
|
||||||
"
|
"
|
||||||
//- /main.rs
|
//- /main.rs
|
||||||
fn foo() { let x: <|> }
|
fn foo() { let x: <|> }
|
||||||
|
|
||||||
|
@ -521,8 +503,8 @@ mod tests {
|
||||||
struct Option;
|
struct Option;
|
||||||
}
|
}
|
||||||
"
|
"
|
||||||
),
|
),
|
||||||
@r#"[
|
@r#"[
|
||||||
CompletionItem {
|
CompletionItem {
|
||||||
label: "Option",
|
label: "Option",
|
||||||
source_range: [18; 18),
|
source_range: [18; 18),
|
||||||
|
@ -546,6 +528,6 @@ mod tests {
|
||||||
kind: Module,
|
kind: Module,
|
||||||
},
|
},
|
||||||
]"#
|
]"#
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue