File tree 1 file changed +14
-0
lines changed
crates/ide_completion/src/render 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,20 @@ struct FunctionRender<'a> {
40
40
name : String ,
41
41
receiver : Option < hir:: Name > ,
42
42
func : hir:: Function ,
43
+ /// NB: having `ast::Fn` here might or might not be a good idea. The problem
44
+ /// with it is that, to get an `ast::`, you want to parse the corresponding
45
+ /// source file. So, when flyimport completions suggest a bunch of
46
+ /// functions, we spend quite some time parsing many files.
47
+ ///
48
+ /// We need ast because we want to access parameter names (patterns). We can
49
+ /// add them to the hir of the function itself, but parameter names are not
50
+ /// something hir cares otherwise.
51
+ ///
52
+ /// Alternatively we can reconstruct params from the function body, but that
53
+ /// would require parsing anyway.
54
+ ///
55
+ /// It seems that just using `ast` is the best choice -- most of parses
56
+ /// should be cached anyway.
43
57
ast_node : ast:: Fn ,
44
58
is_method : bool ,
45
59
}
You can’t perform that action at this time.
0 commit comments