Auto merge of #18075 - roife:fix-issue-17858, r=Veykril

feat: render patterns in params for hovering

Fix #17858

This PR introduces an option to [hir-def/src/body/pretty.rs](08c7bbc2db/crates/hir-def/src/body/pretty.rs) to render the result as a single line, which is then reused for rendering patterns in parameters for hovering.
This commit is contained in:
bors 2024-09-11 12:05:57 +00:00
commit c54a827f50
4 changed files with 303 additions and 24 deletions

View file

@ -227,6 +227,17 @@ impl Body {
pretty::print_expr_hir(db, self, owner, expr, edition)
}
pub fn pretty_print_pat(
&self,
db: &dyn DefDatabase,
owner: DefWithBodyId,
pat: PatId,
oneline: bool,
edition: Edition,
) -> String {
pretty::print_pat_hir(db, self, owner, pat, oneline, edition)
}
fn new(
db: &dyn DefDatabase,
owner: DefWithBodyId,