typst-lsp
typst-lsp copied to clipboard
Hover popup not showing up when hovering the keyword's first character.
-
Component:
- LSP (used with other editor)
- LSP version: 0.12.1
- OS version and name: Manjaro Linux (Kernel 6.7.4)
- I am on the latest stable version of the extension/LSP.
- I have searched the issues of this repo and believe that this is not a duplicate.
Issue
The LSP does not seem to react to the cursor hovering when hovering the first character of the keyword. I have noticed this on my NeoVim and checked this also happens in VS Code.
Temporal Fix
Add +1
to the line in src/server/hover.rs
:
https://github.com/nvarner/typst-lsp/blob/0d5b9330a1d515fa47456e755f751ea4056282b8/src/server/hover.rs#L27C17-L28C92
let typst_offset =
lsp_to_typst::position_to_offset(position, position_encoding, &source) + 1;
Possible cause
possibly, wrong byte index (shifted by one) is returned from typst_syntax::source::Source::utf16_to_byte
and/or typst_syntax::source::Source::line_column_to_byte