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

feat(health): don't warn if nvim-dap is not configured #667

Merged
merged 1 commit into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading