From 040fb91387105bca7f2b6fcb845f836217b0a7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Tue, 12 Feb 2019 19:58:36 +0200 Subject: Filter attributes from the completion details/label --- crates/ra_ide_api/src/completion/complete_dot.rs | 20 +++++++++++++++++ .../completion_item__method_attr_filtering.snap | 26 ++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 crates/ra_ide_api/src/completion/snapshots/completion_item__method_attr_filtering.snap (limited to 'crates/ra_ide_api/src/completion') diff --git a/crates/ra_ide_api/src/completion/complete_dot.rs b/crates/ra_ide_api/src/completion/complete_dot.rs index a673dbdcf..be839345f 100644 --- a/crates/ra_ide_api/src/completion/complete_dot.rs +++ b/crates/ra_ide_api/src/completion/complete_dot.rs @@ -179,6 +179,26 @@ mod tests { ); } + #[test] + fn test_method_attr_filtering() { + check_ref_completion( + "method_attr_filtering", + r" + struct A {} + impl A { + #[inline] + fn the_method(&self) { + let x = 1; + let y = 2; + } + } + fn foo(a: A) { + a.<|> + } + ", + ); + } + #[test] fn test_tuple_field_completion() { check_ref_completion( diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__method_attr_filtering.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__method_attr_filtering.snap new file mode 100644 index 000000000..46f9fa971 --- /dev/null +++ b/crates/ra_ide_api/src/completion/snapshots/completion_item__method_attr_filtering.snap @@ -0,0 +1,26 @@ +--- +created: "2019-02-12T18:32:09.428929418Z" +creator: insta@0.6.2 +source: crates/ra_ide_api/src/completion/completion_item.rs +expression: kind_completions +--- +[ + CompletionItem { + completion_kind: Reference, + label: "the_method", + kind: Some( + Method + ), + detail: Some( + "fn the_method(&self)" + ), + documentation: None, + lookup: None, + insert_text: Some( + "the_method()$0" + ), + insert_text_format: Snippet, + source_range: [249; 249), + text_edit: None + } +] -- cgit v1.2.3