fix(help): wrong tag url in third-party help docs #36115

fix(help): only set url for nvim-owned tags

Problem:
1. gx on |nonexistingtag| opens
https://neovim.io/doc/user/helptag.html?nonexistingtag.
2. b:undo_ftplugin doesn't remove url extmarks.

Solution:
1. Check if the tag is defined in a help file in $VIMRUNTIME.
2. Solution: clear namespace for buffer in b:undo_ftplugin.
This commit is contained in:
Yochem van Rosmalen
2025-10-13 00:08:18 +02:00
committed by GitHub
parent c6113da5a9
commit 62d3a2110d
2 changed files with 27 additions and 6 deletions

View File

@@ -202,6 +202,15 @@ describe('vim.ui', function()
local tagname =
n.api.nvim_buf_get_text(0, tag[2], tag[3], tag[4].end_row, tag[4].end_col, {})[1]
eq(vim.uri_encode(tagname), param)
-- non-nvim tags are ignored
local buf = n.api.nvim_create_buf(false, false)
n.api.nvim_buf_set_lines(buf, 0, 0, false, {
'|nonexisting|',
})
n.api.nvim_set_option_value('filetype', 'help', { buf = buf, scope = 'local' })
local tags = n.api.nvim_buf_get_extmarks(buf, link_ns, 0, -1, {})
eq(#tags, 0)
end)
end)
end)