fix: add shim for vim.lsp.util._str_byteindex() (#3338)

Will be removed in Nvim 0.11: https://github.com/neovim/neovim/pull/30915
This commit is contained in:
Tristan Knight
2024-10-26 15:33:10 +01:00
committed by GitHub
parent df534c3042
commit 37dc9233a4
2 changed files with 13 additions and 1 deletions

View File

@@ -105,7 +105,7 @@ end
---@return lsp.Location
local function item_to_location(item, offset_encoding)
local line = item.lnum - 1
local character = vim.lsp.util._str_utfindex_enc(item.text, item.col, offset_encoding) - 1
local character = utils.str_byteindex(item.text, item.col, offset_encoding or "utf-16") - 1
local uri
if utils.is_uri(item.filename) then
uri = item.filename