Skip to content

Commit

Permalink
Update healthcheck (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
MisanthropicBit authored Nov 28, 2024
1 parent 4e61d08 commit 09452dd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion lua/winmove/float.lua
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
local float = {}

local compat = require("winmove.compat")
local config = require("winmove.config")
local message = require("winmove.message")
local winutil = require("winmove.winutil")

local api = vim.api
local has_title = vim.fn.has("nvim-0.9.0") == 1
local has_title = compat.has("nvim-0.9.0")

local float_win_id = nil ---@type integer?

Expand Down
29 changes: 23 additions & 6 deletions lua/winmove/health.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,41 @@
local health = {}

local compat = require("winmove.compat")
local config = require("winmove.config")

local min_neovim_version = "0.8.0"

local report_start, report_ok, report_error

if compat.has("nvim-0.10") then
report_start = vim.health.start
report_ok = vim.health.ok
report_error = vim.health.error
else
---@diagnostic disable-next-line: deprecated
report_start = vim.health.report_start
---@diagnostic disable-next-line: deprecated
report_ok = vim.health.report_ok
---@diagnostic disable-next-line: deprecated
report_error = vim.health.report_error
---@diagnostic disable-next-line: deprecated
end

function health.check()
vim.health.report_start("winmove")
report_start("winmove")

if vim.fn.has("nvim-" .. min_neovim_version) == 1 then
vim.health.report_ok(("has neovim %s+"):format(min_neovim_version))
if compat.has("nvim-" .. min_neovim_version) then
report_ok(("has neovim %s+"):format(min_neovim_version))
else
vim.health.report_error("winmove.nvim requires at least neovim " .. min_neovim_version)
report_error("winmove.nvim requires at least neovim " .. min_neovim_version)
end

local ok, error = config.validate(config)

if ok then
vim.health.report_ok("found no errors in config")
report_ok("found no errors in config")
else
vim.health.report_error("config has errors: " .. error)
report_error("config has errors: " .. error)
end
end

Expand Down

0 comments on commit 09452dd

Please sign in to comment.