Skip to content

Commit

Permalink
internal: document query implication of completion rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed Jul 31, 2021
1 parent d4e381f commit 0875601
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions crates/ide_completion/src/render/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,20 @@ struct FunctionRender<'a> {
name: String,
receiver: Option<hir::Name>,
func: hir::Function,
/// NB: having `ast::Fn` here might or might not be a good idea. The problem
/// with it is that, to get an `ast::`, you want to parse the corresponding
/// source file. So, when flyimport completions suggest a bunch of
/// functions, we spend quite some time parsing many files.
///
/// We need ast because we want to access parameter names (patterns). We can
/// add them to the hir of the function itself, but parameter names are not
/// something hir cares otherwise.
///
/// Alternatively we can reconstruct params from the function body, but that
/// would require parsing anyway.
///
/// It seems that just using `ast` is the best choice -- most of parses
/// should be cached anyway.
ast_node: ast::Fn,
is_method: bool,
}
Expand Down

0 comments on commit 0875601

Please sign in to comment.