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(
1818 sema : & Semantics < ' _ , RootDatabase > ,
1919 config : & InlayHintsConfig ,
2020 file_id : EditionedFileId ,
21- node : SyntaxNode ,
21+ mut node : SyntaxNode ,
2222) -> Option < ( ) > {
2323 let min_lines = config. closing_brace_hints_min_lines ?;
2424
@@ -52,6 +52,13 @@ pub(super) fn hints(
5252
5353 let module = ast:: Module :: cast ( list. syntax ( ) . parent ( ) ?) ?;
5454 ( 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 ( ) ) )
5562 } else if let Some ( block) = ast:: BlockExpr :: cast ( node. clone ( ) ) {
5663 closing_token = block. stmt_list ( ) ?. r_curly_token ( ) ?;
5764
You can’t perform that action at this time.
0 commit comments