File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
src/tools/rust-analyzer/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 @@ -493,8 +493,15 @@ pub(crate) fn signature_help(
493493 . parameter_ranges ( )
494494 . iter ( )
495495 . map ( |it| {
496- let start = call_info. signature [ ..it. start ( ) . into ( ) ] . chars ( ) . count ( ) as u32 ;
497- let end = call_info. signature [ ..it. end ( ) . into ( ) ] . chars ( ) . count ( ) as u32 ;
496+ let start = call_info. signature [ ..it. start ( ) . into ( ) ]
497+ . chars ( )
498+ . map ( |c| c. len_utf16 ( ) )
499+ . sum :: < usize > ( ) as u32 ;
500+ let end = start
501+ + call_info. signature [ it. start ( ) . into ( ) ..it. end ( ) . into ( ) ]
502+ . chars ( )
503+ . map ( |c| c. len_utf16 ( ) )
504+ . sum :: < usize > ( ) as u32 ;
498505 [ start, end]
499506 } )
500507 . map ( |label_offsets| lsp_types:: ParameterInformation {
@@ -513,9 +520,9 @@ pub(crate) fn signature_help(
513520 label. push_str ( ", " ) ;
514521 }
515522 first = false ;
516- let start = label. chars ( ) . count ( ) as u32 ;
523+ let start = label. len ( ) as u32 ;
517524 label. push_str ( param) ;
518- let end = label. chars ( ) . count ( ) as u32 ;
525+ let end = label. len ( ) as u32 ;
519526 params. push ( lsp_types:: ParameterInformation {
520527 label : lsp_types:: ParameterLabel :: LabelOffsets ( [ start, end] ) ,
521528 documentation : None ,
You can’t perform that action at this time.
0 commit comments