diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2025-03-09 10:27:28 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-09 10:27:28 -0700 |
commit | 34a2bfdcc5ce03a1c8e2128cd1c3e7ab99755d12 (patch) | |
tree | 70d05aff44f288fe46121c83431137b58cd7d9b5 /src/gen | |
parent | 903242f160faff5f7e3b9ae1a5273ac75a55ed6b (diff) | |
download | rneovim-34a2bfdcc5ce03a1c8e2128cd1c3e7ab99755d12.tar.gz rneovim-34a2bfdcc5ce03a1c8e2128cd1c3e7ab99755d12.tar.bz2 rneovim-34a2bfdcc5ce03a1c8e2128cd1c3e7ab99755d12.zip |
fix(build): vimdoc tags are not validated #32801
Problem:
"make lintdoc" is not validating vimdoc (:help) tags.
Solution:
- Call `lang_tree:parse()` to init the parser.
- Load netrw 🤢 explicitly, since it was moved to `pack/dist/opt/`.
- Fix invalid help tags.
Diffstat (limited to 'src/gen')
-rw-r--r-- | src/gen/gen_help_html.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gen/gen_help_html.lua b/src/gen/gen_help_html.lua index d4766d84a1..0d98d9e1b1 100644 --- a/src/gen/gen_help_html.lua +++ b/src/gen/gen_help_html.lua @@ -778,6 +778,7 @@ local function parse_buf(fname, text, parser_path) vim.treesitter.language.add('vimdoc', { path = parser_path }) end local lang_tree = assert(vim.treesitter.get_parser(buf, nil, { error = false })) + lang_tree:parse() return lang_tree, buf end @@ -1397,6 +1398,9 @@ function M.validate(help_dir, include, parser_path) local files_to_errors = {} ---@type table<string, string[]> ensure_runtimepath() tagmap = get_helptags(vim.fs.normalize(help_dir)) + --- XXX: Append tags from netrw, until we remove it... + local netrwtags = get_helptags(vim.fs.normalize('$VIMRUNTIME/pack/dist/opt/netrw/doc/')) + tagmap = vim.tbl_extend('keep', tagmap, netrwtags) helpfiles = get_helpfiles(help_dir, include) parser_path = parser_path and vim.fs.normalize(parser_path) or nil @@ -1424,7 +1428,7 @@ function M.validate(help_dir, include, parser_path) } end ---- Validates vimdoc files on $VIMRUNTIME. and print human-readable error messages if fails. +--- Validates vimdoc files in $VIMRUNTIME, and prints error messages on failure. --- --- If this fails, try these steps (in order): --- 1. Fix/cleanup the :help docs. @@ -1464,7 +1468,7 @@ function M.test_gen(help_dir) print('doc path = ' .. vim.uv.fs_realpath(help_dir)) -- Because gen() is slow (~30s), this test is limited to a few files. - local input = { 'help.txt', 'index.txt', 'nvim.txt' } + local input = { 'api.txt', 'index.txt', 'nvim.txt' } local rv = M.gen(help_dir, tmpdir, input) eq(#input, #rv.helpfiles) eq(0, rv.err_count, 'parse errors in :help docs') |