Skip to content

Commit

Permalink
feat: generate plugins help pages tags on install/update
Browse files Browse the repository at this point in the history
Adds a new configuration option `generate_help_pages` which defaults to `true`.
  • Loading branch information
NTBBloodbath committed Feb 12, 2024
1 parent 1284734 commit 7706c3b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions lua/rocks/config/check.lua
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ function check.validate(cfg)
luarocks_binary = { cfg.luarocks_binary, "string" },
lazy = { cfg.lazy, "boolean" },
dynamic_rtp = { cfg.dynamic_rtp, "boolean" },
generate_help_pages = { cfg.generate_help_pages, "boolean" },
})
if not ok then
return false, err
Expand Down
2 changes: 2 additions & 0 deletions lua/rocks/config/internal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ local default_config = {
lazy = false,
---@type boolean Whether to automatically add freshly installed plugins to the 'runtimepath'
dynamic_rtp = true,
---@type boolean Whether to re-generate plugins help pages after installation/upgrade
generate_help_pages = true,
---@class RocksConfigDebugInfo
debug_info = {
---@type boolean
Expand Down
15 changes: 15 additions & 0 deletions lua/rocks/operations.lua
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ operations.install = function(rock_spec, progress_handle)
runtime.packadd(name)
end

-- Re-generate help tags
if config.generate_help_pages then
vim.cmd("heltags ALL")
end

future.set(installed_rock)
end
end)
Expand Down Expand Up @@ -438,6 +443,11 @@ operations.sync = function(user_rocks)
progress_handle:finish()
end
cache.populate_removable_rock_cache()

-- Re-generate help tags
if config.generate_help_pages then
vim.cmd("heltags ALL")
end
end)
end

Expand Down Expand Up @@ -529,6 +539,11 @@ operations.update = function()
progress_handle:finish()
end
cache.populate_removable_rock_cache()

-- Re-generate help tags
if config.generate_help_pages then
vim.cmd("heltags ALL")
end
end)
end

Expand Down

0 comments on commit 7706c3b

Please sign in to comment.