File tree Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Expand file tree Collapse file tree 1 file changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -1134,20 +1134,13 @@ pub(crate) fn handle_document_highlight(
11341134 None
11351135 } ;
11361136
1137- let res = refs
1138- . references
1139- . get ( & position. file_id )
1140- . map ( |file_refs| {
1141- file_refs
1142- . into_iter ( )
1143- . map ( |& ( range, access) | DocumentHighlight {
1144- range : to_proto:: range ( & line_index, range) ,
1145- kind : access. map ( to_proto:: document_highlight_kind) ,
1146- } )
1147- . chain ( decl)
1148- . collect ( )
1149- } )
1150- . unwrap_or_default ( ) ;
1137+ let file_refs = refs. references . get ( & position. file_id ) . map_or ( & [ ] [ ..] , Vec :: as_slice) ;
1138+ let mut res = Vec :: with_capacity ( file_refs. len ( ) + 1 ) ;
1139+ res. extend ( decl) ;
1140+ res. extend ( file_refs. iter ( ) . map ( |& ( range, access) | DocumentHighlight {
1141+ range : to_proto:: range ( & line_index, range) ,
1142+ kind : access. map ( to_proto:: document_highlight_kind) ,
1143+ } ) ) ;
11511144 Ok ( Some ( res) )
11521145}
11531146
You can’t perform that action at this time.
0 commit comments