diff options
| author | Justin M. Keyes <justinkz@gmail.com> | 2026-08-24 22:07:53 +0200 |
|---|---|---|
| committer | Justin M. Keyes <justinkz@gmail.com> | 2026-08-25 13:32:25 +0200 |
| commit | 1ef030f16226152fbba0b46c76bd0726aecd30b4 (patch) | |
| tree | 8d5646466bf5c8b34ded120dc6bc63a4e73ac227 /runtime/lua/vim/pack.lua | |
| parent | b36b3d7f3a07cfcc4e76079188bfd7d3976a9cd3 (diff) | |
| download | rneovim-1ef030f16226152fbba0b46c76bd0726aecd30b4.tar.gz rneovim-1ef030f16226152fbba0b46c76bd0726aecd30b4.tar.bz2 rneovim-1ef030f16226152fbba0b46c76bd0726aecd30b4.zip | |
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.
Diffstat (limited to 'runtime/lua/vim/pack.lua')
| -rw-r--r-- | runtime/lua/vim/pack.lua | 7 |
1 files changed, 4 insertions, 3 deletions
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[] |