Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

:checkhealth telescope._extensions.repo error #77

Open
mimikun opened this issue Sep 8, 2024 · 4 comments
Open

:checkhealth telescope._extensions.repo error #77

mimikun opened this issue Sep 8, 2024 · 4 comments

Comments

@mimikun
Copy link

mimikun commented Sep 8, 2024

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)
@cljoly
Copy link
Owner

cljoly commented Sep 15, 2024

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

@mimikun
Copy link
Author

mimikun commented Sep 16, 2024

my version:

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

@mimikun
Copy link
Author

mimikun commented Sep 16, 2024

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

@cljoly
Copy link
Owner

cljoly commented Sep 23, 2024

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.

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

No branches or pull requests

2 participants