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