Skip to content

Commit

Permalink
Include the lean.nvim version in checkhealth output.
Browse files Browse the repository at this point in the history
  • Loading branch information
Julian committed Oct 29, 2024
1 parent cd2eace commit 8b3879c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lua/lean/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ return {
---
---Call me via `:checkhealth lean`.
check = function()
vim.health.start 'lean.nvim'
local version = require('lean').plugin_version()
vim.health.start(('lean.nvim (%s)'):format(version))
neovim_is_new_enough()
lake_is_runnable()
no_timers()
Expand Down
15 changes: 15 additions & 0 deletions lua/lean/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,21 @@ function lean.setup(opts)
vim.g.lean_config = opts
end

---Try to find what version of `lean.nvim` this is.
---
---Assumes your `lean.nvim` comes from a `git` repository.
---@return string?
function lean.plugin_version()
local result = util.subprocess_run {
command = 'git',
args = { 'describe', '--tags', '--always' },
}
if result.code == 0 then
local version = table.concat(result.stdout, ''):gsub('%s+', '')
return version
end
end

---Enable mappings for a given buffer
---@param bufnr? number the bufnr to enable mappings in, defaulting to 0
function lean.use_suggested_mappings(bufnr)
Expand Down

0 comments on commit 8b3879c

Please sign in to comment.