File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
crates/rust-analyzer/src/lsp Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -496,8 +496,15 @@ pub(crate) fn signature_help(
496496 . parameter_ranges ( )
497497 . iter ( )
498498 . map ( |it| {
499- let start = call_info. signature [ ..it. start ( ) . into ( ) ] . chars ( ) . count ( ) as u32 ;
500- let end = call_info. signature [ ..it. end ( ) . into ( ) ] . chars ( ) . count ( ) as u32 ;
499+ let start = call_info. signature [ ..it. start ( ) . into ( ) ]
500+ . chars ( )
501+ . map ( |c| c. len_utf16 ( ) )
502+ . sum :: < usize > ( ) as u32 ;
503+ let end = start
504+ + call_info. signature [ it. start ( ) . into ( ) ..it. end ( ) . into ( ) ]
505+ . chars ( )
506+ . map ( |c| c. len_utf16 ( ) )
507+ . sum :: < usize > ( ) as u32 ;
501508 [ start, end]
502509 } )
503510 . map ( |label_offsets| lsp_types:: ParameterInformation {
@@ -516,9 +523,9 @@ pub(crate) fn signature_help(
516523 label. push_str ( ", " ) ;
517524 }
518525 first = false ;
519- let start = label. chars ( ) . count ( ) as u32 ;
526+ let start = label. len ( ) as u32 ;
520527 label. push_str ( param) ;
521- let end = label. chars ( ) . count ( ) as u32 ;
528+ let end = label. len ( ) as u32 ;
522529 params. push ( lsp_types:: ParameterInformation {
523530 label : lsp_types:: ParameterLabel :: LabelOffsets ( [ start, end] ) ,
524531 documentation : None ,
You can’t perform that action at this time.
0 commit comments