File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
crates/ide_completion/src/render Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,20 @@ struct FunctionRender<'a> {
4040 name : String ,
4141 receiver : Option < hir:: Name > ,
4242 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.
4357 ast_node : ast:: Fn ,
4458 is_method : bool ,
4559}
You can’t perform that action at this time.
0 commit comments