diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs index 1785a50c2..38507e4dd 100644 --- a/helix-term/src/commands/lsp.rs +++ b/helix-term/src/commands/lsp.rs @@ -904,7 +904,12 @@ pub fn signature_help_impl(cx: &mut Context, invoked: SignatureHelpInvoked) { Some((start, start + string.len())) } lsp::ParameterLabel::LabelOffsets([start, end]) => { - Some((*start as usize, *end as usize)) + // LS sends offsets based on utf-16 based string representation + // but highlighting in helix is done using byte offset. + use helix_core::str_utils::char_to_byte_idx; + let from = char_to_byte_idx(&signature.label, *start as usize); + let to = char_to_byte_idx(&signature.label, *end as usize); + Some((from, to)) } } };