mirror of
https://github.com/neovim/neovim.git
synced 2026-04-19 22:10:45 +00:00
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.
This commit is contained in:
@@ -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')
|
||||
|
||||
@@ -6236,7 +6236,7 @@ local options = {
|
||||
set path=,,
|
||||
< - A directory name may end in a ':' or '/'.
|
||||
- Environment variables are expanded |:set_env|.
|
||||
- When using |netrw.vim| URLs can be used. For example, adding
|
||||
- When using |netrw| URLs can be used. For example, adding
|
||||
"https://www.vim.org" will make ":find index.html" work.
|
||||
- Search upwards and downwards in a directory tree using "*", "**" and
|
||||
";". See |file-searching| for info and syntax.
|
||||
|
||||
Reference in New Issue
Block a user