aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/completion')
-rw-r--r--crates/ra_ide/src/completion/complete_record.rs37
1 files changed, 35 insertions, 2 deletions
diff --git a/crates/ra_ide/src/completion/complete_record.rs b/crates/ra_ide/src/completion/complete_record.rs
index 79f5c8c8f..2352ced5f 100644
--- a/crates/ra_ide/src/completion/complete_record.rs
+++ b/crates/ra_ide/src/completion/complete_record.rs
@@ -59,7 +59,7 @@ fn pattern_ascribed_fields(record_pat: &ast::RecordPat) -> Vec<SmolStr> {
59 59
60#[cfg(test)] 60#[cfg(test)]
61mod tests { 61mod tests {
62 mod record_lit_tests { 62 mod record_pat_tests {
63 use insta::assert_debug_snapshot; 63 use insta::assert_debug_snapshot;
64 64
65 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind}; 65 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
@@ -205,7 +205,7 @@ mod tests {
205 } 205 }
206 } 206 }
207 207
208 mod record_pat_tests { 208 mod record_lit_tests {
209 use insta::assert_debug_snapshot; 209 use insta::assert_debug_snapshot;
210 210
211 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind}; 211 use crate::completion::{test_utils::do_completion, CompletionItem, CompletionKind};
@@ -410,5 +410,38 @@ mod tests {
410 ] 410 ]
411 "###); 411 "###);
412 } 412 }
413
414 #[test]
415 fn completes_functional_update() {
416 let completions = complete(
417 r"
418 struct S {
419 foo1: u32,
420 foo2: u32,
421 }
422
423 fn main() {
424 let foo1 = 1;
425 let s = S {
426 foo1,
427 <|>
428 .. loop {}
429 }
430 }
431 ",
432 );
433 assert_debug_snapshot!(completions, @r###"
434 [
435 CompletionItem {
436 label: "foo2",
437 source_range: [221; 221),
438 delete: [221; 221),
439 insert: "foo2",
440 kind: Field,
441 detail: "u32",
442 },
443 ]
444 "###);
445 }
413 } 446 }
414} 447}