mirror of
https://github.com/neovim/neovim
synced 2025-07-16 09:11:51 +00:00
docs: remove "#" comment char in @return
Everything after a "#" char is a "description" comment, i.e. luals won't treat it as a type, name, etc. But "#" should not be present in the generated docs (such as :help docs). https://github.com/LuaLS/lua-language-server/wiki/Annotations#return
This commit is contained in:
@ -154,6 +154,8 @@ local function removeCommentFromLine(line)
|
||||
return line:sub(1, pos_comment - 1), line:sub(pos_comment)
|
||||
end
|
||||
|
||||
--- Processes "@…" directives in a docstring line.
|
||||
---
|
||||
--- @param line string
|
||||
--- @param generics table<string,string>
|
||||
--- @return string?
|
||||
@ -206,6 +208,8 @@ local function process_magic(line, generics)
|
||||
magic = magic:gsub('^return%s+.*%((' .. type .. ')%)', 'return %1')
|
||||
magic = magic:gsub('^return%s+.*%((' .. type .. '|nil)%)', 'return %1')
|
||||
end
|
||||
-- Remove first "#" comment char, if any. https://github.com/LuaLS/lua-language-server/wiki/Annotations#return
|
||||
magic = magic:gsub('# ', '', 1)
|
||||
-- handle the return of vim.spell.check
|
||||
magic = magic:gsub('({.*}%[%])', '`%1`')
|
||||
magic_split = vim.split(magic, ' ', { plain = true })
|
||||
|
Reference in New Issue
Block a user