From 34a2bfdcc5ce03a1c8e2128cd1c3e7ab99755d12 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Sun, 9 Mar 2025 10:27:28 -0700 Subject: fix(build): vimdoc tags are not validated #32801 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/gen/gen_help_html.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/gen/gen_help_html.lua') 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 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') -- cgit