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): add option to ignore non-installed languages in the healthcheck #1676

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,10 @@ local DEFAULT_SETTINGS = {
toggle_help = "g?",
},
},

health = {
ignore = {},
},
}
```

Expand Down
8 changes: 6 additions & 2 deletions lua/mason/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ local function check(opts)

report_ok(("%s: `%s`"):format(opts.name, version or "Ok"))
end):on_failure(function(err)
local report = opts.relaxed and report_warn or report_error
report(("%s: not available"):format(opts.name), opts.advice or { tostring(err) })
if vim.tbl_contains(settings.current.health.ignore, opts.name) then
report_ok(("%s: not available (ignored)"):format(opts.name))
else
local report = opts.relaxed and report_warn or report_error
report(("%s: not available"):format(opts.name), opts.advice or { tostring(err) })
end
end)
permit:forget()
end
Expand Down
4 changes: 4 additions & 0 deletions lua/mason/settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ local DEFAULT_SETTINGS = {
toggle_help = "g?",
},
},

health = {
ignore = {},
},
}

M._DEFAULT_SETTINGS = DEFAULT_SETTINGS
Expand Down