Skip to content

Commit

Permalink
feat(health): disable dap health check when dap is disabled (#667)
Browse files Browse the repository at this point in the history
  • Loading branch information
b1nhack authored Jan 27, 2025
1 parent e15c262 commit 9fd44c3
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions lua/rustaceanvim/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ local h = vim.health

---@class rustaceanvim.LuaDependency
---@field module string The name of a module
---@field optional fun():boolean Function that returns whether the dependency is optional
---@field is_optional fun():boolean Function that returns whether the dependency is optional
---@field is_enabled fun():boolean Function that returns whether the dependency is enabled
---@field url string URL (markdown)
---@field info string Additional information

---@type rustaceanvim.LuaDependency[]
local lua_dependencies = {
{
module = 'dap',
optional = function()
is_optional = function()
return true
end,
is_enabled = function()
return not require('rustaceanvim.config.internal').dap.disable
end,
url = '[mfussenegger/nvim-dap](https://github.com/mfussenegger/nvim-dap)',
info = 'Needed for debugging features',
},
Expand All @@ -39,10 +43,12 @@ local function check_lua_dependency(dep)
h.ok(dep.url .. ' installed.')
return
end
if dep.optional() then
h.warn(('%s not installed. %s %s'):format(dep.module, dep.info, dep.url))
else
error(('Lua dependency %s not found: %s'):format(dep.module, dep.url))
if dep.is_enabled() then
if dep.is_optional() then
h.warn(('%s not installed. %s %s'):format(dep.module, dep.info, dep.url))
else
error(('Lua dependency %s not found: %s'):format(dep.module, dep.url))
end
end
end

Expand Down

0 comments on commit 9fd44c3

Please sign in to comment.