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

`:checkhealth telescope._extensions.repo` error

Open mimikun opened this issue 1 year ago • 4 comments

minimal reproduce config:

for name, url in pairs({
    plenary_nvim = "https://github.com/nvim-lua/plenary.nvim",
    telescope_nvim = "https://github.com/nvim-telescope/telescope.nvim",
    telescope_repo_nvim = "https://github.com/cljoly/telescope-repo.nvim",
}) do
    local install_path = vim.fn.fnamemodify("nvim_issue/" .. name, ":p")
    if vim.fn.isdirectory(install_path) == 0 then
        vim.fn.system({ "git", "clone", "--depth=1", url, install_path })
    end
    vim.opt.runtimepath:append(install_path)
end

local telescope = require("telescope")

telescope.setup({
    extensions = {
        repo = {},
    },
})

telescope.load_extension("repo")

error message:

==============================================================================
telescope._extensions.repo: require("telescope._extensions.repo.health").check()

- ERROR Failed to run healthcheck for "telescope._extensions.repo" plugin. Exception:
  ...ope_repo_nvim//lua/telescope/_extensions/repo/health.lua:102: attempt to call field 'report_ok' (a nil value)

mimikun avatar Sep 08 '24 01:09 mimikun

Could you please also share the neovim version you are using @mimikun ?

cljoly avatar Sep 15 '24 22:09 cljoly

my version:

NVIM v0.11.0-dev-777+g78b851093
Build type: RelWithDebInfo
LuaJIT 2.1.1724512491
Run "nvim -V1 -v" for more info

mimikun avatar Sep 16 '24 05:09 mimikun

I ran checkhealth on neovim 0.10.1 and got the following results:

āÆ nvim --version
NVIM v0.10.1
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info
==============================================================================
telescope._extensions.repo: require("telescope._extensions.repo.health").check()

- WARNING vim.health.report_ok() is deprecated, use vim.health.ok() instead. :help |deprecated|
  Feature will be removed in Nvim 0.11
- OK Will use `bat` to preview non-markdown READMEs
- OK Will use `glow` to preview markdown READMEs
- OK locate: found `locate`
  locate (GNU findutils) 4.8.0
  Copyright (C) 2021 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.

  Written by Eric B. Decker, James Youngman, and Kevin Dalley.

- WARNING vim.health.report_info() is deprecated, use vim.health.info() instead. :help |deprecated|
  Feature will be removed in Nvim 0.11
- Repos found for `:Telescope repo cached_list`:
  /home/linuxbrew/.linuxbrew/Homebrew/.git, /home/mimikun/.bash_it/.git...
- OK fd: found `fd`
  fd 10.2.0

- Repos found for `:Telescope repo list`:
  /tmp/nvim_issue/telescope_repo_nvim, /tmp/nvim_issue/plenary_nvim...

I don't know how to fix this because I'm making the plugin with only the latest version of neovim in mind

mimikun avatar Sep 16 '24 05:09 mimikun

Ok, so when the command is run on 0.10, the plugin uses a soon to be deprecated API. From the output:

- WARNING vim.health.report_info() is deprecated, use vim.health.info() instead. :help |deprecated|
  Feature will be removed in Nvim 0.11

and then the output from Nvim 0.11 reads:

- ERROR Failed to run healthcheck for "telescope._extensions.repo" plugin. Exception:
  ...ope_repo_nvim//lua/telescope/_extensions/repo/health.lua:102: attempt to call field 'report_ok' (a nil value)

So presumably this was removed already from Nvim 0.11.

At the moment telescope-repo.nvim requires Nvim 0.7. We could either

  1. bump this to 0.10 and use the new function (vim.health.ok) or
  2. have a fallback in the lua code, that uses vim.health.ok if possible and fallback to vim.health.report_ok:
local report_ok = vim.health.ok or vim.health.report_ok

Considering there is already a fallback implemented, I think it’s a good time to require a more modern nvim and simplify the code (so option 1. above). You can try to open a PR for that if you want or I’ll do it eventually.

cljoly avatar Sep 23 '24 07:09 cljoly