aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_assists
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_assists')
-rw-r--r--crates/ra_assists/src/ast_transform.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/crates/ra_assists/src/ast_transform.rs b/crates/ra_assists/src/ast_transform.rs
index eac2903d1..56b7588ef 100644
--- a/crates/ra_assists/src/ast_transform.rs
+++ b/crates/ra_assists/src/ast_transform.rs
@@ -2,7 +2,7 @@
2use rustc_hash::FxHashMap; 2use rustc_hash::FxHashMap;
3 3
4use hir::{db::HirDatabase, InFile, PathResolution}; 4use hir::{db::HirDatabase, InFile, PathResolution};
5use ra_syntax::ast::{self, make, AstNode}; 5use ra_syntax::ast::{self, AstNode};
6 6
7pub trait AstTransform<'a> { 7pub trait AstTransform<'a> {
8 fn get_substitution( 8 fn get_substitution(
@@ -134,11 +134,18 @@ impl<'a, DB: HirDatabase> QualifyPaths<'a, DB> {
134 match resolution { 134 match resolution {
135 PathResolution::Def(def) => { 135 PathResolution::Def(def) => {
136 let found_path = from.find_use_path(self.db, def)?; 136 let found_path = from.find_use_path(self.db, def)?;
137 let args = p 137 let mut path = path_to_ast(found_path);
138
139 let type_args = p
138 .segment() 140 .segment()
139 .and_then(|s| s.type_arg_list()) 141 .and_then(|s| s.type_arg_list())
140 .map(|arg_list| apply(self, node.with_value(arg_list))); 142 .map(|arg_list| apply(self, node.with_value(arg_list)));
141 Some(make::path_with_type_arg_list(path_to_ast(found_path), args).syntax().clone()) 143 if let Some(type_args) = type_args {
144 let last_segment = path.segment().unwrap();
145 path = path.with_segment(last_segment.with_type_args(type_args))
146 }
147
148 Some(path.syntax().clone())
142 } 149 }
143 PathResolution::Local(_) 150 PathResolution::Local(_)
144 | PathResolution::TypeParam(_) 151 | PathResolution::TypeParam(_)