Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Hover popup not showing up when hovering the keyword's first character. #436

Open
Momijiichigo opened this issue Feb 23, 2024 · 1 comment

Comments

@Momijiichigo
Copy link

Momijiichigo commented Feb 23, 2024

  • 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

@Momijiichigo Momijiichigo changed the title Hover popup does not show up when hovering the first character of the keyword. Hover popup not showing up when hovering the keyword's first character. Feb 23, 2024
@Enter-tainer
Copy link
Collaborator

#145 might be related

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants