aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists/src/handlers/add_new.rs
diff options
context:
space:
mode:
authorBenjamin Coenen <[email protected]>2020-04-11 21:54:22 +0100
committerBenjamin Coenen <[email protected]>2020-04-11 22:45:09 +0100
commit93bfc2d05d36a47dc05a1799210327473d702dbc (patch)
treedee25e78b24b5d1b23d73ae1009bddbd060927cf /crates/ra_assists/src/handlers/add_new.rs
parentd42346fed61f706d68fe888631a41ea5f2752d7f (diff)
parentfd06fe7b13045185ab4e630b0044aa9d8bbcdf8a (diff)
Improve autocompletion by looking on the type and name
Signed-off-by: Benjamin Coenen <[email protected]>
Diffstat (limited to 'crates/ra_assists/src/handlers/add_new.rs')
-rw-r--r--crates/ra_assists/src/handlers/add_new.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/crates/ra_assists/src/handlers/add_new.rs b/crates/ra_assists/src/handlers/add_new.rs
index c10397249..240b19fa3 100644
--- a/crates/ra_assists/src/handlers/add_new.rs
+++ b/crates/ra_assists/src/handlers/add_new.rs
@@ -1,8 +1,7 @@
1use hir::Adt; 1use hir::Adt;
2use ra_syntax::{ 2use ra_syntax::{
3 ast::{ 3 ast::{
4 self, AstNode, AstToken, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, 4 self, AstNode, NameOwner, StructKind, TypeAscriptionOwner, TypeParamsOwner, VisibilityOwner,
5 VisibilityOwner,
6 }, 5 },
7 TextUnit, T, 6 TextUnit, T,
8}; 7};
@@ -106,7 +105,7 @@ fn generate_impl_text(strukt: &ast::StructDef, code: &str) -> String {
106 if let Some(type_params) = type_params { 105 if let Some(type_params) = type_params {
107 let lifetime_params = type_params 106 let lifetime_params = type_params
108 .lifetime_params() 107 .lifetime_params()
109 .filter_map(|it| it.lifetime()) 108 .filter_map(|it| it.lifetime_token())
110 .map(|it| it.text().clone()); 109 .map(|it| it.text().clone());
111 let type_params = 110 let type_params =
112 type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone()); 111 type_params.type_params().filter_map(|it| it.name()).map(|it| it.text().clone());