Skip to content

Fix :checkhealth to call vim.health#48

Open
dfendr wants to merge 3 commits intoekickx:mainfrom
dfendr:patch-1
Open

Fix :checkhealth to call vim.health#48
dfendr wants to merge 3 commits intoekickx:mainfrom
dfendr:patch-1

Conversation

@dfendr
Copy link
Copy Markdown

@dfendr dfendr commented Mar 16, 2023

Changed health check function to work properly, modelled after documentation here: https://neovim.io/doc/user/pi_health.html#health-dev.

Changed health check function to function appropriately, modelled after documentation here: https://neovim.io/doc/user/pi_health.html#health-dev.
fangjunzhou

This comment was marked as off-topic.

Copy link
Copy Markdown

@fangjunzhou fangjunzhou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible solution to attempt to index global 'health' (a nil value)

Comment thread lua/clipboard-image/health.lua Outdated
@prescientmoon
Copy link
Copy Markdown

I think this really needs to be merged! Was really confused by the errors I was getting after updating.

@diablozzq
Copy link
Copy Markdown

I tested this out in WSL / neovim 9 and this did fix the checkhealth issue.

@Ttayu Ttayu mentioned this pull request May 8, 2023
@alxndr13
Copy link
Copy Markdown

@ekickx is there any option that this gets merged? otherwise theres no way this works on neovim 0.9.x

@dfendr
Copy link
Copy Markdown
Author

dfendr commented Jun 13, 2023

@ekickx is there any option that this gets merged? otherwise theres no way this works on neovim 0.9.x

Feel free to use my fork in the meantime if you don't want to change the code yourself, the author hasn't responded in awhile. https://github.com/postfen/clipboard-image.nvim

Otherwise, you can edit the health.lua file in the following ways.

Remove line 3,

local health = require "health"

and change these lines (51-57)

 health.report_start "Checking dependencies"
  if is_dep_exist then
    health.report_ok(report_msg)
  else
    health.report_error(report_msg)
  end
end

to this:

  vim.health.start("Checking dependencies")
  if is_dep_exist then
    vim.health.ok(report_msg)
  else
    vim.health.error(report_msg)
  end
end

@alxndr13
Copy link
Copy Markdown

@postfen thanks, i am currently using your fork :)

@JeffLabonte
Copy link
Copy Markdown

I am using @postfen fork as well. His changes fixed the issue with the addon plugin

image

@JeffLabonte
Copy link
Copy Markdown

JeffLabonte commented Jun 16, 2023

@ekickx 😄 it would be nice if you reviewed this. It is blocking a lot of us from using your code 😢

@tan-wei
Copy link
Copy Markdown

tan-wei commented Oct 11, 2023

Hmm, @postfen 's fork works well.

@Drew-Daniels
Copy link
Copy Markdown

Using @dfendr 's fork as well 👍🏻

jarossnd added a commit to jarossnd/clipboard-image.nvim that referenced this pull request May 27, 2024
@possumdoe
Copy link
Copy Markdown

@ekickx is there any option that this gets merged? otherwise theres no way this works on neovim 0.9.x

Feel free to use my fork in the meantime if you don't want to change the code yourself, the author hasn't responded in awhile. https://github.com/postfen/clipboard-image.nvim

Otherwise, you can edit the health.lua file in the following ways.

Remove line 3,

local health = require "health"

and change these lines (51-57)

 health.report_start "Checking dependencies"
  if is_dep_exist then
    health.report_ok(report_msg)
  else
    health.report_error(report_msg)
  end
end

to this:

  vim.health.start("Checking dependencies")
  if is_dep_exist then
    vim.health.ok(report_msg)
  else
    vim.health.error(report_msg)
  end
end

You can also achieve this using git apply with the following steps:

  1. Locate the Plugin Directory: First, you’ll need to find where the plugin code is located. You could try this command: fd --type=directory -H clipboard-image ~.

  2. Navigate to the directory: Once you’ve identified the correct path, change to that directory. For instance, mine end up being: $HOME/.local/share/nvim/lazy/clipboard-image.nvim.

  3. Download and Check the Diff: To see if the patch is applicable, you can download the diff file and verify it with the following command:

    curl -L https://github.com/ekickx/clipboard-image.nvim/pull/48.diff | git apply --check -
  4. Apply the Patch: If the check does not return any errors, you’re all set to apply the patch.

    curl -L https://github.com/ekickx/clipboard-image.nvim/pull/48.diff | git apply -

The -L option in the curl command allows you to follow any redirects from GitHub.

A quick shoutout to this Stack Overflow answer for providing useful insights on obtaining the diff file of a pull request!

Hope this helps someone!

yyangbian added a commit to yyangbian/clipboard-image.nvim that referenced this pull request Apr 8, 2026
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

Successfully merging this pull request may close these issues.

9 participants