mirror of
https://github.com/neovim/neovim.git
synced 2026-08-26 17:11:48 +00:00
fix(help): :helptags on CRLF helpfiles
Problem:
The vimdoc parser does not treat "\r" as whitespace, so in a CRLF
helpfile the codeblock rule fails and "*" pairs inside examples become
tags. On Windows this generates duplicate "." and "/" tags:
D:/a/neovim/neovim/build/bin/nvim.exe -u NONE -i NONE -e --headless -c "helptags ++t doc" -c "exe 'cquit' !empty(v:errmsg)""
Error in command line:
E154: Duplicate tag "." in gui.txt and repeat.txt
E154: Duplicate tag "/" in pattern.txt and usr_08.txt
E154: Duplicate tag "/" in usr_08.txt and pattern.txt
Note: The old C parser was unaffected because it read helpfiles in text
mode (`os_fopen(…, "r")`).
Solution:
Strip "\r" before parsing.
This commit is contained in:
@@ -433,6 +433,8 @@ local function extract_tags(tags, file, name)
|
||||
return
|
||||
end
|
||||
--- @cast source string
|
||||
-- The grammar treats "\r" as part of a word, so CRLF files would yield bogus tags.
|
||||
source = source:gsub('\r\n', '\n')
|
||||
|
||||
local query = ts.query.parse('vimdoc', '(tag (word) @tagname)')
|
||||
local parser = ts.get_string_parser(source, 'vimdoc')
|
||||
|
||||
Reference in New Issue
Block a user