telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

attempt to call field 'str_byteindex' (a nil value)

Open juanolon opened this issue 11 months ago • 1 comments

Description

I have seem related issues already closed (#3346), but i still get the error:

Error executing vim.schedule lua callback: ...nvim/lazy/telescope.nvim/lua/telescope/builtin/__lsp.lua:129: attempt to call f
ield 'str_byteindex' (a nil value)                                                                                  
stack traceback:                                                                                                             
        ...nvim/lazy/telescope.nvim/lua/telescope/builtin/__lsp.lua:129: in function 'item_to_location'                      
        ...nvim/lazy/telescope.nvim/lua/telescope/builtin/__lsp.lua:265: in function 'handler'                               
        /usr/local/share/nvim/runtime/lua/vim/lsp.lua:936: in function 'handler'                                             
        /usr/local/share/nvim/runtime/lua/vim/lsp/client.lua:687: in function ''                                             
        vim/_editor.lua: in function <vim/_editor.lua:0>            

At first, i thought it was about my nvim version, but i just upgraded from 0.10.2 to 0.10.3 without success. Then I reinstalled telescope (i'm using Lazy) and checked that the version are okey. Everything right. Heck, i even looked into the local source file (https://github.com/nvim-telescope/telescope.nvim/blob/master/lua/telescope/utils.lua) to check if the function exists, and it does. So then i checked if the import is correct:

:lua print(require "telescope.utils".iswin)

prints false, and

:lua print(require "telescope.utils".islist)

prints function: 0x7f... but!

:lua print(require "telescope.utils".str_byteindex)

prints nil

I asked chaty (yeah, chatgpt) and got the following experiment:

:lua package.loaded["telescope.utils"] = nil
:lua print(require("telescope.utils").str_byteindex)

now it prints function: 0x7f... But still, my mapping (gd -> Telescope lsp_definitions) don't work.

Btw. :lua vim.lsp.buf.definition() works

Neovim version

NVIM v0.10.3
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info

Operating system and version

debian

Telescope version / branch / rev

master (2eca9ba)

checkhealth telescope

==============================================================================
telescope: health#telescope#check

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 13.0.0
- OK fd: found fdfind 8.6.0

===== Installed extensions ===== ~

Telescope Extension: `find_template` ~
- No healthcheck provided

Telescope Extension: `fzf` ~
- OK lib working as expected
- OK file_sorter correctly configured
- OK generic_sorter correctly configured

Telescope Extension: `session-lens` ~
- No healthcheck provided

Telescope Extension: `ui-select` ~
- No healthcheck provided

Steps to reproduce

described above

Expected behavior

No response

Actual behavior

described above

Minimal config

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs { "config", "data", "state", "cache" } do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
  vim.fn.system {
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  }
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    config = function()
      -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
      require("telescope").setup {}
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

juanolon avatar Jan 03 '25 15:01 juanolon

Seems related to https://github.com/nvim-telescope/telescope.nvim/issues/3411 I still don't have any idea how this is happening.

jamestrew avatar Feb 24 '25 16:02 jamestrew