mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-03 05:13:35 +00:00
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:
commit
c54a827f50
4 changed files with 303 additions and 24 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue