From 1ef030f16226152fbba0b46c76bd0726aecd30b4 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 24 Aug 2026 22:07:53 +0200 Subject: fix(help): :helptags regressions Problem: Parent commit regressed some behavior of the old C helptags-gen impl: - helpfiles in sub-directories are named by basename, so :help fails - "help-tags" always names "tags", never "tags-nl" - E150 E151 E152 E153 are never reported - existing tags file is not overwritten if no tags were found - a duplicate tag aborts the run, skipping the remaining directories - `*.TXT` and `*.FRX` (uppercase) are not recognized as helpfiles - tree-sitter-vimdoc accepts tags that the C parser rejected: `*a|b*` (breaks |links|) and unterminated `*tag` - PUC Lua "<" compares with (localized) `strcoll()`, so the tags file is not sorted by byte value (E432) - requiring `vim.treesitter` at load time breaks :help itself, not just :helptags, where the module is unavailable - `vim.pack` runs :helptags for plugins that have no "doc/" directory, so every install/update emits E150 Solution: - Fail the build if generating helptags reports any `v:errmsg`. - Restore old behavior: tags generated for runtime/doc are now identical to those from the C implementation. Errors are non-fatal messages instead of exceptions, so all directories are still processed. - Load treesitter lazily, report a plain error if parser is missing. --- runtime/lua/vim/pack.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'runtime/lua/vim/pack.lua') diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua index 0e986d3196..5c7cb7fda6 100644 --- a/runtime/lua/vim/pack.lua +++ b/runtime/lua/vim/pack.lua @@ -835,11 +835,12 @@ local function checkout(p, timestamp, skip_stash) plugin_lock.plugins[p.spec.name].rev = p.info.sha_target -- (Re)Generate help tags according to the current help files. - -- Also use `pcall()` because `:helptags` errors if there is no 'doc/' - -- directory or if it is empty. + -- Also use `pcall()` because `:helptags` errors if 'doc/' has no help files. local doc_dir = vim.fs.joinpath(p.path, 'doc') vim.fn.delete(vim.fs.joinpath(doc_dir, 'tags')) - copcall(vim.cmd.helptags, { doc_dir, magic = { file = false } }) + if vim.fn.isdirectory(doc_dir) == 1 then + copcall(vim.cmd.helptags, { doc_dir, magic = { file = false } }) + end end --- @param plug_list vim.pack.Plug[] -- cgit