Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/completions/record.rs')
-rw-r--r--crates/ide-completion/src/completions/record.rs38
1 files changed, 37 insertions, 1 deletions
diff --git a/crates/ide-completion/src/completions/record.rs b/crates/ide-completion/src/completions/record.rs
index 5d96fbd30a..6743ec897f 100644
--- a/crates/ide-completion/src/completions/record.rs
+++ b/crates/ide-completion/src/completions/record.rs
@@ -124,7 +124,12 @@ fn complete_fields(
#[cfg(test)]
mod tests {
- use crate::tests::check_edit;
+ use ide_db::SnippetCap;
+
+ use crate::{
+ tests::{check_edit, check_edit_with_config, TEST_CONFIG},
+ CompletionConfig,
+ };
#[test]
fn literal_struct_completion_edit() {
@@ -152,6 +157,37 @@ fn baz() {
}
#[test]
+ fn enum_variant_no_snippets() {
+ let conf = CompletionConfig { snippet_cap: SnippetCap::new(false), ..TEST_CONFIG };
+ check_edit_with_config(
+ conf,
+ "Variant()",
+ r#"
+enum Enum {
+ Variant(usize),
+}
+
+impl Enum {
+ fn new(u: usize) -> Self {
+ Self::Va$0
+ }
+}
+"#,
+ r#"
+enum Enum {
+ Variant(usize),
+}
+
+impl Enum {
+ fn new(u: usize) -> Self {
+ Self::Variant
+ }
+}
+"#,
+ )
+ }
+
+ #[test]
fn literal_struct_impl_self_completion() {
check_edit(
"Self{}",