From b47a88be9c2d486cc97c0e893f7b47d5d071f93b Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Wed, 28 Nov 2018 17:04:03 +0000 Subject: Change the body and name of the test function completion --- crates/ra_analysis/src/completion/mod.rs | 4 ++-- crates/ra_analysis/src/completion/reference_completion.rs | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/crates/ra_analysis/src/completion/mod.rs b/crates/ra_analysis/src/completion/mod.rs index c7717ab61..839fae641 100644 --- a/crates/ra_analysis/src/completion/mod.rs +++ b/crates/ra_analysis/src/completion/mod.rs @@ -432,7 +432,7 @@ mod tests { // check_snippet_completion(r" // <|> // ", - // r##"[CompletionItem { label: "tfn", lookup: None, snippet: Some("#[test]\nfn $1() {\n $0\n}") }]"##, + // r##"[CompletionItem { label: "Test function", lookup: None, snippet: Some("#[test]\nfn test_${1:feature}() {\n$0\n}"##, // ); check_snippet_completion(r" #[cfg(test)] @@ -440,7 +440,7 @@ mod tests { <|> } ", - r##"[CompletionItem { label: "tfn", lookup: None, snippet: Some("#[test]\nfn $1() {\n $0\n}") }, + r##"[CompletionItem { label: "Test function", lookup: None, snippet: Some("#[test]\nfn test_${1:feature}() {\n$0\n}") }, CompletionItem { label: "pub(crate)", lookup: None, snippet: Some("pub(crate) $0") }]"##, ); } diff --git a/crates/ra_analysis/src/completion/reference_completion.rs b/crates/ra_analysis/src/completion/reference_completion.rs index d301a3c02..e8eb77440 100644 --- a/crates/ra_analysis/src/completion/reference_completion.rs +++ b/crates/ra_analysis/src/completion/reference_completion.rs @@ -173,9 +173,12 @@ fn complete_path( fn complete_mod_item_snippets(acc: &mut Vec) { acc.push(CompletionItem { - label: "tfn".to_string(), + label: "Test function".to_string(), lookup: None, - snippet: Some("#[test]\nfn $1() {\n $0\n}".to_string()), + snippet: Some("#[test]\n\ + fn test_${1:feature}() {\n\ + $0\n\ + }".to_string()), }); acc.push(CompletionItem { label: "pub(crate)".to_string(), -- cgit v1.2.3 From f9884419040453a9ba7869db757bf23b82b705b3 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Wed, 28 Nov 2018 18:39:33 +0000 Subject: Add tfn lookup and remove test prefix --- crates/ra_analysis/src/completion/mod.rs | 2 +- crates/ra_analysis/src/completion/reference_completion.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/ra_analysis/src/completion/mod.rs b/crates/ra_analysis/src/completion/mod.rs index 839fae641..d7acca044 100644 --- a/crates/ra_analysis/src/completion/mod.rs +++ b/crates/ra_analysis/src/completion/mod.rs @@ -440,7 +440,7 @@ mod tests { <|> } ", - r##"[CompletionItem { label: "Test function", lookup: None, snippet: Some("#[test]\nfn test_${1:feature}() {\n$0\n}") }, + r##"[CompletionItem { label: "Test function", lookup: Some("tfn"), snippet: Some("#[test]\nfn ${1:feature}() {\n$0\n}") }, CompletionItem { label: "pub(crate)", lookup: None, snippet: Some("pub(crate) $0") }]"##, ); } diff --git a/crates/ra_analysis/src/completion/reference_completion.rs b/crates/ra_analysis/src/completion/reference_completion.rs index e8eb77440..870c27778 100644 --- a/crates/ra_analysis/src/completion/reference_completion.rs +++ b/crates/ra_analysis/src/completion/reference_completion.rs @@ -174,9 +174,9 @@ fn complete_path( fn complete_mod_item_snippets(acc: &mut Vec) { acc.push(CompletionItem { label: "Test function".to_string(), - lookup: None, + lookup: Some("tfn".to_string()), snippet: Some("#[test]\n\ - fn test_${1:feature}() {\n\ + fn ${1:feature}() {\n\ $0\n\ }".to_string()), }); -- cgit v1.2.3 From 3dea87b05484542631404f096a5e60b94f61c8a6 Mon Sep 17 00:00:00 2001 From: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> Date: Wed, 28 Nov 2018 22:02:53 +0000 Subject: Format completion text properly --- crates/ra_analysis/src/completion/reference_completion.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/ra_analysis/src/completion/reference_completion.rs b/crates/ra_analysis/src/completion/reference_completion.rs index 870c27778..dd147a0e4 100644 --- a/crates/ra_analysis/src/completion/reference_completion.rs +++ b/crates/ra_analysis/src/completion/reference_completion.rs @@ -175,10 +175,13 @@ fn complete_mod_item_snippets(acc: &mut Vec) { acc.push(CompletionItem { label: "Test function".to_string(), lookup: Some("tfn".to_string()), - snippet: Some("#[test]\n\ + snippet: Some( + "#[test]\n\ fn ${1:feature}() {\n\ $0\n\ - }".to_string()), + }" + .to_string() + ), }); acc.push(CompletionItem { label: "pub(crate)".to_string(), -- cgit v1.2.3 From 224e0cee5a2bc5f3d5fe9ea2c9e11f2bfb5339fe Mon Sep 17 00:00:00 2001 From: DJMcNab <36049421+DJMcNab@users.noreply.github.com> Date: Sun, 2 Dec 2018 14:57:54 +0000 Subject: Fix formatting --- crates/ra_analysis/src/completion/reference_completion.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ra_analysis/src/completion/reference_completion.rs b/crates/ra_analysis/src/completion/reference_completion.rs index dd147a0e4..e52062107 100644 --- a/crates/ra_analysis/src/completion/reference_completion.rs +++ b/crates/ra_analysis/src/completion/reference_completion.rs @@ -177,10 +177,10 @@ fn complete_mod_item_snippets(acc: &mut Vec) { lookup: Some("tfn".to_string()), snippet: Some( "#[test]\n\ - fn ${1:feature}() {\n\ - $0\n\ - }" - .to_string() + fn ${1:feature}() {\n\ + $0\n\ + }" + .to_string(), ), }); acc.push(CompletionItem { -- cgit v1.2.3