WIP: Add additional closing brace inlay hints #19207
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Working on additional inlay hints for #18833, and looking for some guidance.
Currently we traverse the syntax tree, checking if the current node is a block-like expression, then figuring out the type of the parent.
Currently I include almost every child of the parent syntax element (ex. function's visibility, params, types, ...) in the type hint, then join newlines and truncate the string to
InlayHintsConfig.max_length
.HirFormatter
has amax_size
field, but most of the implementations don't currently respect it. If I updated them to do so, and also added a configuration to exclude specific children, I think the text for each inlay hint could be gotten with a single call likeparent.display_truncate_exclude(max_size: 40, exclude: vec![block_child])
. Does that seem like a good way to go?format!
on the AST nodes, because I had them already. If hir-format is not respectingmax_size
, is there still a reason to prefer HIR display functions?regex
crate?