Skip to content

LSP hover provider crashes on Neovim nightly (0.13.0-dev): _get_line_byte_from_position removed #20

Description

@lukeorland

Description

The LSP hover provider crashes with an internal API error when running on a recent Neovim nightly build (v0.13.0-dev-927+ga6827be98f, LuaJIT 2.1.1787058514). The build appears to be part of Neovim's ongoing internal Lua core rewrite (note the [string "vim/_core/editor"] frame in the traceback).

vim.lsp.util._get_line_byte_from_position — an internal/private API — no longer exists in that build, and hover.lua still calls it directly:

https://github.com/patrickpichler/hovercraft.nvim/blob/main/lua/hovercraft/provider/lsp/hover.lua#L98-L99

local start_idx = vim.lsp.util._get_line_byte_from_position(bufnr, start, client.offset_encoding)
local end_idx = vim.lsp.util._get_line_byte_from_position(bufnr, end_, client.offset_encoding)

Error

vim.schedule callback: .../hovercraft/provider/lsp/hover.lua:98: attempt to call field '_get_line_byte_from_position' (a nil value)
stack traceback:
    .../hovercraft/provider/lsp/hover.lua:98: in function 'handler'
    .../vim/lsp.lua:1287: in function 'handler'
    .../vim/lsp/client.lua:767: in function 'fn'
    [string "vim/_core/editor"]:408: in function <[string "vim/_core/editor"]:407>

Steps to reproduce

  1. Run Neovim v0.13.0-dev-927+ga6827be98f (or similar recent nightly)
  2. Install hovercraft.nvim with the LSP provider enabled
  3. Trigger hover (K) on any symbol with an active LSP client

Expected

Hover should render without error, using a public/stable API to compute byte offsets from LSP positions (e.g. something built on vim.str_byteindex / the client's offset_encoding, rather than the private _get_line_byte_from_position).

Environment

  • hovercraft.nvim: current main: 20323b1
  • Neovim: v0.13.0-dev-927+ga6827be98f (nightly, via brew install neovim --HEAD)
  • Note: this build is very bleeding-edge; the same code works fine on stable Neovim 0.12.4. Filing mainly so it's tracked in case that private API is dropped in a future stable release too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions