File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/tools/rust-analyzer/crates/ide/src/inlay_hints Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ pub(super) fn hints(
18
18
sema : & Semantics < ' _ , RootDatabase > ,
19
19
config : & InlayHintsConfig ,
20
20
file_id : EditionedFileId ,
21
- node : SyntaxNode ,
21
+ mut node : SyntaxNode ,
22
22
) -> Option < ( ) > {
23
23
let min_lines = config. closing_brace_hints_min_lines ?;
24
24
@@ -52,6 +52,13 @@ pub(super) fn hints(
52
52
53
53
let module = ast:: Module :: cast ( list. syntax ( ) . parent ( ) ?) ?;
54
54
( format ! ( "mod {}" , module. name( ) ?) , module. name ( ) . map ( name) )
55
+ } else if let Some ( label) = ast:: Label :: cast ( node. clone ( ) ) {
56
+ // in this case, `ast::Label` could be seen as a part of `ast::BlockExpr`, to respect the `min_lines` config
57
+ node = node. parent ( ) ?;
58
+ let block = label. syntax ( ) . parent ( ) . and_then ( ast:: BlockExpr :: cast) ?;
59
+ closing_token = block. stmt_list ( ) ?. r_curly_token ( ) ?;
60
+ let lifetime = label. lifetime ( ) . map_or_else ( String :: new, |it| it. to_string ( ) ) ;
61
+ ( lifetime, Some ( label. syntax ( ) . text_range ( ) ) )
55
62
} else if let Some ( block) = ast:: BlockExpr :: cast ( node. clone ( ) ) {
56
63
closing_token = block. stmt_list ( ) ?. r_curly_token ( ) ?;
57
64
You can’t perform that action at this time.
0 commit comments